diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8abfd99f24..e1f5cf2281 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,11 +10,11 @@ body: For usage questions, please use the following resources: - - Read the [docs](https://www.visactor.io/) - - Find in [examples](https://www.visactor.io/) - - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactor) + - Read the [docs](https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Website_Guide) + - Find in [examples](https://www.visactor.io/vchart/example) + - Look for / ask questions on [faq](https://www.visactor.io/vchart/faq/) or ask intelligence assistant on [visactor.com](https://www.visactor.io/vchart) - For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). + For non-technical support or general questions, you can email [717532978@qq.com](mailto:717532978@qq.com). Also try to search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue using the form below instead of commenting on the old issue. @@ -41,7 +41,7 @@ body: attributes: label: Link to Minimal Reproduction description: | - If the reproduction does not need a build setup, please provide a link to [JSFiddle](https://jsfiddle.net/pfv0azuc/4/),[CodePen](https://codepen.io/kkxxkk2019/pen/KKrMRqa) or [CodeSandbox](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww). If it requires a build setup, you can use [CodeSandbox](https://codesandbox.io/s/the-template-of-visactor-vchart-vl84ww) or provide a GitHub repo. + If the reproduction does not need a build setup, please provide a link to [VChart playground](https://www.visactor.io/vchart/playground) link(use "share" button to get the link),or a GitHub repo. The reproduction should be **minimal** - i.e. it should contain only the bare minimum amount of code needed to show the bug. Please do not just fill in a random link. The issue will be closed if no valid reproduction is provided. [Why?](https://antfu.me/posts/why-reproductions-are-required) diff --git a/.github/ISSUE_TEMPLATE/feaure_request.yml b/.github/ISSUE_TEMPLATE/feaure_request.yml index 0f65b10864..02d03cbdf5 100644 --- a/.github/ISSUE_TEMPLATE/feaure_request.yml +++ b/.github/ISSUE_TEMPLATE/feaure_request.yml @@ -10,11 +10,11 @@ body: For usage questions, please use the following resources: - - Read the [docs](https://www.visactor.io/) - - Find in [examples](https://www.visactor.io//) - - Look for / ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/visactors) + - Read the [docs](https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Website_Guide) + - Find in [examples](https://www.visactor.io/vchart/example) + - Look for / ask questions on [faq](https://www.visactor.io/vchart/faq/) or ask intelligence assistant on [visactor.com](https://www.visactor.io/vchart) - For non-technical support or general questions, you can email [xuanhun521@126.com](mailto:xuanhun521@126.com). + For non-technical support or general questions, you can email [717532978@qq.com](mailto:717532978@qq.com). Also try to search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue using the form below instead of commenting on the old issue. diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 918f28381b..ca4ae80b16 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -16,14 +16,14 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/openinula-vchart': workspace:2.0.5 - '@visactor/react-vchart': workspace:2.0.5 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vchart-extension': workspace:2.0.5 + '@visactor/openinula-vchart': workspace:2.0.6 + '@visactor/react-vchart': workspace:2.0.6 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vchart-extension': workspace:2.0.6 '@visactor/vchart-theme': ~1.6.6 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vtable': 1.19.0-alpha.0 '@visactor/vtable-calendar': 1.19.0-alpha.0 '@visactor/vtable-editors': 1.19.0-alpha.0 @@ -59,8 +59,8 @@ importers: '@visactor/vchart-extension': link:../packages/vchart-extension '@visactor/vchart-theme': 1.6.9 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vtable': 1.19.0-alpha.0 '@visactor/vtable-calendar': 1.19.0-alpha.0 '@visactor/vtable-editors': 1.19.0-alpha.0 @@ -143,9 +143,9 @@ importers: '@types/node': '*' '@types/offscreencanvas': 2019.6.4 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vrender-core': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vutils': ~1.0.6 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -164,8 +164,8 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vutils': 1.0.6 react-is: 18.3.1 devDependencies: @@ -206,10 +206,10 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vchart-extension': workspace:2.0.5 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vchart-extension': workspace:2.0.6 + '@visactor/vrender-core': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vutils': ~1.0.6 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -230,8 +230,8 @@ importers: dependencies: '@visactor/vchart': link:../vchart '@visactor/vchart-extension': link:../vchart-extension - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vutils': 1.0.6 react-is: 18.3.1 devDependencies: @@ -289,8 +289,8 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vchart-extension': workspace:2.0.5 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vchart-extension': workspace:2.0.6 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 @@ -371,13 +371,13 @@ importers: '@types/offscreencanvas': 2019.6.4 '@visactor/vdataset': ~1.0.6 '@visactor/vlayouts': ~1.0.6 - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-components': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': ~1.0.18 + '@visactor/vrender-components': ~1.0.18 + '@visactor/vrender-core': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vscale': ~1.0.6 '@visactor/vutils': ~1.0.6 - '@visactor/vutils-extension': workspace:2.0.5 + '@visactor/vutils-extension': workspace:2.0.6 canvas: 2.11.2 cross-env: ^7.0.3 d3-array: ^1.2.4 @@ -413,10 +413,10 @@ importers: dependencies: '@visactor/vdataset': 1.0.6 '@visactor/vlayouts': 1.0.6 - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-components': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': 1.0.18 + '@visactor/vrender-components': 1.0.18 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vscale': 1.0.6 '@visactor/vutils': 1.0.6 '@visactor/vutils-extension': link:../vutils-extension @@ -475,13 +475,13 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': workspace:2.0.5 + '@visactor/vchart': workspace:2.0.6 '@visactor/vdataset': ~1.0.6 '@visactor/vlayouts': ~1.0.6 - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-components': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': ~1.0.18 + '@visactor/vrender-components': ~1.0.18 + '@visactor/vrender-core': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vutils': ~1.0.6 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 @@ -503,10 +503,10 @@ importers: '@visactor/vchart': link:../vchart '@visactor/vdataset': 1.0.6 '@visactor/vlayouts': 1.0.6 - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-components': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': 1.0.18 + '@visactor/vrender-components': 1.0.18 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vutils': 1.0.6 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -693,8 +693,8 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/node': '*' '@types/node-fetch': 2.6.4 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vchart-extension': workspace:2.0.5 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vchart-extension': workspace:2.0.6 cross-env: ^7.0.3 eslint: ~8.18.0 form-data: ~4.0.0 @@ -877,10 +877,10 @@ importers: '@types/node': '*' '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:2.0.5 - '@visactor/vrender': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vchart': workspace:2.0.6 + '@visactor/vrender': ~1.0.18 + '@visactor/vrender-core': ~1.0.18 + '@visactor/vrender-kits': ~1.0.18 '@visactor/vutils': ~1.0.6 cross-env: ^7.0.3 eslint: ~8.18.0 @@ -893,9 +893,9 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../../packages/vchart - '@visactor/vrender': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender': 1.0.18 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vutils': 1.0.6 devDependencies: '@internal/bundler': link:../bundler @@ -4884,10 +4884,10 @@ packages: '@visactor/vutils': 1.0.4 dev: false - /@visactor/vrender-animate/1.0.13: - resolution: {integrity: sha512-UDCa/ZYHIATukkHHxYdVIPhPnNsWE/mBvRatnUGdTKoIW+gtWZkQ5SsjhSWLXWeZ5lzwXf5afjsg6Vc8Y7HqIg==} + /@visactor/vrender-animate/1.0.18: + resolution: {integrity: sha512-34QNopwsjR6SyUH6ykwXWg5rcaQfdvnox2gBieAI0UB6cN/sUB5z4npxI6bz0WrS4zz923uuYpIS9tFJZLKP6g==} dependencies: - '@visactor/vrender-core': 1.0.13 + '@visactor/vrender-core': 1.0.18 '@visactor/vutils': 1.0.6 dev: false @@ -4901,12 +4901,12 @@ packages: '@visactor/vutils': 1.0.4 dev: false - /@visactor/vrender-components/1.0.13: - resolution: {integrity: sha512-lclrDROH1FRnPhT05NStch759MtllVhGj/59R9rqSbflSt7FKKJ4bMhvwi6Ugh2HBsHVo9HjYUFCiW1oGNFG9w==} + /@visactor/vrender-components/1.0.18: + resolution: {integrity: sha512-T4sINRrl271/WF4u/9riD/aAASfrciYHZ32AiYy2/beLdwJQqlk/uxP6nQWj6V+SJaLJ2eUbvo4xQXGl52AuDQ==} dependencies: - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': 1.0.18 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 '@visactor/vscale': 1.0.6 '@visactor/vutils': 1.0.6 dev: false @@ -4918,8 +4918,8 @@ packages: color-convert: 2.0.1 dev: false - /@visactor/vrender-core/1.0.13: - resolution: {integrity: sha512-YMEUc1zuleTgyUJoMovUFeb4HK0mEMEdvkH+n8/+oexcB+0KCIHXfM/wtOhnMoJ08HAOOXcB+gGMZRig7TrE1Q==} + /@visactor/vrender-core/1.0.18: + resolution: {integrity: sha512-OJUVHlmkDhUKcQd7OoywefMGt/aRQ5JZJ6JWVuHeZPlXrAJOuScf4n6gW0GhoQsLkq10dVQSShmLBzQX3YWPNQ==} dependencies: '@visactor/vutils': 1.0.6 color-convert: 2.0.1 @@ -4936,23 +4936,24 @@ packages: roughjs: 4.5.2 dev: false - /@visactor/vrender-kits/1.0.13: - resolution: {integrity: sha512-qvekmEb8s7oarV5TEXX9Soy71crpi/YkECnRy9ELds21BqHUGi1XLl21Bc50Lsss183c9Bry/bBChw/KjxA9qA==} + /@visactor/vrender-kits/1.0.18: + resolution: {integrity: sha512-4/8qJWpadCnNosjrt53qqmpvE0vL1OBUX1sIvRMT0SacuEPrzi77Bo0RzGIwEfJ6EgQpveqeBc8/aIDZ+zX9Cg==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.13 + '@visactor/vrender-core': 1.0.18 '@visactor/vutils': 1.0.6 gifuct-js: 2.1.2 lottie-web: 5.13.0 roughjs: 4.5.2 dev: false - /@visactor/vrender/1.0.13: - resolution: {integrity: sha512-K/Xo65h4lq1rBMkaXrWK9W2KPWsnaZeEt9I4RdZu1OuJ5jEVkpjiKkE+9BDhBYuz/BOx/mSnYxl2x6LXIqjg6w==} + /@visactor/vrender/1.0.18: + resolution: {integrity: sha512-rkix/XtTo8TMQzsH9AretVHVrKzbi+CKlnpcXDN2zohJg4hQJZqDdnqBvHAHttPUHwwiP5h4A26287eLHeCoKw==} dependencies: - '@visactor/vrender-animate': 1.0.13 - '@visactor/vrender-core': 1.0.13 - '@visactor/vrender-kits': 1.0.13 + '@visactor/vrender-animate': 1.0.18 + '@visactor/vrender-components': 1.0.18 + '@visactor/vrender-core': 1.0.18 + '@visactor/vrender-kits': 1.0.18 dev: false /@visactor/vscale/0.18.18: diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index aa759a96d7..a392ca06e6 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.0.4","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.0.5","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 4663047777..9d256ed789 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,11 @@ +# v2.0.5 + +2025-09-19 + + + +[more detail about v2.0.5](https://github.com/VisActor/VChart/releases/tag/v2.0.5) + # v2.0.2 2025-07-28 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index 418fa4ac5f..4bd5811fe0 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,11 @@ +# v2.0.5 + +2025-09-19 + + + +[更多详情请查看 v2.0.5](https://github.com/VisActor/VChart/releases/tag/v2.0.5) + # v2.0.2 2025-07-28 diff --git a/docs/package.json b/docs/package.json index 63a6c3e37f..a644da1ab9 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,15 +12,15 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:2.0.5", - "@visactor/react-vchart": "workspace:2.0.5", - "@visactor/vchart": "workspace:2.0.5", - "@visactor/vchart-extension": "workspace:2.0.5", + "@visactor/openinula-vchart": "workspace:2.0.6", + "@visactor/react-vchart": "workspace:2.0.6", + "@visactor/vchart": "workspace:2.0.6", + "@visactor/vchart-extension": "workspace:2.0.6", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~1.0.6", - "@visactor/vrender": "1.0.13", - "@visactor/vrender-kits": "1.0.13", + "@visactor/vrender": "~1.0.18", + "@visactor/vrender-kits": "~1.0.18", "@visactor/vtable": "1.19.0-alpha.0", "@visactor/vtable-editors": "1.19.0-alpha.0", "@visactor/vtable-gantt": "1.19.0-alpha.0", @@ -58,4 +58,4 @@ "react-device-detect": "^2.2.2", "minimist": "1.2.8" } -} \ No newline at end of file +} diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 5c0b328cb2..422a1633ba 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal");const vo=new class{};let _o=0;class yo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=vo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++_o,t),this.tryRunAnimationFrameNextFrame(),_o}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class bo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var xo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ao=function(t,e){return function(i,s){e(i,s,t)}},ko=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 Mo=class extends bo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new yo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ko(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var To,wo,Co,Eo;Mo=xo([Ya(),Ao(0,Wa(lo)),Ao(0,$a(fo)),So("design:paramtypes",[Object])],Mo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(To||(To={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(wo||(wo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Eo||(Eo={}));const Bo=Ht-1e-8;class Po{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Bo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,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,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},Io={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Do,Fo,zo,jo,Ho,Vo;var No,Uo,Wo,Go,Yo,$o;function Xo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Ko(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Zo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=nl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function al(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ol(i,n),new ol(n,s)]}class ol extends Jo{constructor(t,e){super(),this.type=Yo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p1.x):t===Go.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ll{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ol(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Go.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===Go.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class hl extends ll{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 cl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function dl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?Go.ROW:Go.COLUMN;return"monotoneY"===t?new hl(t,s):new ll(t,s)}class ul{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 pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new ul(n,s),t),n}function gl(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 fl{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&&gl(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:gl(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 ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("basis",i,t);return function(t,e){cl(t,e,2)}(new fl(n,s),t),n}function vl(t){return t<0?-1:1}function _l(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(vl(r)+vl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function yl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function bl(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 xl{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:bl(this,this._t0,yl(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,bl(this,yl(this,e=_l(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:bl(this,this._t0,e=_l(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 Sl extends xl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneX",i,t);return function(t,e){cl(t,e,2)}(new xl(n,s),t),n}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneY",i,t);return function(t,e){cl(t,e,2)}(new Sl(n,s),t),n}let Ml=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Tl extends Ml{lineEnd(){this.context.closePath()}}function wl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Ml(r,e,n),t),r}function Cl(t,e){return cl(t,e,1)}class El extends ul{lineEnd(){this.context.closePath()}}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new El(n,s),t),n}function Pl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ll(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return pl(i,n);const o=dl(t,r,i);return cl(new e(o,s,a),i,2),o}}const Rl=Ll("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Pl(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=Ll("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Pl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Il extends Jo{constructor(t,e,i){super(),this.type=Yo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return sl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Qo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p2.x):t===Go.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=sl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Il(i,a,r),new Il(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Dl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ol(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Il(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Fl(t,e,i){var s,n;switch(e){case"linear":default:return pl(t,i);case"basis":return ml(t,i);case"monotoneX":return Al(t,i);case"monotoneY":return kl(t,i);case"step":return wl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Tl(r,e,n),t),r}(t,.5,i);case"stepBefore":return wl(t,0,i);case"stepAfter":return wl(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 Ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Bl(t,i)}}class zl extends Lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Po(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Io.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Io.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Io.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([Io.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([Io.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([Io.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([Io.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([Io.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Io.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Dl(this);Zo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Io.M]=t=>`M${t[1]} ${t[2]}`,t[Io.L]=t=>`L${t[1]} ${t[2]}`,t[Io.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Io.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Io.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Io.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;tVo){let t,e=zo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Go.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===Go.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),ih=Object.assign(Object.assign({},Xl),{points:[],cornerRadius:0,closePath:!0}),sh=Object.assign(Object.assign({},Xl),{width:100,height:100,spikes:5,thickness:.5}),nh=Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const rh=Object.assign(Object.assign({},Xl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ah=Object.assign(Object.assign(Object.assign({},Xl),Gl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),oh=Object.assign(Object.assign(Object.assign({},Xl),Gl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),lh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Xl),{fill:!0,cornerRadius:0,cornerType:"round"}),hh=Object.assign(Object.assign({},lh),{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}),ch=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&&_(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 dh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(dh.IsGradientStr(t))try{const e=ch(t)[0];if(e){if("linear"===e.type)return dh.ParseLinear(e);if("radial"===e.type)return dh.ParseRadial(e);if("conic"===e.type)return dh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:dh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:dh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const gh={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"}},fh=!0,mh=!1,vh=/\w|\(|\)|-/,_h=/[.?!,;:/,。?!、;:]/,yh=/\S/,bh=(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})};function xh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=vo.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=Sh(t,a)),a}function Sh(t,e,i=!1){let s=e;for(;vh.test(t[s-1])&&vh.test(t[s])||_h.test(t[s]);)if(s--,s<=0)return i?Ah(t,e):e;return s}function Ah(t,e){let i=e;for(;vh.test(t[i+1])&&vh.test(t[i])||_h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function kh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=vo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Th=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ah.fontSize}){let i=0,s=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=Sh(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,a=!1){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=Sh(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}};Th=Mh([Ya()],Th);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};const Ch=Symbol.for("TextMeasureContribution");let Eh=class extends Th{};Eh=wh([Ya()],Eh);const Bh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},Ph=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Rh(t){return Bh.getNamed(Ph,vo.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Dh=1/3;function Fh(t){return t>-qh&&tqh||t<-qh}const jh=[0,0],Hh=[0,0],Vh=[0,0];function Nh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Gh(t){return(t%=Vt)<0&&(t+=Vt),t}function Yh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function Kh(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(Fh(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 Jh=[-1,-1,-1],Qh=[-1,-1];function tc(){const t=Qh[0];Qh[0]=Qh[1],Qh[1]=t}function ec(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(Fh(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,Dh):Math.pow(i,Dh),s=s<0?-Math.pow(-s,Dh):Math.pow(s,Dh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Jh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&tc(),p=Wh(e,s,r,o,Qh[0]),u>1&&(g=Wh(e,s,r,o,Qh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Fh(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,Jh);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=Uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Jh[0]=-l,Jh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Jh[0]+t&&a<=Jh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Jh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function nc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function rc(t,e){let i=nc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-nc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;ac[0]=S,ac[1]=A,rc(ac,Boolean(a[6])),S=ac[0],A=ac[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Io.M:u=m,p=v,c=u,d=p;break;case Io.L:if(i){if(Kh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Io.C:if(i){if($h(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Io.Q:if(i){if(Yh(c,d,m,v,_,y,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Io.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Xh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=sc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Io.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Kh(u,p,o,p,e,s,n)||Kh(o,p,o,l,e,s,n)||Kh(o,l,u,l,e,s,n)||Kh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Io.Z:if(i){if(Kh(c,d,u,p,e,s,n))return!0}else h+=Le(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},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dc=Symbol.for("VWindow"),uc=Symbol.for("WindowHandlerContribution");let pc=class extends bo{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Bh.getNamed(uc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=vo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};pc=hc([Ya(),cc("design:paramtypes",[])],pc);var gc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mc=function(t,e){return function(i,s){e(i,s,t)}};let vc=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=vo.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=lc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Gl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:Gl.fontFamily,fontSize:Gl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Bh.get(dc),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 _c;vc=gc([Ya(),mc(0,Wa(lo)),mc(0,$a(Ch)),fc("design:paramtypes",[Object])],vc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(_c||(_c={}));const yc=new Ue;let bc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=_c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=_c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}scale(t,e,i){return this.mode===_c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===_c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return yc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}translate(t,e){return this.mode===_c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===_c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bc=gc([Ya(),fc("design:paramtypes",[])],bc);const xc={arc:Kl,area:ql,circle:Zl,line:th,path:eh,symbol:rh,text:ah,rect:nh,polygon:ih,star:sh,richtext:oh,richtextIcon:hh,image:lh,group:Jl,glyph:Ql},Sc=Object.keys(xc);function Ac(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},xc.arc),area:Object.assign({},xc.area),circle:Object.assign({},xc.circle),line:Object.assign({},xc.line),path:Object.assign({},xc.path),symbol:Object.assign({},xc.symbol),text:Object.assign({},xc.text),rect:Object.assign({},xc.rect),polygon:Object.assign({},xc.polygon),star:Object.assign({},xc.star),richtext:Object.assign({},xc.richtext),richtextIcon:Object.assign({},xc.richtextIcon),image:Object.assign({},xc.image),group:Object.assign({},xc.group),glyph:Object.assign({},xc.glyph)};class Mc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Sc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Sc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Ac(n,t[s]),i[s]&&Ac(n,i[s]),e[s]&&Ac(n,e[s]),this.combinedTheme[s]=n})),e.common&&Sc.forEach((t=>{Ac(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 Tc=new Mc;function wc(t,e){return t.glyphHost?wc(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)):Tc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Tc.getTheme()}var Cc=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 Ec 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Cc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Dc(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(Dc(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,Dc(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 Lc))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"):Dc(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 Rc))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=Ic.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 Fc(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 Lc,this.rootWheelEvent=new Rc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Vc{static GetImage(t,e){var i;const s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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):Vc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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"},Vc.cache.set(t,s),s.dataPromise=vo.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=Vc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Vc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vo.global.loadBlob(t):"json"===e&&(i.dataPromise=vo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Vc.isLoading&&Vc.toLoadAueue.length){Vc.isLoading=!0;const t=Vc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Vc.cache.set(i,n),n.dataPromise=vo.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((()=>{Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()})).catch((t=>{console.error(t),Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()}))}}),0)}static loadImage(t,e){const i=Nc(t,Vc.toLoadAueue);if(-1!==i)return Vc.toLoadAueue[i].marks.push(e),void Vc.loading();Vc.toLoadAueue.push({url:t,marks:[e]}),Vc.loading()}static improveImageLoading(t){const e=Nc(t,Vc.toLoadAueue);if(-1!==e){const t=Vc.toLoadAueue.splice(e,1);Vc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Nc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Gc[0]=t[0],Gc[2]=t[0],Gc[1]=t[1],Gc[3]=t[1],Gc):t:t:0,$c=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function Kc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;$c[0].x=i,$c[1].y=i,$c[2].x=-i,$c[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Qc.TimeOut=1e3/60;const td=new Qc,ed=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class id{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 sd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var nd=new class extends id{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 sd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return sd(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 rd=new class extends id{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 ad(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 od=new class extends id{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 ad(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}};function ld(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var hd=new class extends id{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2+n,i,s)}};function cd(t,e,i,s,n=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 dd extends id{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 cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}}var ud=new dd;var pd=new class extends dd{constructor(){super(...arguments),this.type="triangle"}};const gd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),fd=Math.sin(Ht/10)*gd,md=-Math.cos(Ht/10)*gd;function vd(t,e,i,s){const n=fd*e,r=md*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 _d=new class extends id{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 vd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return vd(t,this.parseSize(e)/2+n,i,s)}};const yd=Xt(3);function bd(t,e,i,s){const n=e,r=n/yd,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 xd=new class extends id{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};function Sd(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 Ad=new class extends id{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Md=new class extends id{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Td=-.5,wd=Xt(3)/2,Cd=1/Xt(12);function Ed(t,e,i,s){const n=e/2,r=e*Cd,a=n,o=e*Cd+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(Td*n-wd*r+i,wd*n+Td*r+s),t.lineTo(Td*a-wd*o+i,wd*a+Td*o+s),t.lineTo(Td*l-wd*h+i,wd*l+Td*h+s),t.lineTo(Td*n+wd*r+i,Td*r-wd*n+s),t.lineTo(Td*a+wd*o+i,Td*o-wd*a+s),t.lineTo(Td*l+wd*h+i,Td*h-wd*l+s),t.closePath(),!1}var Bd=new class extends id{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ld=new class extends id{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends id{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Dd=new class extends id{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Fd=Xt(3);function zd(t,e,i,s){const n=e*Fd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var jd=new class extends id{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2/Fd,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2/Fd+n,i,s)}};function Hd(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 Vd=new class extends id{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Ud=new class extends id{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Gd=new class extends id{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 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 Yd(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 $d=new class extends id{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Kd=new class extends id{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Zd=new class extends id{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(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 Qd=new class extends id{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 Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(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 tu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function eu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var iu=new class extends id{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)?eu(t,e,i,s):tu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?eu(t,e+2*n,i,s):tu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const su=new Ve;class nu{constructor(t,e,i=!1){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(),Zo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Zo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{su.x1=i.bounds.x1*t,su.y1=i.bounds.y1*t,su.x2=i.bounds.x2*t,su.y2=i.bounds.y2*t,e.union(su)}))}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 ru={};[nd,rd,od,hd,jd,pd,_d,xd,Ad,Md,Bd,Ld,Od,ud,Dd,Vd,Ud,Gd,$d,iu,Kd,Zd,Qd].forEach((t=>{ru[t.type]=t}));const au={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ou{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 lu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function hu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=hu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=lu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=hu(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 ou(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 ou(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 uu(t,e){return pu(t)}function pu(t,e){const i={};for(let e=0;eSu.set(t,!0)));const Au=new Map;function ku(t){if(Su.has(t))return!0;if(Au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Au.set(t,!0)));const Mu=bu(),Tu=bu(),wu=bu(),Cu=bu(),Eu=bu(),Bu=bu(),Pu=bu(),Lu=bu(),Ru=bu(),Ou=bu();bu();const Iu=bu();bu();const Du=bu();bu();const Fu=bu(),zu=bu(),ju=Symbol.for("GraphicService"),Hu=Symbol.for("GraphicCreator"),Vu={"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"},Nu=Object.keys(Vu),Uu={duration:200,easing:"cubicOut"};function Wu(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 Gu(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 Yu(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 $u(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 Ku{constructor(){this.pools=[]}static identity(t){return Wu(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 Ku.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},Qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tp=new Ue(1,0,0,1,0,0),ep={x:0,y:0};let ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new zl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ep),function(t,e,i){return oc(t,0,!1,e,i)}(this.path.commandList,ep.x,ep.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ep);const i=uh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return oc(t,e,!0,i,s)}(this.path.commandList,i,ep.x,ep.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(t=!0,e=this.dpr){this.setTransformFromMatrix(tp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};ip=Ju([Ya(),Qu("design:paramtypes",[Object,Number])],ip);const sp={WIDTH:500,HEIGHT:500,DPR:1};class np{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}set nativeCanvas(t){this._nativeCanvas=t}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=sp.WIDTH,height:n=sp.HEIGHT,dpr:r=sp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var rp;np.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(rp||(rp={}));class ap{static Get(t,e=rp.Color1,i=[0,0,0,1]){if(e===rp.Color1){const e=ap.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ap.store1[t]=e,ap.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=ap.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(ap.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ap.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===rp.Color1){if(ap.store1[t])return;ap.store1[t]=i,ap.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ap.store255[t])return;ap.store255[t]=i,ap.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function op(t,e=!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 lp(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)=>{var a,o;return hp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):hp(t,e,i,s,n)}function hp(t,e,i,s,n){if(!t||!e)return t&&op(t)||e&&op(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ap.Get(t,rp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ap.Get(e,rp.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:op(a)})))});return o?lp(r,l,i,s,n):lp(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:pp(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:pp(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:pp(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),op(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)}function cp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}ap.store255={},ap.store1={};const dp=[0,0,0,0],up=[0,0,0,0];function pp(t,e,i){return ap.Get(t,rp.Color255,dp),ap.Get(e,rp.Color255,up),`rgba(${Math.round(dp[0]+(up[0]-dp[0])*i)},${Math.round(dp[1]+(up[1]-dp[1])*i)},${Math.round(dp[2]+(up[2]-dp[2])*i)},${dp[3]+(up[3]-dp[3])*i})`}class gp{static GetCanvas(){try{return gp.canvas||(gp.canvas=vo.global.createCanvas({})),gp.canvas}catch(t){return null}}static GetCtx(){if(!gp.ctx){const t=gp.GetCanvas();gp.ctx=t.getContext("2d")}return gp.ctx}}class fp extends We{static getInstance(){return fp._instance||(fp._instance=new fp),fp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=gp.GetCanvas(),s=gp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new fp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class mp{static GetSize(t){for(let e=0;e=t)return mp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=mp.GenKey(t,e,i,s,n),l=mp.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=mp.GenKey(t,e,i,s,n);mp.cache[l]?mp.cache[l].push({width:a,height:o,pattern:r}):mp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}mp.cache={},mp.ImageSize=[20,40,80,160,320,640,1280,2560];const vp=new Ve,_p=new Ue;new Ve;const yp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],bp=["x","y"],xp=["scaleX","scaleY"],Sp=["angle"],Ap=new ne,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends Ec{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ru[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===((i=t=au[t]||t).startsWith("{const e=(new zl).fromString(t.d),i={};Nu.forEach((e=>{t[e]&&(i[Vu[e]]=t[e])})),n.push({path:e,attribute:i}),vp.union(e.bounds)}));const r=vp.width(),a=vp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new nu(t,n,!0);return Mp.userSymbolMap[t]=l,l}var i;const s=(new zl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new nu(t,s);return Mp.userSymbolMap[t]=o,o}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=Yc(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 Po(t);return Zo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&No.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&No.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&No.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&No.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=No.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Uo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Uu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Wo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Wo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Wo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=No.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=No.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&No.UPDATE_SHAPE_AND_BOUNDS)===No.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=No.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=No.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=No.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=No.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=No.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&No.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,scaleX:i=Vl.scaleX,scaleY:s=Vl.scaleY,angle:n=Vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),vo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=_p.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Wo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new zl).fromString(t):this.pathProxy=new zl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),vo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||vo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ip(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Tp;Mp.userSymbolMap={},Mp.mixin(zc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tp||(Tp={}));let wp=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=No.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 Mc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Mc)}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===Uo.GLOBAL){const i=new ne(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&No.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,dx:i=Vl.dx,dy:s=Vl.dy,scaleX:n=Vl.scaleX,scaleY:r=Vl.scaleY,angle:a=Vl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return vo.graphicService.updateTempAABBBounds(i),vo.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&=No.CLEAR_BOUNDS,this._childUpdateTag&=No.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&No.UPDATE_BOUNDS||(this._childUpdateTag|=No.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&No.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=vo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Cp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Ep extends wp{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 Mc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vo.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=>{vo.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Dp,Fp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 jp=Dp=class{static GenerateLayerId(){return`${Dp.idprefix}_${Dp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vo.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?Bh.get(Rp):"dynamic"===t?Bh.get(Op):Bh.get(Ip),e}createLayer(t,e={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 Ep(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Dp.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)}};jp.idprefix="visactor_layer",jp.prefix_count=0,jp=Dp=Fp([Ya(),zp("design:paramtypes",[])],jp);var Hp=new Ra((t=>{t(mo).to(Mo).inSingletonScope(),t(dc).to(pc),t(Pp).to(vc).inSingletonScope(),t(Bp).to(bc).inSingletonScope(),t(Lp).to(jp).inSingletonScope()}));function Vp(t,e){return!(!t&&!e)}function Np(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Up(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Gp(t,e){return t*e>0}function Yp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function $p(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Kp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=$p(g,f,u,p,n,t,Number(c)),l=$p(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=$p(S,A,b,x,r,-n,Number(c)),l=$p(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const qp=Symbol.for("ArcRenderContribution"),Zp=Symbol.for("AreaRenderContribution"),Jp=Symbol.for("CircleRenderContribution"),Qp=Symbol.for("GroupRenderContribution"),tg=Symbol.for("ImageRenderContribution"),eg=Symbol.for("PathRenderContribution"),ig=Symbol.for("PolygonRenderContribution"),sg=Symbol.for("RectRenderContribution"),ng=Symbol.for("SymbolRenderContribution"),rg=Symbol.for("TextRenderContribution"),ag=Symbol.for("InteractiveSubRenderContribution");function og(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function lg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var hg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},dg=function(t,e){return function(i,s){e(i,s,t)}};function ug(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Gu(t,t,[n+o,r+l,a+h]),Gu(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),Gu(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]),f){const i=Zu.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]}Gu(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),Gu(i,i,[-s[0],-s[1],0]),$u(t,t,i)}}let pg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Po(t);return Zo(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=lg(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=og(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){_u(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;_u(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};pg=hg([Ya(),dg(0,Wa(Hu)),cg("design:paramtypes",[Object])],pg);const gg=(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},fg=["radius","startAngle","endAngle",...yp];class mg extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Cu}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 wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.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>Vt-Ft?i.set(-r,-r,r,r):Kc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,fg)}needUpdateTag(t){return super.needUpdateTag(t,fg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new zl,s.arc(0,0,r,a,o),s}clone(){return new mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mg.NOWORK_ANIMATE_ATTR}}function vg(t){return new mg(t)}mg.NOWORK_ANIMATE_ATTR=kp;class _g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=To.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=zu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new bg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=vo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){_u(n,o/Math.abs(r+a),!0,l),i.union(n)}return vo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=vo.graphicUtil.textMeasure,S=new _g(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:_=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),A=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const k=vo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:A},T=new _g(r,M,k),w=y(t)?t.map((t=>t.toString())):[t.toString()],C=[],E=[0,0];let B=1/0;if(_>0&&(B=Math.max(Math.floor(_/A),1)),b&&(B=Math.min(B,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const t=og(v,r),e=this.cache.verticalList.length*m,i=lg(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===xu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const b=og(v,r),x=this.cache.verticalList.length*m,S=lg(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ed(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=yg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=yg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return bg.baselineMapAlign}getAlignMapBaseline(){return bg.alignMapBaseline}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),bg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Sg=["symbolType","size",...yp];let Ag=class t extends Mp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Fu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=vo.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;_u(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return vo.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,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new zl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new zl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Mg=["segments","points","curveType","curveTension",...yp];let Tg=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=Zc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new zl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Cg=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}},Eg=["width","x1","y1","height","cornerRadius",...yp];class Bg extends Mp{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Cg(e);return t=new zl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Lg extends Mp{constructor(t){super(t),this.type="glyph",this.numberType=Eu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=kp;class Og{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=gh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Dg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ed(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=kh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=kh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=xh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=kh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Fg=["width","height","image",...yp];class zg extends Mp{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return lh[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}clone(){return new zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function jg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class Hg extends zg{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=Yc(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=Yc(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=lh.width,height:e=lh.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 Vg{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 Hg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Dg){const e=yh.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 Hg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=kh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)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||mh;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,bh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||fh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ph(t,s,{AABBBounds:i}):s,bh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Hg)break;const{width:n}=kh(t,s.character,s.ascentDescentMode),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 Hg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ng{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=gh[this.direction]}store(t){if(t instanceof Hg){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 Vg(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,e=!1){t instanceof Hg?"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||this.newLine)&&("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=xh(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 Dg(i,t.newLine,t.character,t.ascentDescentMode),new Dg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ug=!1;try{Ug=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ug=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...yp];class Gg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Du,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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1)))}static splitText(t){if(Ug){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Gg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),vo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Gg.AllSingleCharacter(_)&&(_=Gg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Og(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ng(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Gg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Gg.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const $g=["path","customPath",...yp];class Xg extends Mp{constructor(t){super(t),this.type="path",this.numberType=Ru}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 zl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof zl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return vo.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 zl).fromString(t.path):t.customPath&&(this.cache=new zl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){return(new zl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const qg=["segments","points","curveType","curveTension",...yp];class Zg extends Mp{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new zl;const 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 Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...yp];class tf extends Mp{constructor(t){super(t),this.type="arc",this.numberType=Mu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 wc(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}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return vo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(Kc(l,o,s,i),Kc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const sf=["points","cornerRadius",...yp];class nf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new zl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=kp;class af extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function of(t){return new af(t)}const lf=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 hf,cf;function df(t){return hf||(hf=lf.CreateGraphic("text",{})),hf.initAttributes(t),hf.AABBBounds}var uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gf=function(t,e){return function(i,s){e(i,s,t)}};class ff{constructor(){this.time=$o.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=lc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),lc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const mf=new ff;let vf=class{constructor(t){this.subRenderContribitions=t,this.time=$o.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)}))}};vf=uf([Ya(),gf(0,Wa(lo)),gf(0,$a(ag)),pf("design:paramtypes",[Object])],vf);const _f=new class{constructor(){this.time=$o.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const yf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class bf{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=lc.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])),lc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=lc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:uh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Kp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Af=xf,kf=mf;const Mf=new class{constructor(){this.time=$o.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{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:uh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Tf=xf,wf=mf;const Cf=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Ef=zt/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ef,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ef,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Ef,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Ef,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lf{constructor(){this.time=$o.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,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:uh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Bf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Rf=class{constructor(){this.time=$o.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)}};Rf=Pf([Ya()],Rf);let Of=class{constructor(){this.time=$o.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,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Bf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ya()],Of);const If=new Lf,Df=xf,Ff=mf;const zf=new class extends Lf{constructor(){super(...arguments),this.time=$o.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)}},jf=mf;const Hf=new class{constructor(){this.time=$o.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:_=l.opacity,x:y=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:uh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Vf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Nf=xf,Uf=mf;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Gf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(_f),this.builtinContributions.push(yf),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===$o.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===$o.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Up(d,u,h),y=Gp(d,g),b=Vp(h),x=Np(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Zo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Up(o,l,n),p=Gp(o,c),g=Vp(n,r),f=Np(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Zu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Zu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[Sf,kf,Af],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=$p(v,_,f,m,n,t,Number(u)),o=$p(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=$p(M,T,A,k,r,-n,Number(u)),o=$p(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(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(),Kp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Kp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),lp(o.color,l.color,h,!1)}(0,0,h,n);a||Up&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Kf=Yf([Ya(),Xf(0,Wa(lo)),Xf(0,$a(qp)),$f("design:paramtypes",[Object])],Kf);var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jf=function(t,e){return function(i,s){e(i,s,t)}};let Qf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,wf,Tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function tm(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]=nl(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 em(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 im(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=em(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),tm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Go.ROW:"y"===s?u=Go.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 nm=class extends Gf{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();im(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Fl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function rm(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),tm(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),tm(t,l,1,s),o=!1):o=!0}t.closePath()}nm=sm([Ya()],nm);const am=new class extends bf{constructor(){super(...arguments),this.time=$o.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Jc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Jc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},om=mf;var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let dm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[am,om],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=Fl(B(t.points,x),E,{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=Fl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Fl(e,E,{curveTension:b}),n=Fl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Go.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?Go.ROW:null==_.y1?Go.COLUMN:Number.isFinite(S+A)?S>A?Go.ROW:Go.COLUMN:Go.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Go.ROW:Go.COLUMN,Number.isFinite(c)||(o=Go.COLUMN),Number.isFinite(d)||(o=Go.ROW);const u=i*(o===Go.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),im(t,i[0]?e.top:e.bottom,l,x===Go.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};dm=lm([Ya(),cm(0,Wa(lo)),cm(0,$a(Zp)),hm("design:paramtypes",[Object])],dm);const um=xf,pm=mf;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},fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mm=function(t,e){return function(i,s){e(i,s,t)}};let vm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[pm,um],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zo(t.pathShape.commandList,e,i,s,1,1,f);else{Zo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};vm=gm([Ya(),mm(0,Wa(lo)),mm(0,$a(eg)),fm("design:paramtypes",[Object])],vm);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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Wp(g,f,T,w,h),E=Yp(g,v,T,w,M),B=Vp(h,c),P=Np(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Bf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};xm=_m([Ya(),bm(0,Wa(lo)),bm(0,$a(sg)),ym("design:paramtypes",[Object])],xm);var Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Mm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Hf,Uf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Mm=Sm([Ya(),km(0,Wa(lo)),km(0,$a(ng)),Am("design:paramtypes",[Object])],Mm);const Tm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Tm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=df(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Bf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Tm.free(E),C()}};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},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ed(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),qu.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:og(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jm=function(t,e){return function(i,s){e(i,s,t)}};let Hm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),A=Om(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Rm(k,M),w=Om(h,Rm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Hm=Fm([Ya(),jm(0,Wa(lo)),jm(0,$a(ig)),zm("design:paramtypes",[Object])],Hm);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},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Wp(p,m,g,f,c),C=Yp(p,v,g,f),E=Vp(c,u),B=Np(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===$o.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===$o.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=vo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(i,p||i,n),a.modelMatrix=i,Zu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Zu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Vm([Ya(),Um(0,Wa(lo)),Um(0,$a(Qp)),Nm("design:paramtypes",[Object])],Wm);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)},$m=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let Km=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[zf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Bf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Vc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};Km=Gm([Ya(),$m(0,Wa(lo)),$m(0,$a(tg)),Ym("design:paramtypes",[Object])],Km);const qm=Symbol.for("IncrementalDrawContribution"),Zm=Symbol.for("ArcRender"),Jm=Symbol.for("AreaRender"),Qm=Symbol.for("CircleRender"),tv=Symbol.for("GraphicRender"),ev=Symbol.for("GroupRender"),iv=Symbol.for("LineRender"),sv=Symbol.for("PathRender"),nv=Symbol.for("PolygonRender"),rv=Symbol.for("RectRender"),av=Symbol.for("SymbolRender"),ov=Symbol.for("TextRender"),lv=Symbol.for("RichTextRender"),hv=Symbol.for("GlyphRender"),cv=Symbol.for("ImageRender"),dv=Symbol.for("DrawContribution"),uv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Tu,!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+=Vt;for(;o<0;)o+=Vt;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 pv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fv=Symbol.for("DrawItemInterceptor"),mv=new Ve,vv=new Ve;class _v{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){mv.copy(s.dirtyBounds),vv.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,qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(mv),s.backupDirtyBounds.copy(vv)),!0}}class yv{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 bv=class{constructor(){this.order=1,this.interceptors=[new _v,new Sv,new xv,new yv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Zu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,s){e(i,s,t)}};const Tv=Symbol.for("RenderService");let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=Av([Ya(),Mv(0,Wa(dv)),kv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(Tv).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=qu.allocateByObj(a),u=new ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=uv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(ju).to(pg),t(Hu).toConstantValue(lf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&Bh.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Ch).to(Eh).inSingletonScope(),co(t,Ch)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=vo.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=Rh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Rp).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,Xl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=vo.global,this.layerService=vo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,Xl.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Tm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Tm.free(n),qu.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||Bh.get(qm);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 h_=class extends nm{constructor(){super(...arguments),this.numberType=Lu}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=wc(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=Up(u,p,c),_=Gp(u,g),y=Vp(c),b=Np(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends dm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Up(u,d,c),f=Vp(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,Xl.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,Xl.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(tv)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(fv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(ff).toSelf().inSingletonScope(),t(bf).toSelf().inSingletonScope(),t(dv).to(o_),t(qm).to(v_),t(ev).to(Wm).inSingletonScope(),t(tv).toService(ev),co(t,Qp),t(vf).toSelf().inSingletonScope(),co(t,ag),co(t,tv),t(bv).toSelf().inSingletonScope(),t(fv).toService(bv),co(t,fv)}));function y_(){y_.__loaded||(y_.__loaded=!0,Bh.load(Hp),Bh.load(jv),Bh.load(Cv),Bh.load(zv),Bh.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(Bh),function(t){t.load(__)}(Bh))}y_.__loaded=!1,y_();const b_=Bh.get(mo);vo.global=b_;const x_=Bh.get(Pp);vo.graphicUtil=x_;const S_=Bh.get(Bp);vo.transformUtil=S_;const A_=Bh.get(ju);vo.graphicService=A_;const k_=Bh.get(Tv);vo.renderService=k_;const M_=Bh.get(Lp);vo.layerService=M_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class w_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=vo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vo.global.getRequestAnimationFrame();this.rafId=t((()=>{vo.global.devicePixelRatio!==this.dpr&&(this.dpr=vo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=vo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class C_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vo.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 E_=new Ve;class B_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let P_;function L_(){!function(){if(null==P_)try{const t=document.createElement("canvas"),e=t.getContext("2d");P_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),P_&&(P_=!!document.createElement)}catch(t){P_=!1}}();const t=vo.global&&vo.global.env;return t?"browser"===t:P_}let R_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};R_._pluginClasses={};const O_="white";class I_ extends wp{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:O_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Mc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=vo.global,!this.global.env&&L_()&&this.global.setEnv("browser"),this.window=Bh.get(dc),this.renderService=Bh.get(Tv),this.pluginService=Bh.get(Vv),this.layerService=Bh.get(Lp),this.graphicService=Bh.get(ju),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:O_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Hc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=R_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=R_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=R_.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 T_))}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 w_))}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 C_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new B_,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=R_.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=R_.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=R_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Bh.get(dc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Bh.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var D_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},F_=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 z_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return F_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};z_=D_([Ya()],z_);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},H_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let V_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};V_=j_([Ya(),H_("design:paramtypes",[])],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},W_=function(t,e){return function(i,s){e(i,s,t)}};let G_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=vo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=wc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&Zu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function Y_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Q_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ny=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ry=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ny(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ny(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ry(n[0],s,i),ry(n[1],e-s,i)}};let ay=!1;const oy=new Ra((t=>{ay||(ay=!0,t(Kf).toSelf().inSingletonScope(),t(Zm).to(Kf).inSingletonScope(),t(tv).toService(Zm),t(qp).toService(vf),co(t,qp))}));let ly=!1;const hy=new Ra((t=>{ly||(ly=!0,t(xm).toSelf().inSingletonScope(),t(rv).to(xm).inSingletonScope(),t(tv).toService(rv),t(Of).toSelf(),t(Rf).toSelf(),t(sg).toService(Of),t(sg).toService(Rf),t(sg).toService(vf),co(t,sg))}));let cy=!1;const dy=new Ra((t=>{cy||(cy=!0,t(nm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(iv).to(nm).inSingletonScope(),t(tv).toService(iv))}));let uy=!1;const py=new Ra((t=>{uy||(uy=!0,t(dm).toSelf().inSingletonScope(),t(Jm).to(dm).inSingletonScope(),t(tv).toService(Jm),t(Zp).toService(vf),co(t,Zp),t(d_).toSelf().inSingletonScope())}));let gy=!1;const fy=new Ra((t=>{gy||(gy=!0,t(Mm).toSelf().inSingletonScope(),t(av).to(Mm).inSingletonScope(),t(tv).toService(av),t(ng).toService(vf),co(t,ng))}));let my=!1;const vy=new Ra((t=>{my||(my=!0,t(Qf).toSelf().inSingletonScope(),t(Qm).to(Qf).inSingletonScope(),t(tv).toService(Qm),t(Jp).toService(vf),co(t,Jp))}));let _y=!1;const yy=new Ra((t=>{_y||(_y=!0,t(ov).to(Pm).inSingletonScope(),t(tv).toService(ov),t(rg).toService(vf),co(t,rg))}));let by=!1;const xy=new Ra((t=>{by||(by=!0,t(vm).toSelf().inSingletonScope(),t(sv).to(vm).inSingletonScope(),t(tv).toService(sv),t(eg).toService(vf),co(t,eg))}));let Sy=!1;const Ay=new Ra((t=>{Sy||(Sy=!0,t(nv).to(Hm).inSingletonScope(),t(tv).toService(nv),t(ig).toService(vf),co(t,ig))}));var ky=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 My=class{constructor(){this.numberType=Eu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};My=ky([Ya()],My);let Ty=!1;const wy=new Ra((t=>{Ty||(Ty=!0,t(hv).to(My).inSingletonScope(),t(tv).toService(hv))}));var Cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let By=class extends Gf{constructor(){super(),this.numberType=Du,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Up(o,l,!0),d=Up(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};By=Cy([Ya(),Ey("design:paramtypes",[])],By);let Py=!1;const Ly=new Ra((t=>{Py||(Py=!0,t(lv).to(By).inSingletonScope(),t(tv).toService(lv))}));let Ry=!1;const Oy=new Ra((t=>{Ry||(Ry=!0,t(cv).to(Km).inSingletonScope(),t(tv).toService(cv),t(tg).toService(vf),co(t,tg))}));function Iy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),zy=(t,e)=>(d(Hy.warnHandler)&&Hy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),jy=(t,e,i)=>{if(!d(Hy.errorHandler))throw new Error(t);Hy.errorHandler.call(null,t,e)},Hy={silent:!1,warnHandler:!1,errorHandler:!1},Vy=L_(),Ny=Vy&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Vy}function Wy(t){return Gy(t)||"mobile-browser"===t}function Gy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Yy=0;function $y(){return Yy>=9999999&&(Yy=0),Yy++}function Xy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Ky(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Zy extends wp{constructor(t,e){super(t),this._skipRenderAttributes=qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},Mb=(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 Tb extends l{constructor(t,e={}){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.startTime=Ic.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=Ic.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||kb(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=Mb(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=Ic.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=Mb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=kb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Mb(s[0],t){vo.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){if(!this.element)return;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},Cb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Bb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Nl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Wl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Gl),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 qu.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&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&mp.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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=vo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Gl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Gl.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&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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=ph(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:uh(this,a,this.dpr),r.strokeStyle=ph(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};Bb.env="browser",Bb=wb([Ya(),Cb("design:paramtypes",[Object,Number])],Bb);var Pb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rb=class extends np{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Bb(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 Ob(t,e){return new Ra((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Rb.env="browser",Rb=Pb([Ya(),Lb("design:paramtypes",[Object])],Rb);const Ib=Ob(Rb,Bb);var Db=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},zb=function(t,e){return function(i,s){e(i,s,t)}};let jb=class extends G_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=lc.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 Vb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};Vb=Hb([Ya()],Vb);const Nb=new Ra(((t,e,i,s)=>{Nb.__vloaded||(Nb.__vloaded=!0,t(Sb).to(Vb).inSingletonScope(),t(Ab).toService(Sb),co(t,Ab))}));Nb.__vloaded=!1;var Ub=Nb;const Wb=new Ra(((t,e,i,s)=>{i(jb)||t(jb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(jb):t(Ev).toService(jb)}));var Gb,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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=Gb=class extends V_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Gb.idprefix}_${Gb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Gb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Rb(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 Rb({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)}};Xb.env="browser",Xb.idprefix="visactor_window",Xb.prefix_count=0,Xb=Gb=Yb([Ya(),$b("design:paramtypes",[])],Xb);const Kb=new Ra((t=>{t(Xb).toSelf(),t(uc).toDynamicValue((t=>t.container.get(Xb))).whenTargetNamed(Xb.env)}));var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Jb=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 Qb{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 tx(t,e=!1){const i=document.createElement("img");if(vo.global.isImageAnonymous&&(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 ex=class extends z_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Qb(t)}return new Ve}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 tx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return tx(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:La.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(...t){}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}}loadFont(t,e,i){return Jb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ex=qb([Ya(),Zb("design:paramtypes",[])],ex);const ix=new Ra((t=>{ix.isBrowserBound||(ix.isBrowserBound=!0,t(ex).toSelf().inSingletonScope(),t(fo).toService(ex))}));function sx(t,e=!0){sx.__loaded||(sx.__loaded=!0,t.load(ix),t.load(Ib),t.load(Kb),e&&function(t){t.load(Ub),t.load(Wb)}(t))}ix.isBrowserBound=!1,sx.__loaded=!1;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};let rx=class extends Bb{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}};rx.env="feishu",rx=nx([Ya()],rx);var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=class extends np{constructor(t){super(t)}init(){this._context=new rx(this,this._dpr)}release(...t){}};lx.env="feishu",lx=ax([Ya(),ox("design:paramtypes",[Object])],lx);const hx=Ob(lx,rx);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)}};class px{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 gx=class extends V_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new px}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lx(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 lx({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()}};gx.env="feishu",gx=cx([Ya(),ux(0,Wa(mo)),dx("design:paramtypes",[Object])],gx);const fx=new Ra((t=>{t(gx).toSelf(),t(uc).toDynamicValue((t=>t.container.get(gx))).whenTargetNamed(gx.env)}));var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends G_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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}};yx=mx([Ya(),_x(0,Wa(lo)),_x(0,$a(Jy)),_x(1,Wa(lo)),_x(1,$a(Pv)),_x(2,Wa(lo)),_x(2,$a(Lv)),vx("design:paramtypes",[Object,Object,Object])],yx);const bx=new Ra((t=>{bx.__vloaded||(bx.__vloaded=!0,co(t,Jy))}));bx.__vloaded=!1;var xx=bx;class Sx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:uh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};Tx=Ax([Ya(),Mx(0,Wa(Zm)),kx("design:paramtypes",[Object])],Tx);let wx=!1;const Cx=new Ra(((t,e,i,s)=>{wx||(wx=!0,t(Qy).to(Tx).inSingletonScope(),t(Jy).toService(Qy))}));var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Lx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};Lx=Ex([Ya(),Px(0,Wa(Jm)),Bx("design:paramtypes",[Object])],Lx);let Rx=!1;const Ox=new Ra(((t,e,i,s)=>{Rx||(Rx=!0,t(tb).to(Lx).inSingletonScope(),t(Jy).toService(tb))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let zx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};zx=Ix([Ya(),Fx(0,Wa(Qm)),Dx("design:paramtypes",[Object])],zx);let jx=!1;const Hx=new Ra(((t,e,i,s)=>{jx||(jx=!0,t(eb).to(zx).inSingletonScope(),t(Jy).toService(eb))}));class Vx{constructor(){this.type="glyph",this.numberType=Eu}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 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},Ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};Gx=Nx([Ya(),Wx(0,Wa(hv)),Ux("design:paramtypes",[Object])],Gx);let Yx=!1;const $x=new Ra(((t,e,i,s)=>{Yx||(Yx=!0,t(hb).to(Gx).inSingletonScope(),t(Gx).toService(hb))}));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};let Kx=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kx=Xx([Ya()],Kx);let qx=!1;const Zx=new Ra(((t,e,i,s)=>{qx||(qx=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};eS=Jx([Ya(),tS(0,Wa(iv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new Ra(((t,e,i,s)=>{iS||(iS=!0,t(sb).to(eS).inSingletonScope(),t(Jy).toService(sb))}));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},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};oS=nS([Ya(),aS(0,Wa(nv)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new Ra(((t,e,i,s)=>{lS||(lS=!0,t(lb).to(oS).inSingletonScope(),t(Jy).toService(lb))}));var cS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uS=function(t,e){return function(i,s){e(i,s,t)}};let pS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};pS=cS([Ya(),uS(0,Wa(sv)),dS("design:paramtypes",[Object])],pS);let gS=!1;const fS=new Ra(((t,e,i,s)=>{gS||(gS=!0,t(nb).to(pS).inSingletonScope(),t(Jy).toService(nb))})),mS=new Ve;class vS{constructor(){this.type="rect",this.numberType=Iu}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:uh(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;mS.setValue(i.x1,i.y1,i.x2,i.y2),mS.expand(-r/2),h=!mS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends vS{constructor(t){super(),this.canvasRenderer=t}};xS=_S([Ya(),bS(0,Wa(rv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Ra(((t,e,i,s)=>{SS||(SS=!0,t(rb).to(xS).inSingletonScope(),t(Jy).toService(rb))}));let kS=!1;const MS=new Ra(((t,e,i,s)=>{kS||(kS=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));var TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CS=function(t,e){return function(i,s){e(i,s,t)}};let ES=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}};ES=TS([Ya(),CS(0,Wa(av)),wS("design:paramtypes",[Object])],ES);let BS=!1;const PS=new Ra(((t,e,i,s)=>{BS||(BS=!0,t(ab).to(ES).inSingletonScope(),t(Jy).toService(ab))}));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 RS=class{constructor(){this.type="text",this.numberType=zu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RS=LS([Ya()],RS);let OS=!1;const IS=new Ra(((t,e,i,s)=>{OS||(OS=!0,t(ob).to(RS).inSingletonScope(),t(Jy).toService(ob))})),DS=new Ra(((t,e,i,s)=>{i(yx)||t(yx).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(yx):t(Ev).toService(yx)}));class FS{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 zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HS=class extends z_{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 FS(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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};HS=zS([Ya(),jS("design:paramtypes",[])],HS);const VS=new Ra((t=>{VS.isFeishuBound||(VS.isFeishuBound=!0,t(HS).toSelf().inSingletonScope(),t(fo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(hx),t.load(fx),e&&function(t){t.load(xx),t.load(DS),t.load(Cx),t.load(Ox),t.load(Hx),t.load($x),t.load(Zx),t.load(sS),t.load(hS),t.load(fS),t.load(AS),t.load(MS),t.load(PS),t.load(IS)}(t))}VS.isFeishuBound=!1,NS.__loaded=!1;var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GS=class extends Bb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};GS.env="node",GS=US([Ya(),WS("design:paramtypes",[Object,Number])],GS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends np{constructor(t){super(t)}init(){this._context=new GS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};XS.env="node",XS=YS([Ya(),$S("design:paramtypes",[Object])],XS);const KS=Ob(XS,GS);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},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JS=function(t,e){return function(i,s){e(i,s,t)}};let QS=class extends V_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new XS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new XS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};QS.env="node",QS=qS([Ya(),JS(0,Wa(mo)),ZS("design:paramtypes",[Object])],QS);const tA=new Ra((t=>{t(QS).toSelf(),t(uc).toDynamicValue((t=>t.container.get(QS))).whenTargetNamed(QS.env)}));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};let iA=class extends z_{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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};iA=eA([Ya()],iA);const sA=new Ra((t=>{sA.isNodeBound||(sA.isNodeBound=!0,t(iA).toSelf().inSingletonScope(),t(fo).toService(iA))}));function nA(t,e=!0){nA.__loaded||(nA.__loaded=!0,t.load(sA),t.load(KS),t.load(tA))}sA.isNodeBound=!1,nA.__loaded=!1;var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};lA=rA([Ya(),oA(0,Wa(Zm)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new Ra(((t,e,i,s)=>{hA||(hA=!0,t(cb).to(lA).inSingletonScope(),t(Ab).toService(cb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class extends vS{constructor(t){super(),this.canvasRenderer=t}};gA=dA([Ya(),pA(0,Wa(rv)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new Ra(((t,e,i,s)=>{fA||(fA=!0,t(mb).to(gA).inSingletonScope(),t(Ab).toService(mb))}));class vA extends Gf{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:uh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};xA=_A([Ya(),bA(0,Wa(iv)),yA("design:paramtypes",[Object])],xA);let SA=!1;const AA=new Ra(((t,e,i,s)=>{SA||(SA=!0,t(gb).to(xA).inSingletonScope(),t(Ab).toService(gb))}));var kA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let wA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};wA=kA([Ya(),TA(0,Wa(Jm)),MA("design:paramtypes",[Object])],wA);let CA=!1;const EA=new Ra(((t,e,i,s)=>{CA||(CA=!0,t(db).to(wA).inSingletonScope(),t(Ab).toService(db))}));class BA extends Gf{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&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}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:uh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Zu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};OA=PA([Ya(),RA(0,Wa(av)),LA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new Ra(((t,e,i,s)=>{IA||(IA=!0,t(vb).to(OA).inSingletonScope(),t(Ab).toService(vb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jA=function(t,e){return function(i,s){e(i,s,t)}};let HA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};HA=FA([Ya(),jA(0,Wa(Qm)),zA("design:paramtypes",[Object])],HA);let VA=!1;const NA=new Ra(((t,e,i,s)=>{VA||(VA=!0,t(ub).to(HA).inSingletonScope(),t(Ab).toService(ub))}));var UA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,s){e(i,s,t)}};let YA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=zu}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=lg(a,u,n),v=og(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&&Zu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};YA=UA([Ya(),GA(0,Wa(ov)),WA("design:paramtypes",[Object])],YA);let $A=!1;const XA=new Ra(((t,e,i,s)=>{$A||($A=!0,t(_b).to(YA).inSingletonScope(),t(Ab).toService(_b))}));var KA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ZA=function(t,e){return function(i,s){e(i,s,t)}};let JA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};JA=KA([Ya(),ZA(0,Wa(sv)),qA("design:paramtypes",[Object])],JA);let QA=!1;const tk=new Ra(((t,e,i,s)=>{QA||(QA=!0,t(fb).to(JA).inSingletonScope(),t(Ab).toService(fb))}));var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sk=function(t,e){return function(i,s){e(i,s,t)}};let nk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};nk=ek([Ya(),sk(0,Wa(nv)),ik("design:paramtypes",[Object])],nk);let rk=!1;const ak=new Ra(((t,e,i,s)=>{rk||(rk=!0,t(yb).to(nk).inSingletonScope(),t(Ab).toService(yb))}));var ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hk=function(t,e){return function(i,s){e(i,s,t)}};let ck=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};ck=ok([Ya(),hk(0,Wa(hv)),lk("design:paramtypes",[Object])],ck);let dk=!1;const uk=new Ra(((t,e,i,s)=>{dk||(dk=!0,t(xb).to(ck).inSingletonScope(),t(Ab).toService(xb))}));var pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mk=pk([Ya(),fk(0,Wa(lv)),gk("design:paramtypes",[Object])],mk);let vk=!1;const _k=new Ra(((t,e,i,s)=>{vk||(vk=!0,t(bb).to(mk).inSingletonScope(),t(Ab).toService(bb))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};Sk=yk([Ya(),xk(0,Wa(cv)),bk("design:paramtypes",[Object])],Sk);let Ak=!1;const kk=new Ra(((t,e,i,s)=>{Ak||(Ak=!0,t(pb).to(Sk).inSingletonScope(),t(Ab).toService(pb))})),Mk=L_();function Tk(){Tk.__loaded||(Tk.__loaded=!0,lf.RegisterGraphicCreator("arc",ef),Bh.load(oy),Bh.load(Mk?cA:Cx))}Tk.__loaded=!1;const wk=Tk;function Ck(){Ck.__loaded||(Ck.__loaded=!0,lf.RegisterGraphicCreator("area",Jg),Bh.load(py),Bh.load(Mk?EA:Ox))}Ck.__loaded=!1;const Ek=Ck;function Bk(){Bk.__loaded||(Bk.__loaded=!0,lf.RegisterGraphicCreator("circle",vg),Bh.load(vy),Bh.load(Mk?NA:Hx))}Bk.__loaded=!1;const Pk=Bk;function Lk(){Lk.__loaded||(Lk.__loaded=!0,lf.RegisterGraphicCreator("glyph",Rg),Bh.load(wy),Bh.load(Mk?uk:$x))}Lk.__loaded=!1;const Rk=Lk;function Ok(){Ok.__loaded||(Ok.__loaded=!0,lf.RegisterGraphicCreator("group",Cp))}Ok.__loaded=!1;const Ik=Ok;function Dk(){Dk.__loaded||(Dk.__loaded=!0,lf.RegisterGraphicCreator("image",jg),Bh.load(Oy),Bh.load(Mk?kk:Zx))}Dk.__loaded=!1;const Fk=Dk;function zk(){zk.__loaded||(zk.__loaded=!0,lf.RegisterGraphicCreator("line",wg),Bh.load(dy),Bh.load(Mk?AA:sS))}zk.__loaded=!1;const jk=zk;function Hk(){Hk.__loaded||(Hk.__loaded=!0,lf.RegisterGraphicCreator("path",Kg),Bh.load(xy),Bh.load(Mk?tk:fS))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,lf.RegisterGraphicCreator("polygon",rf),Bh.load(Ay),Bh.load(Mk?ak:hS))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,lf.RegisterGraphicCreator("rect",Pg),Bh.load(hy),Bh.load(Mk?mA:AS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,lf.RegisterGraphicCreator("richtext",Yg),Bh.load(Ly),Bh.load(Mk?_k:MS))}Yk.__loaded=!1;const $k=Yk;function Xk(){Xk.__loaded||(Xk.__loaded=!0,lf.RegisterGraphicCreator("shadowRoot",of))}Xk.__loaded=!1;const Kk=Xk;function qk(){qk.__loaded||(qk.__loaded=!0,lf.RegisterGraphicCreator("symbol",kg),Bh.load(fy),Bh.load(Mk?DA:PS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,lf.RegisterGraphicCreator("text",xg),Bh.load(yy),Bh.load(Mk?XA:IS))}Jk.__loaded=!1;const Qk=Jk;function tM(){Ik(),Gk()}const eM=-.5*Math.PI,iM=1.5*Math.PI,sM="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 nM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nM||(nM={}));const rM={[nM.selectedReverse]:{},[nM.selected]:{},[nM.hover]:{},[nM.hoverReverse]:{}},aM={container:"",width:30,height:30,style:{}},oM="scrollDrag";function lM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const hM={debounce:xt,throttle:St};tM();let cM=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=lM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:hM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(oM,{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",hM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};cM.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};var dM,uM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 pM=dM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=dM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(oM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new cM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(pM)||(t(pM).toSelf(),t(Hv).toService(pM))}));function fM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&fM(t,e)}))}const mM=t=>!u(t)&&!1!==t.visible;function vM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function _M(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 bM=["#ffffff","#000000"];function xM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return SM(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(...bM);for(const n of a)if(t!==n&&SM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function SM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=kM(t),s=kM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function kM(t){const e=si(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 MM(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 TM(t,e){return[t[0]*e,t[1]*e]}function wM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function CM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:sM,fontSize:14},s),getTextBounds:i?void 0:df,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function BM(t,e,i={}){if(!t)return{width:0,height:0};const s=df({text:t,fontFamily:e.fontFamily||i.fontFamily||sM,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 PM(t,e="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 LM(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 RM(t,e="type"){const i=PM(t,e);return"rich"===i?lf.richtext(LM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),lf.text(t))}function OM(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 IM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function DM(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 FM(t,e){const{dx:i,dy:s}=DM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function zM(){Ik(),Gk(),Zk(),$k(),Qk()}var jM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=jM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new zl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},HM.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))}}HM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const VM={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}},NM={poptip:j({},VM)};var UM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}qM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{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={};j(s,qM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new qM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,NM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};JM=ZM([Ya()],JM);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};class tT{constructor(){this.activeEvent="onRegister",this._uid=La.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 eT=class extends tT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};eT=QM([Ya()],eT);let iT=class extends tT{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)}};iT=QM([Ya()],iT);const sT=new Ra(((t,e,i,s)=>{i(JM)||(t(JM).toSelf().inSingletonScope(),t(ag).toService(JM)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT)),i(iT)||(t(iT).toSelf(),t(Hv).toService(iT))}));class nT extends Zy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ik(),jk();class rT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ik(),Gk();class aT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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})}}aT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ik(),wk();class oT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}oT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ik(),wk();class lT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=eM,endAngle:s=iM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}lT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ik(),Vk();class hT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function cT(){Ik(),jk(),Uk(),Zk()}function dT(){Ik(),jk(),wk(),Zk()}hT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cT();class uT extends Zy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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(k(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=lf.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),P(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=lf.line;Y(i)[0].cornerRadius&&(t=lf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=lf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}uT.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}}},dT();class pT extends uT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=lf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var gT,fT;!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"}(gT||(gT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fT||(fT={}));const mT={[fT.selectedReverse]:{},[fT.selected]:{},[fT.hover]:{},[fT.hoverReverse]:{}},vT={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}}},_T={size:8,stroke:"#000",lineWidth:1,zIndex:1};const yT=Math.sin(Math.PI/10);function bT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function xT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function ST(t){const e={};return fM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function AT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function kT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/wM(r))}function MT(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 wT(t,e,i){var s;if(xT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function CT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(nM.hover,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.hoverReverse,!0)})),s):i},BT=(t,e,i)=>i?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),null):i,PT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(nM.selected)?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.selectedReverse),t.removeState(nM.selected))})),null):s.name&&!P(s.states)?(s.addState(nM.selected,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.selectedReverse,!0)})),s):i};class LT extends Zy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const RT={type:"default",duration:300,easing:"linear"};class OT extends LT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=ET(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=lf.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._prepare(),this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(RT)}_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=lf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=gT.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=lf.group({x:0,y:0,pickable:!1});t.name=gT.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=lf.group({x:0,y:0,pickable:!1});i.name=gT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=lf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=gT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=rM;else{const t=this.data[s],e=j({},rM,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=lf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=gT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=rM;else{const i=j({},rM,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=lf.group({x:0,y:0,pickable:!1});return r.name=`${gT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=RM(this._getLabelAttribute(t,e,n,i));if(a.name=gT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=rM;else{const s=j({},rM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new HM(Object.assign({},e));i.name=gT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return AT(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},vT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},fM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const IT={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&&wT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function DT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function FT(t,e,i,s,n=!1){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:IT[n]||IT.parity;if(s.length>=3&&CT(s,r)){do{s=a(s,r)}while(s.length>=3&&CT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);wT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),FT(l,s,n,(t=>wT(t,l,r))),FT(h,s,o,(t=>wT(t,h,r)||!(!n||t===l)&&wT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function jT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},NT(t,e.attribute.angle)),{angle:VT(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({},UT(t,e.attribute.angle)),{angle:VT(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 VT(t=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 NT(t,e=0){let 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=VT(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 UT(t,e=0){let 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=VT(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 WT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=xT(h),m=bT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 GT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class YT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=wM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $T{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-$T.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$T.bounceIn(2*t):.5*$T.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){$T[t]=e}}function XT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$T.quadIn=$T.getPowIn(2),$T.quadOut=$T.getPowOut(2),$T.quadInOut=$T.getPowInOut(2),$T.cubicIn=$T.getPowIn(3),$T.cubicOut=$T.getPowOut(3),$T.cubicInOut=$T.getPowInOut(3),$T.quartIn=$T.getPowIn(4),$T.quartOut=$T.getPowOut(4),$T.quartInOut=$T.getPowInOut(4),$T.quintIn=$T.getPowIn(5),$T.quintOut=$T.getPowOut(5),$T.quintInOut=$T.getPowInOut(5),$T.backIn=$T.getBackIn(1.7),$T.backOut=$T.getBackOut(1.7),$T.backInOut=$T.getBackInOut(1.7),$T.elasticIn=$T.getElasticIn(1,.3),$T.elasticOut=$T.getElasticOut(1,.3),$T.elasticInOut=$T.getElasticInOut(1,.3*1.5),$T.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$T.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$T.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$T[`flicker${t}`]=e=>XT(e,t);for(let t=2;t<10;t++)$T[`aIn${t}`]=e=>t*e*e+(1-t)*e;function KT(t,e,i){return t+(e-t)*i}const qT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=KT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=KT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=KT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=KT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=KT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=KT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=KT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=KT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=KT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=lp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?cp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=lp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?cp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=KT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=KT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=KT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=KT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=KT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=KT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=KT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Zc(e,i,s),r.addUpdateBoundTag()}}};function ZT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$T[s])&&void 0!==n?n:$T.linear:$T.linear,"wait"===t&&(this.onUpdate=JT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=JT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=ap.Get(i,rp.Color255),r=ap.Get(s,rp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(qT["fill"===e?"fillPure":"strokePure"])}else qT[e]?t.push(qT[e]):t.push(ZT)}else qT[e]?t.push(qT[e]):t.push(ZT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tw extends QT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class ew extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Eo.END?this.removeAnimate(t,!0):t.status!==Eo.RUNNING&&t.status!==Eo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const iw=new ew;iw.isGlobal=!0;class sw{constructor(t=La.GenAutoIncrementId(),e=iw,i){this.id=t,this.status=Eo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new QT(Co.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tw(Co.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new QT(Co.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Eo.RUNNING&&(this.status=Eo.PAUSED)}resume(){this.status===Eo.PAUSED&&(this.status=Eo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Eo.END&&this.onEnd(),this.status=Eo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Eo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Eo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Eo.END);this.status=Eo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const nw=new yo;class rw{constructor(){this.released=!1}tick(t,e){nw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class aw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wo.INITIAL,vo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),vo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new rw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wo.INITIAL&&(this.status=wo.PAUSE,!0)}resume(){return this.status!==wo.INITIAL&&(this.status=wo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}lw.getInstance();class hw{static registerBuiltInAnimate(t,e){hw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:hw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:hw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:hw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}hw.builtInAnimateMap={};const cw="appear",dw="disappear",uw="update",pw="highlight",gw="unhighlight";class fw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class mw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=lw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyDisappearState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyUpdateState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyHighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class vw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new mw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new fw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new vw)._getAnimationStateManager(t),t}}class _w{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new sw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:iw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new ew}createTicker(t){return new aw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new hw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function yw(){G(Mp,vw),G(Mp,_w)}class bw extends QT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class xw extends bw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Sw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new hw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Aw(t){return new Sw(t)}class kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Mw=1e3,Tw="quadInOut",ww=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Cw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=lp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ew=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?J_(t):[],n=J_(e);i&&s&&(i.fromTransform&&Q_(s,i.fromTransform.clone().getInverse()),Q_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Pw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Lw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Pw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?ap.Get(t,rp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Rw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ew(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Cw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Ow=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Bw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Lw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Rw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tw);return c.play(d),c};class Iw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ew(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Cw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Dw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ww.includes(t))(i)||(e[i]=t[i])})),e},Fw=(t,e,i)=>{const s=Dw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=vo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},zw=(t,e,i)=>{const s=[],n=i?null:Dw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Dw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Cg(t.attribute),n=ey(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(vo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ey(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ey(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return iy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return iy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(vo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:sy(i)}];const s=[];return ry(i,e,s),s})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ry(l,e,h),h})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=J_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(vo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Fw(t,s,e),s};class Hw extends bw{constructor(t,e,i,s,n){super(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(){super.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:Wo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Wo.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:Wo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vw extends Hw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=vo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Nw extends Hw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=vo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Uw extends bw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class $w extends Gw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Xw=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qw extends Kw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Xw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class Zw extends Kw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Jw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Qw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends xw{onBind(){var t;const e=Aw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class xC extends xw{onBind(){const t=Aw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function SC(){Ik(),jk(),$k(),Qk(),hw.registerBuiltInAnimate("axisEnter",bC),hw.registerBuiltInAnimate("axisUpdate",xC)}var AC=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=lf.group({zIndex:999});e.name=gT.axisBreak,e.id=this._getNodeId(`${gT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},_T,s),a=null!==(e=r.size)&&void 0!==e?e:_T.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=lf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=gT.axisBreakSymbol;const h=lf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=gT.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=lf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=gT.background,n.id=this._getNodeId("background"),n.states=j({},mT,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=AC(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];P(l)||(c.state={line:j({},mT,l),symbol:j({},mT,l)});const d=new uT(c);d.name=gT.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=AC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=CM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},mT,c.text),shape:j({},mT,c.shape),panel:j({},mT,c.background)}});return E.angle=w,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 NT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return UT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),HT(i,t),!jT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=xT(a),l=bT(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=GT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=GT(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);k(i)&&(c=Yt(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&&k(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);WT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&zT(t,{orient:o,method:m,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(k(c)&&(!k(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=lf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=gT.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=BM(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=ri(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}}kC.defaultAttributes=vT,G(kC,YT);class MC{isInValidValue(t){const{startAngle:e=eM,endAngle:i=iM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=eM,endAngle:i=iM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return kT(t,i,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 TC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=TC(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 EC=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),k(l)&&l>=3){const t=MT(n,l,c,e,i);h=lf.path(Object.assign(Object.assign({},a.style),{path:TT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=lf.circle(t)}h.name=gT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},mT,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=EC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},mT,d.text),shape:j({},mT,d.shape),panel:j({},mT,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}=TC(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&&wC(e,c,i)}else e.AABBBounds.width()>r&&wC(e,r,i)}else o>a.x&&h.x2>n.x2?(wC(e,n.x2-o,i),r&&CC(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}}BC.defaultAttributes=vT,G(BC,MC);const PC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},RC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{DC[t]=!0}));const VC=t=>-Math.log(-t),NC=t=>-Math.exp(-t),UC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,WC=t=>10===t?UC:t===Math.E?Math.exp:e=>Math.pow(t,e),GC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$C=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function XC(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function KC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function qC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function ZC(t,e,i,s){return 1===i&&(i=0),qC(t,i,s)*(e/(1-i))}function JC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function QC(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]{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 eE{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=JC(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 iE=Symbol("implicit");class sE extends eE{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=IC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iE}clone(){const t=(new sE).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!==iE)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 nE(t,e,r,n)}class aE extends sE{constructor(t){super(),this.type=IC.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=ZC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rE(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 aE(!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:oE}=ni;function lE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=oE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?oE(t,e):e instanceof ei?oE(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):At(Number(t),Number(e))}class hE extends eE{constructor(t=HC,e=HC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=HC,this._piecewise=KC,this._interpolate=lE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?QC:KC,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:HC),this.rescale(i)):this._clamp!==HC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 cE=Math.sqrt(50),dE=Math.sqrt(10),uE=Math.sqrt(2),pE=[1,2,5,10],gE=(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=_E(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?mE(0,-(e-1)/s,s):mE((e-1)/s,0,s)},fE=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 gE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gE(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=mE(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=mE(t,e,l);return n&&r.reverse(),r})),_E=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=pE[0];return i>=cE?s=pE[3]:i>=dE?s=pE[2]:i>=uE&&(s=pE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function yE(t,e,i){const s=(e-t)/Math.max(0,i);return _E(s)}function bE(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;e0;){if(s=yE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function SE(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 AE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),kE=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})),ME=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=vE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?AE(t,e,n):AE(t,e,tE(n)),h=AE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),TE=mt(((t,e,i,s,n)=>bE(s(t),s(e),i).map((t=>tE(n(t))))));class wE extends hE{constructor(){super(...arguments),this.type=IC.Linear}clone(){var t;const e=new wE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=vE(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(t=10){const e=this.calculateVisibleDomain(this._range);return bE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 EE(t){return e=>-t(-e)}function BE(t=Number.EPSILON){return e=>Math.max(e,t)}class PE extends hE{constructor(){super(GC(10),WC(10)),this.type=IC.Log,this._limit=BE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PE).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=GC(this._base),s=WC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=EE(i),this._pows=EE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=VC,this.untransformer=NC):(this._logs=i,this._pows=s,this._limit=BE(),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 HC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return kE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(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))))}}}G(PE,CE);class LE extends wE{constructor(){super(YC(1),$C(1)),this.type=IC.Symlog,this._const=1}clone(){return(new LE).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=YC(t),this.untransformer=$C(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return kE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(LE,CE);class RE{constructor(){this.type=IC.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)&&k(+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 RE).domain(this._domain).range(this._range).unknown(this._unknown)}}function OE(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 IE(t,e,i,s,n=!1){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,n,r;if(!FC(t.type))return PC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return PC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=OE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=OE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=OE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=OC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=OC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?FE.greedy:FE.parity;for(;l.length>=3&&CT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;wT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),IE(t,l,a,(e=>wT(e,t,i))),IE(n,l,o,(e=>wT(e,n,i)||!(!a||e===t)&&wT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return PC(m)},FE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&wT(i,t,e)||(i=t,0))))}},zE=(t,e,i,s)=>{const n=OC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},jE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,HE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?PC([s[s.length-1]]):PC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=zE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=NE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=zE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!jE(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?HE(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=EM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=AT(r,kT(s,r,e,n));return o=a,l=kT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 PC(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=UE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GE(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 PC(c)},GE=(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},YE=new Uint32Array(33),$E=new Uint32Array(33);$E[0]=0,YE[0]=~$E[0];for(let t=1;t<=32;++t)$E[t]=$E[t-1]<<1|1,YE[t]=~$E[t];function XE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&YE[31&o]&$E[1+(31&l)])return!0}else{if(i[h]&YE[31&o])return!0;if(i[c]&$E[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,YE[31&o]&$E[1+(31&l)]);else for(s(h,YE[31&o]),s(c,$E[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,$E[31&a]|YE[1+(31&o)]);else for(n(l,$E[31&a]),n(h,YE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 KE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function qE(t,e,i=!1){return i?KE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function ZE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=qE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=KE(t,r)),e.getRange(r)))}function JE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return JE(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 JE(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 JE(t,e,n,s,h,c)}return!1}const tB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],eB=["top","inside-top","inside"];function iB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const sB={mode:"same-time",duration:300,easing:"linear"};function nB(t){return 3===t||4===t}function rB(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 aB=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 oB(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)}}var lB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const dB=(t,e)=>Math.ceil(t)>Math.floor(e),uB=([t,e],[i,s])=>s>t&&e>i;function pB(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 gB=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||P(e.states)||(e.addState(nM.hover,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(fM(this,(t=>{P(t.states)||(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void fM(this,(t=>{P(t.states)||(t.removeState(nM.selectedReverse),t.removeState(nM.selected))}));P(e.states)||(e.addState(nM.selected,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.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)===Wo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Wo.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(Se(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[oB(g,f,c,d,a,o),oB(-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=lf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new zl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return RM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&dB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&dB(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(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(pB([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])&&!uB([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 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},h),{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(qE(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(qE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(qE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mB[t]=e};var _B=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{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,i,s)}}yB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const bB=()=>{vB("symbol",yB),vB("line-data",yB)};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);n{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}}}SB.tag="rect-label",SB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var AB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};kB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const MB=()=>{vB("line",kB),vB("area",kB)};var TB=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new wB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):nB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=nB(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=nB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=nB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?nB(t.quadrant)?"left":"right":nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 PB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 LB(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=TT(t,!!n),o=TT(r,!!n);const h=re.distancePP(s,l),c=re.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=PB(e,t,!1,!!n),o=PB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=TT(t,!!n),o=TT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}BB.defaultAttributes={pickable:!1};class RB extends Zy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.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 AT(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?`${gT.grid}-sub`:`${gT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=TT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=PB(t,o,!1,!!a)}const u=lf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RB.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=TT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=lf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:RB.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}}RB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ik(),Vk();class OB extends RB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RB.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=eM,endAngle:r=iM}=this.attribute;i=MT(t,s,re.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=j({},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})}}G(OB,YT);var IB=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"})}}G(DB,MC);const FB="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",zB={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:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},jB={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 HB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HB||(HB={}));var VB=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=HB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=lM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===HB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HB.endHandler):h+=l:this._activeTag===HB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=lM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===HB.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===HB.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=VB(c,["formatMethod"]),{formatMethod:g}=d,f=VB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},jB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},jB.horizontal),V),{pickable:!U&&(null===(b=V.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},jB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},jB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},jB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},jB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},jB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},jB.vertical),{pickable:!U}),"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 HM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var WB,GB,YB,$B;function XB(){Ik(),zM(),yw()}UB.defaultAttributes=zB,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"}(WB||(WB={})),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"}(GB||(GB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YB||(YB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($B||($B={}));class KB extends Zy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ET(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=lf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=lf.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=lf.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 qB(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 ZB(t,e,i,s){t&&(qB(t.startSymbol,e,i,s),t.lines.forEach((t=>qB(t,e,i,s))),qB(t.line,e,i,s),qB(t.endSymbol,e,i,s))}function JB(t,e,i,s){t&&(qB(t.getTextShape(),e,i,s),qB(t.getBgRect(),e,i,s))}function QB(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 tP(t,e,i,s){t&&(QB(t.startSymbol,e,i,s),t.lines.forEach((t=>QB(t,e,i,s))),QB(t.line,e,i,s),QB(t.endSymbol,e,i,s))}function eP(t,e,i,s){t&&(QB(t.getTextShape(),e,i,s),QB(t.getBgRect(),e,i,s))}function iP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qB(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)})),qB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;qB(t.getTextShape(),e,l,n),qB(t.getBgRect(),e,l,n)}))}function sP(t,e,i,s,n){ZB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function nP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function rP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function aP(t,e,i,s,n,r){var a;ZB(t,n,s,r),qB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JB(i,n,s,r):qB(i,n,s,r)}function oP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qB(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)})),qB(e,n+o+l,h,r),qB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qB(i.getTextShape(),n+o+l+h+c,d,r),qB(i.getBgRect(),n+o+l+c,d,r)):qB(i,n+o+l+c,d,r)}function lP(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?iP(t,e,s,r,a):"fadeIn"===i&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iP(t,e,s,n,a):"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tP(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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&&rP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function dP(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?aP(n,r,e,i,s,o):"callIn"===t&&oP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aP(n,r,e,i,s,a):"callIn"===t&&oP(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;tP(t,n,s,r),QB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eP(i,n,s,r):QB(i,n,s,r)}(n,r,e,t,i,s)}}const uP={type:"clipIn",duration:500,easing:"linear",delay:0},pP={type:"fadeIn",duration:500,easing:"linear",delay:0},gP={type:"callIn",duration:500,easing:"linear",delay:0},fP={type:"fadeOut",duration:500,easing:"linear",delay:0};class mP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new HM(Object.assign(Object.assign({},h),{state:{panel:j({},rM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},rM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},rM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},rM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class vP extends KB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=fP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;FM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(vP,mP);const _P=.001,yP={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:WB.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]}},bP={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"}}},xP={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:{autoRotate:!0,position:YB.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]}},SP={interactive:!0,label:{position:GB.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}},AP={interactive:!0,label:{autoRotate:!0,position:YB.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}},kP={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"}},MP={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"}},TP={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 wP(){CP._animate=lP}XB(),cT(),yw();class CP extends vP{markerAnimate(t){CP._animate&&this._animationConfig&&CP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(vM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return _M(Math.abs(e),Math.PI/2,_P)||_M(Math.abs(e),3*Math.PI/2,_P)?yM(i,e,t):vM(e)?bP.postiveXAxis[t]:bP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new uT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",CP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(CP.defaultAttributes.label)}}function EP(){BP._animate=hP}CP.defaultAttributes=yP,XB(),Uk(),yw();class BP extends KB{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},MP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=lf.polygon(Object.assign({points:e},i));n.states=j({},rM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",BP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},rM,null==i?void 0:i.area)),this._updateMarkLabels(BP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}BP.defaultAttributes=SP,G(BP,mP),XB(),dT(),yw();class PP extends vP{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case YB.arcInnerStart:l=n;case YB.arcOuterStart:l=n;break;case YB.arcInnerEnd:l=r;case YB.arcOuterEnd:l=r;break;case YB.center:case YB.arcInnerMiddle:case YB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new pT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",PP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(PP.defaultAttributes.label)}}PP.defaultAttributes=xP,XB(),wk(),yw();class LP extends KB{markerAnimate(t){LP._animate&&this._animationConfig&&LP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case YB.center:h=(s+n)/2,c=(r+a)/2;break;case YB.arcInnerStart:h=s,c=r;break;case YB.arcOuterStart:h=n,c=r;break;case YB.arcInnerEnd:h=s,c=a;break;case YB.arcOuterEnd:h=n,c=a;break;case YB.arcInnerMiddle:h=s,c=(r+a)/2;break;case YB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=lf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},rM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",LP.defaultAttributes.label)}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=j({},rM,null==o?void 0:o.area)),this._updateMarkLabels(LP.defaultAttributes.label)}isValidPoints(){return!0}}function RP(){OP._animate=dP}LP.defaultAttributes=AP,G(LP,mP),XB(),cT(),dT(),Zk(),Fk(),jk(),yw();class OP extends KB{markerAnimate(t){OP._animate&&this._animationConfig&&OP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gP,this.defaultExitAnimation=fP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return _M(Math.abs(s),Math.PI/2,_P)||_M(Math.abs(s),3*Math.PI/2,_P)?yM(t,s,n):vM(s)?TP.postiveXAxis[n]:TP.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,style:d,position:u=$B.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},rM,null==p?void 0:p.textBackground),text:j({},rM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},rM,null==p?void 0:p.itemContent));const v=vM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=lf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"text"===n?o=new HM(Object.assign(Object.assign({},i),{state:{panel:j({},rM,null==s?void 0:s.textBackground),text:j({},rM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=lf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"image"===n?(o=lf.image(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},rM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=_M(c,0,_P)||_M(d,0,_P),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=IM(e-u,t-d),o=IM(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(UP.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(UP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===UP.focus||"focus"===o){const s=a.hasState(VP.focus);a.toggleState(VP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover,VP.focus],t),this._setLegendItemState(e,VP.selected,t)})):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover,VP.focus],t),this._setLegendItemState(e,VP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(VP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VP.selected,VP.selectedHover],t),this._setLegendItemState(a,VP.unSelected,t)):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t))}else this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover],t),this._setLegendItemState(e,VP.unSelected,t))}))}this._dispatchLegendEvent(NP.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,VP.selected),this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover])):(this._removeLegendItemState(e,[VP.selected,VP.selectedHover]),this._setLegendItemState(e,VP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=zP,spaceRow:l=jP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=lf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=lf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,UP.item,t,w)):(w=lf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,UP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?VP.selected:VP.unSelected);const C=lf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=lf.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,UP.itemShape,t,w,S.state),s.addState(e?VP.selected:VP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=lf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,UP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=RM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,UP.itemLabel,t,w,A.state),D.addState(e?VP.selected:VP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=RM(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,UP.itemValue,t,w,k.state),r.addState(e?VP.selected:VP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 FP(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 FP(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 cM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new cM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=zP,spaceRow:o=jP}=n,l=this._itemsContainer,{space:h=HP,defaultCurrent:c=1}=r,d=$P(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=lf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=zP,spaceRow:a=jP}=s,o=this._itemsContainer,{space:l=HP,defaultCurrent:h=1}=n,c=$P(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 _=lf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=lf.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(VP.selected)?this._setLegendItemState(t,VP.selectedHover,e):this._setLegendItemState(t,VP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===UP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VP.unSelectedHover)||t.hasState(VP.selectedHover))&&(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VP.unSelectedHover)&&!t.hasState(VP.selectedHover)||(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===UP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NP.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!==UP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NP.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!==UP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},XP,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(VP.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 qP;function ZP(t){return y(t)?t:[t,t]}function JP(t){return t?"ew-resize":"ns-resize"}KP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:zP,spaceRow:jP,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:HP,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"}(qP||(qP={})),GP();class QP 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:j({},QP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:ZP(d)[0],endValue:ZP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=lf.group({x:0,y:0});f.name=qP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=lf.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)),m.name=qP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=lf.group({x:g?v:0,y:g?0:v});f.add(_);const y=lf.group({x:0,y:0});let b;if(y.name=qP.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=lf.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=qP.endText,f.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=lf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=qP.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,f]=ZP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(v.name=qP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=qP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(i.name=qP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=qP.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 f=lf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=qP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":JP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=lf.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=qP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return lf.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":JP(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),lf.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=lf.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=lf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===qP.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===qP.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===qP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===qP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}QP.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}}},YP(),GP();class tL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function eL(t="bottom"){let 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`}tL.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"}}},YP(),GP(),Vk();class iL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=lf.group({x:0,y:0});this._innerView.add(x);const S=new QP({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:eL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=lf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}iL.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)"}},Ik(),Qk(),$k();let sL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},aM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},aM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};sL.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 nL={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"}}};Ik(),Qk(),$k();let rL=class extends Zy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(nL,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=RM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=BM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 aL extends Ag{constructor(t){super(t)}}var oL,lL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oL||(oL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lL||(lL={}));class hL extends Zy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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"},hL.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"},hL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.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 aL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new aL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new aL(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(oL.OnPlay)},this.pause=()=>{this._dispatchEvent(oL.OnPause)},this.forward=()=>{this._dispatchEvent(oL.OnForward)},this.backward=()=>{this._dispatchEvent(oL.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()}}hL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hL.defaultAttributes={[lL.Start]:{},[lL.Pause]:{},[lL.Backward]:{},[lL.Forward]:{}};const cL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dL=[200,10];var uL,pL;!function(t){t.Default="default",t.Reverse="reverse"}(uL||(uL={})),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"}(pL||(pL={}));const gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),fL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),mL=t=>"top"===t||"bottom"===t;class vL 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:j({},vL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(mL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:dL[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:dL[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 QP(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=mL(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 hL(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=mL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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:mL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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 _L(){GP(),Ik(),Zk()}vL.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({},cL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cL),{key:"backward",position:"start"})}},_L();class yL extends vL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:uL.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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(pL.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(pL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.change),this.dispatchCustomEvent(pL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var bL,xL=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())}))};_L();class SL extends vL{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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change))},this.play=()=>xL(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(pL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.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(pL.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.brushActive="brushActive",t.brushClear="brushClear"}(bL||(bL={}));const AL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},kL=5;const ML={debounce:xt,throttle:St};Ik(),Uk();let TL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=AL.updateTrigger,endTrigger:i=AL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:ML[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=AL.trigger,resetTrigger:e=AL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(bL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(bL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=kL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(bL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(bL.brushActive,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._dispatchBrushEvent(bL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=kL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=AL.updateTrigger,endTrigger:e=AL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=lf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};TL.defaultAttributes=AL;const wL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},CL=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}},EL={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:sM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},BL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ik(),Gk(),Zk(),Qk(),$k();let PL=class t extends Zy{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=ri(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:mM(u)&&mM(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:mM(u)&&mM(u.value)},CL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:mM(u)&&mM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:mM(u)&&mM(u.value)},CL(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},aM),u.value),visible:mM(u)&&mM(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=mM(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 _=mM(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(!mM(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)+(mM(n.key)?r+n.key.spacing:0)+(mM(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&&(OM(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:mM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),OM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(mM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ed(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(mM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},CL(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},CL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},aM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(mM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},CL(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},CL(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=>BL.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)&&mM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=mM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(mM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(mM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&ru[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 wL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PL.defaultAttributes=EL;const LL=pt;function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function OL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function IL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function DL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function FL(t,e){const i=DL(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 zL(t,e){const i=jL(t),s=jL(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 jL(t,e={x:0,y:0}){return re.distancePP(t,e)}function HL(t){return k(t.x)&&k(t.y)}function VL(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 NL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const UL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function GL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&GL(t[i],e)}}var YL,$L,XL;function KL(t){var e,i;const{type:s}=t;return s===$L.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(YL||(YL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}($L||($L={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(XL||(XL={}));const qL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},ZL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function JL(t,e){var i;if(!t)return[];const s=rR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?sR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>iR(i)?tR(t,i,e):i)).filter(p)}))):i.map((i=>iR(i)?tR(t,i,e):i)).filter(p):[]}return[]}function QL(t,e){var i,s;return sR(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 tR(t,e,i){var s;const n=rR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=qL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=ZL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 eR=(t,e)=>{if(e&&iR(t)){const i=tR(e,t);if(i)return i}return t};function iR(t){return t&&"palette"===t.type&&!!t.key}function sR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function nR(t){return y(t)?{dataScheme:t}:t}function rR(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=KL(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 aR extends sE{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(!sR(this._range))return void super.range(this._range);const t=QL(this._range,this._domain);super.range(t)}}const oR={linear:wE,band:aE,point:class extends aE{constructor(t){super(!1),this.type=IC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sE,threshold:RE,colorOrdinal:aR};function lR(t){const e=oR[t];return e?new e:null}function hR(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 cR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function dR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function uR(t){return!!_(t)&&(!!t.endsWith("%")&&Xy(t.substring(0,t.length-1)))}function pR(t){return!!g(t)&&("percent"in t||"offset"in t)}function gR(t,e,i,s=0){var n,r;return S(t)?t:uR(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 fR(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]=gR(t[s],e.size,i)}))})),o}function mR(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}}function vR(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)||uR(t)||d(t)||pR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function _R(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const yR=(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},bR=[{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"]}];function xR(t,e){return t&&e.key in t?t[e.key]:e.default}function SR(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%"},kR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:bR,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"}}},token:AR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},MR={name:"dark",colorScheme:{default:{dataScheme:bR,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}}}}}},TR=(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]={}),TR(t[s],e.slice(1),i))};function wR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=nR(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)})}CR._charts={},CR._series={},CR._components={},CR._graphicComponents={},CR._marks={},CR._regions={},CR._animations={},CR._implements={},CR._chartPlugin={},CR._vChartPlugin={},CR._componentPlugin={},CR.transforms={fields:Yr,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}},CR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},CR._layout={},CR._grammarTransforms={},CR._stageEventPlugins={},CR.registerStageEventPlugin=(t,e)=>{CR._stageEventPlugins[t]=e},CR.getStageEventPlugin=t=>CR._stageEventPlugins[t],CR._interactionTriggers={},CR.registerInteractionTrigger=(t,e)=>{CR._interactionTriggers[t]=e},CR._composedEventMap={},CR.registerComposedEvent=(t,e)=>{CR._composedEventMap[t]=e},CR._tooltipProcessors={},CR.registerTooltipProcessor=(t,e)=>{CR._tooltipProcessors[t]=e},CR.createTooltipProcessor=(t,e)=>{const i=CR._tooltipProcessors[t];return i?new i(e):null};const PR=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},LR=PR(),RR={[kR.name]:kR},OR=kR.name,IR=new Map(Object.keys(RR).map((t=>[t,RR[t]]))),DR=new Map,FR=new Map(Object.keys(RR).map((t=>[t,t===OR]))),zR=(t,e)=>{if(!t)return;const i=NR(e);IR.set(t,i),FR.set(t,!0)},jR=(t=OR)=>(FR.has(t)&&!FR.get(t)&&zR(t,IR.get(t)),IR.get(t)),HR=t=>IR.delete(t)&&DR.delete(t)&&FR.delete(t),VR=t=>!!_(t)&&IR.has(t),NR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:OR;return ER({},jR(i),t)};class UR{static registerInstance(t){UR.instances.set(t.id,t)}static unregisterInstance(t){UR.instances.delete(t.id)}static getInstance(t){return UR.instances.get(t)}static instanceExist(t){return UR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return UR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}UR.instances=new Map;class WR{static registerTheme(t,e){zR(t,e)}static getTheme(t,e=!1){return jR(t)}static removeTheme(t){return HR(t)}static themeExist(t){return VR(t)}static getDefaultTheme(){return WR.themes.get(OR)}static setCurrentTheme(t){WR.themeExist(t)&&(WR._currentThemeName=t,UR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return WR.getTheme(WR._currentThemeName,t)}static getCurrentThemeName(){return WR._currentThemeName}}function GR(t){return _(t)?WR.themeExist(t)?WR.getTheme(t):{}:g(t)?t:{}}WR.themes=IR,WR._currentThemeName=OR;const YR=["animationThreshold","colorScheme","name","padding"];function $R(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];YR.includes(n)?s[n]=r:m(r)?iR(r)?s[n]=eR(r,e):SR(r)?s[n]=xR(i,r):s[n]=$R(r,e,i):s[n]=r})),s}function XR(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}function KR(t,e){if(!t)return t;if(m(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]=KR(t[s],e)}return i}return y(t)?t.map((t=>KR(t,e))):t}const qR=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:AR.fontFamily,fontSize:AR.fontSize}))(e,i,s).measure(t),ZR="__VCHART",JR=500,QR=500,tO=`${ZR}_MEASURE_CANVAS_ID`,eO=`${ZR}_DEFAULT_DATA_INDEX`,iO=`${ZR}_DEFAULT_DATA_KEY`,sO=`${ZR}_DEFAULT_DATA_SERIES_FIELD`,nO=`${ZR}_DEFAULT_SERIES_STYLE_NAME`,rO=`${ZR}_STACK_KEY`,aO=`${ZR}_STACK_START`,oO=`${ZR}_STACK_END`,lO=`${ZR}_STACK_START_PERCENT`,hO=`${ZR}_STACK_END_PERCENT`,cO=`${ZR}_STACK_START_OffsetSilhouette`,dO=`${ZR}_STACK_END_OffsetSilhouette`,uO=`${ZR}_STACK_TOTAL`,pO=`${ZR}_STACK_TOTAL_PERCENT`,gO=`${ZR}_STACK_TOTAL_TOP`,fO=`${ZR}_STACK_TOTAL_BOTTOM`,mO=`${ZR}_MOSAIC_VALUE_START_PERCENT`,vO=`${ZR}_MOSAIC_VALUE_END_PERCENT`,_O=`${ZR}_MOSAIC_CAT_START_PERCENT`,yO=`${ZR}_MOSAIC_CAT_END_PERCENT`,bO=`${ZR}_SEGMENT_START`,xO=`${ZR}_SEGMENT_END`,SO=`${ZR}_KEY`;function AO(t,e){for(let i=0;it.key===e))}function MO(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 TO(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:{}},PO(t,a,n[o],l,e,r))})),s?wO(n):n}function wO(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))):wO(t[e].nodes);return t}function CO(t,e){if("values"in t&&t.values.length){const i=IL(t.values,e),s=OL(t.values,hO);t.values.forEach((t=>{t[uO]=i,t[pO]=s}))}else for(const i in t.nodes)CO(t.nodes[i],e)}function EO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][oO]/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)BO(t.nodes[r],e,i,s,n)}function PO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[oO]=function(t){if(k(t))return t;const e=+t;return k(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)),PO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const LO=(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]=OO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function IO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>zO(t.style(e,i,s,n)):P(t.style)||(e.style=zO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>zO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=zO(t.state[e]))})),e.state=i}return e}function DO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e,s,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}function FO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),zO(i)}function zO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const jO=t=>"line"===t||"area"===t,HO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return jO(i)?e:null==e?void 0:e[0]},VO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let NO=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},n=CR.getComposedEvent(t);if(n){const e=new n(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(CR.getComposedEvent(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()}};var UO;!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"}(UO||(UO={}));const WO=["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 GO,YO,$O;t.ChartEvent=void 0,(GO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",GO.rendered="rendered",GO.renderFinished="renderFinished",GO.animationFinished="animationFinished",GO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",GO.afterInitData="afterInitData",GO.afterInitEvent="afterInitEvent",GO.afterInitMark="afterInitMark",GO.rawDataUpdate="rawDataUpdate",GO.viewDataFilterOver="viewDataFilterOver",GO.viewDataUpdate="viewDataUpdate",GO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",GO.markDeltaYUpdate="markDeltaYUpdate",GO.viewDataLabelUpdate="viewDataLabelUpdate",GO.scaleDomainUpdate="scaleDomainUpdate",GO.scaleUpdate="scaleUpdate",GO.dataZoomChange="dataZoomChange",GO.drill="drill",GO.layoutStart="layoutStart",GO.layoutEnd="layoutEnd",GO.layoutRectUpdate="layoutRectUpdate",GO.playerPlay="playerPlay",GO.playerPause="playerPause",GO.playerEnd="playerEnd",GO.playerChange="playerChange",GO.playerForward="playerForward",GO.playerBackward="playerBackward",GO.scrollBarChange="scrollBarChange",GO.brushStart="brushStart",GO.brushChange="brushChange",GO.brushEnd="brushEnd",GO.brushClear="brushClear",GO.brushActive="brushActive",GO.legendSelectedDataChange="legendSelectedDataChange",GO.legendFilter="legendFilter",GO.legendItemClick="legendItemClick",GO.legendItemHover="legendItemHover",GO.legendItemUnHover="legendItemUnHover",GO.tooltipShow="tooltipShow",GO.tooltipHide="tooltipHide",GO.tooltipRelease="tooltipRelease",GO.afterResize="afterResize",GO.afterRender="afterRender",GO.afterLayout="afterLayout",GO.afterMarkLayoutEnd="afterMarkLayoutEnd",GO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(YO||(YO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}($O||($O={}));const XO=[$O.mark,$O.model,$O.chart,$O.vchart];class KO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set($O.vchart,[]),this._levelNodes.set($O.chart,[]),this._levelNodes.set($O.model,[]),this._levelNodes.set($O.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 qO={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 ZO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>HO(t)))};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)||YO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||YO.chart);o.get(t)||o.set(t,new KO);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)||YO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||YO.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)||YO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||YO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?XO.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[YO.chart,YO.window,YO.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&&L(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 qO[a]&&(a=qO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?$O.model:$O.vchart:$O.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=YO.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!==$O.model&&s!==$O.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=$O.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 YO.chart:return this._viewBubbles;case YO.window:return this._windowBubbles;case YO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case YO.chart:return this._viewListeners;case YO.window:return this._windowListeners;case YO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return WO.includes(t)||Object.values(UO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteractionTrigger(e)}}function JO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function QO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const tI=new Map;let eI;function iI(){eI||(eI=new Ta,QO(eI,"geojson",ba),QO(eI,"topojson",Sa),JO(eI,"simplify",Wr))}function sI(t,e,i={type:"geojson",centroid:!0}){tI.has(t)&&zy(`map type of '${t}' already exists, will be overwritten.`),iI();const s=new wa(eI),n=j({},{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}),tI.set(t,s)}function nI(t){tI.has(t)?tI.delete(t):zy(`map type of '${t}' does not exists.`)}function rI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const aI=(t,e)=>0===t.length?[]:1===t.length?rI(t[0],null==e?void 0:e.deep):t.map((t=>rI(t,null==e?void 0:e.deep)));function oI(e,i,s){JO(i=i instanceof Ta?i:e.dataSet,"copyDataView",aI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function lI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return zy(`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 zy(`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([]),zy("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 hI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cI,dI,uI,pI;t.TransformLevel=void 0,(cI=t.TransformLevel||(t.TransformLevel={}))[cI.copyDataView=-10]="copyDataView",cI[cI.treemapFilter=-8]="treemapFilter",cI[cI.treemapFlatten=-7]="treemapFlatten",cI[cI.dotObjFlat=-7]="dotObjFlat",cI[cI.linkDotInfo=-7]="linkDotInfo",cI[cI.sankeyLayout=-7]="sankeyLayout",cI[cI.dataZoomFilter=-6]="dataZoomFilter",cI[cI.legendFilter=-5]="legendFilter",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"}(dI||(dI={})),function(t){t.data="data",t.mark="mark"}(uI||(uI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(pI||(pI={}));const gI=["line","area","trail"];function fI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(SO,i?t.slice().sort(i):t.slice()),{keys:[SO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const mI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function vI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{vI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function yI(t,e,i,s){const n=fI(t,(t=>i(t))),r=fI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 bI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new I_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Cp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Wy(o))&&!1!==c&&CR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=pI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>vI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>vI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{vI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Fy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===pI.before&&(this._layoutState=pI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=pI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Fy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=_I(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=yI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=yI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=fI(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=fI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===YO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:HO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===YO.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===YO.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===YO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===YO.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===YO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{vI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=_I(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return vu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{vI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function xI(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:jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function SI(t){t.crosshair=Y(t.crosshair||{}).map((e=>wR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function AI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Gy(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 kI(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 MI(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}}var TI,wI,CI,EI,BI,PI;t.LayoutZIndex=void 0,(TI=t.LayoutZIndex||(t.LayoutZIndex={}))[TI.SeriesGroup=0]="SeriesGroup",TI[TI.Axis_Grid=50]="Axis_Grid",TI[TI.CrossHair_Grid=100]="CrossHair_Grid",TI[TI.Region=450]="Region",TI[TI.Mark=300]="Mark",TI[TI.Node=400]="Node",TI[TI.Axis=100]="Axis",TI[TI.MarkLine=500]="MarkLine",TI[TI.MarkArea=100]="MarkArea",TI[TI.MarkPoint=500]="MarkPoint",TI[TI.DataZoom=500]="DataZoom",TI[TI.ScrollBar=500]="ScrollBar",TI[TI.Player=500]="Player",TI[TI.Legend=500]="Legend",TI[TI.CrossHair=500]="CrossHair",TI[TI.Indicator=500]="Indicator",TI[TI.Title=500]="Title",TI[TI.Label=500]="Label",TI[TI.Brush=500]="Brush",TI[TI.CustomMark=500]="CustomMark",TI[TI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(wI=t.LayoutLevel||(t.LayoutLevel={}))[wI.Indicator=10]="Indicator",wI[wI.Region=20]="Region",wI[wI.Axis=30]="Axis",wI[wI.DataZoom=40]="DataZoom",wI[wI.Player=40]="Player",wI[wI.ScrollBar=40]="ScrollBar",wI[wI.Legend=50]="Legend",wI[wI.Title=70]="Title",wI[wI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(CI=t.AttributeLevel||(t.AttributeLevel={}))[CI.Default=0]="Default",CI[CI.Theme=1]="Theme",CI[CI.Chart=2]="Chart",CI[CI.Base_Series=3]="Base_Series",CI[CI.Series=4]="Series",CI[CI.Mark=5]="Mark",CI[CI.User_Chart=6]="User_Chart",CI[CI.User_Series=7]="User_Series",CI[CI.User_Mark=8]="User_Mark",CI[CI.User_SeriesStyle=9]="User_SeriesStyle",CI[CI.Built_In=99]="Built_In";class LI{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({},LI.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]))))}}LI.defaultMarkInfo={};class RI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class OI{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=>wR({},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 II extends RI{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=OI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new LI,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new NO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${ZR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=CR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class DI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=fR(vR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:gR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:gR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:gR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:gR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:gR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:gR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=gR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=gR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=gR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(mR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class FI extends II{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,this._transformLayoutPadding=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 DI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 zI extends OI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class jI extends FI{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(e,i){var s;super(e,i),this.transformerConstructor=zI,this.modelType="region",this.specKey="region",this.type=jI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function HI(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 VI(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 NI(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 UI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),NI(d,!0,p,l),s&&VI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function WI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=$I(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),NI(d,!1,p,o),s&&VI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function YI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=$I(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=$I(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"left",s),r.length&&UI(r,e,i,!0,"left",s),a.length&&WI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"top",s),r.length&&GI(r,e,i,!0,"top",s),a.length&&YI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"right",s),r.length&&UI(r,e,i,!0,"right",s),a.length&&WI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"bottom",s),r.length&&GI(r,e,i,!0,"bottom",s),a.length&&YI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=$I(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=$I(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:jy)("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}}}XI.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(EI||(EI={})),t.STATE_VALUE_ENUM=void 0,(BI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",BI.STATE_HOVER="hover",BI.STATE_HOVER_REVERSE="hover_reverse",BI.STATE_DIMENSION_HOVER="dimension_hover",BI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",BI.STATE_SELECTED="selected",BI.STATE_SELECTED_REVERSE="selected_reverse",BI.STATE_SANKEY_EMPHASIS="selected",BI.STATE_SANKEY_EMPHASIS_REVERSE="blur",BI.STATE_HIGHLIGHT="highlight",BI.STATE_BLUR="blur",BI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(PI||(PI={}));const KI=["linear","radial","conical"],qI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const ZI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{ZI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class JI extends RI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class QI extends JI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,gI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!ZI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(ZR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(ZR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(FC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class tD extends RI{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=CR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class eD extends tD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const iD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,sD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=iD(l.delay,n,a,o),d=iD(l.duration,n,a,o),u=iD(l.oneByOne,n,a,o),p=iD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Ow(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Bw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Lw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Wo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Rw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mw,null!==(l=i.easing)&&void 0!==l?l:Tw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Wo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Iw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Ow(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},nD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},rD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class aD extends tD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new eD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Cp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new zl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new QI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&wR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zC(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=lR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):KI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):zC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=QL(JL(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({},qI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)KI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=QL(JL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return fI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return CR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[iO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=fI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{rD(t),s.push(...t.getGraphics())})),e.forEach((t=>{rD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);sD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=nD(e,n),r=nD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===dI.exit?dI.exit:i===dI.update?dI.update:dI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===EI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===EI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=EI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=EI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=EI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=dI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=dI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return mI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=mI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=VO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=CR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=CR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===pI.before||(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===EI.exit&&!e.isExiting)if(e.context.animationState===EI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Cp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var oD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(oD||(oD={}));class lD extends aD{constructor(){super(...arguments),this.type=lD.type,this._marks=[],this._diffState=EI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(zy("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?(zy("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))}getMarkInUserId(t){let e;return vI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===EI.update){const t=this.hasAnimation(),e=VO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=EI.update}render(){this._isCommited&&(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}lD.type="group";const hD={measureText:qR};class cD{static instance(){return cD.instance_||(cD.instance_=new cD),cD.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 dD{constructor(){this.id=$y(),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))?zy("不要重复添加相同的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 uD extends dD{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}}const pD={type:"fadeIn"};function gD(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 pD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const fD={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"}},mD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},vD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},_D=()=>{CR.registerAnimation("scaleInOut",(()=>mD))},yD=()=>{CR.registerAnimation("fadeInOut",(()=>vD))},bD=(t,e)=>({appear:gD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Uw,duration:fD.update.duration,easing:fD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),xD=()=>{CR.registerAnimation("line",bD)},SD=()=>{hw.registerBuiltInAnimate("growPointsIn",rC),hw.registerBuiltInAnimate("growPointsOut",aC),hw.registerBuiltInAnimate("growPointsXIn",lC),hw.registerBuiltInAnimate("growPointsXOut",hC),hw.registerBuiltInAnimate("growPointsYIn",dC),hw.registerBuiltInAnimate("growPointsYOut",uC),hw.registerBuiltInAnimate("clipIn",Yw),hw.registerBuiltInAnimate("clipOut",$w)},AD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class kD{constructor(t){this._markSet=new LI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 MD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TD extends kD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},MD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}TD.type="element-highlight",TD.defaultOptions=MD;const wD=()=>{CR.registerInteractionTrigger(TD.type,TD)},CD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ED extends kD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},CD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}ED.type="element-select",ED.defaultOptions=CD;const BD=()=>{CR.registerInteractionTrigger(ED.type,ED)};class PD extends dD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class LD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>CR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>CR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>CR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return CR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>CR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){CR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}static getFunction(t){return t?cD.instance().getFunction(t):null}static getFunctionList(){return cD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=CR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=CR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,tI.get(e);var e}static registerSVG(t,e,i){const s=CR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=CR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){UR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=$y(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=kI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?CR.getSeriesBuiltInTheme(e):CR.getComponentBuiltInTheme(e);i=i?wR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=$R({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},GL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(v);if(S?sx(Bh):"node"===v&&nA(Bh),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=WR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new bI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new ZO(this,this._compiler),this._event=new NO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),UR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=wR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=XR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;LD.getFunctionList()&&LD.getFunctionList().length&&(t=KR(t,LD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=CR.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=CR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=CR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 AI(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:JR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:QR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,QO(this._dataSet,"dataview",Aa),QO(this._dataSet,"array",s),JO(this._dataSet,"copyDataView",aI);for(const t in CR.transforms)JO(this._dataSet,t,CR.transforms[t]);for(const t in CR.dataParser)QO(this._dataSet,t,CR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?dI.none:dI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,UR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=lI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?wR({},t[n][e.index],i):i):t[n]=s?wR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?wR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?wR({},t[n],i):i)}))}(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=wR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=ER({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=GR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}else{const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(NM.poptip,VM,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=!!Uy(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.getTheme("background")||this._option.background}getCurrentTheme(){return GR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!WR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 xI(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(!Uy(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?_R(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 zy("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?_R(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return cD.instance().getFunction(t)}registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}getFunctionList(){return cD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=CR.getChartPlugins();t.length>0&&(this._chartPlugin=new uD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=CR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}LD.InstanceManager=UR,LD.ThemeManager=WR,LD.globalConfig={uniqueTooltip:!0},LD.Utils=hD,LD.vglobal=b_;CR.registerRegion("region",jI),CR.registerLayout("base",XI),Kk(),Ik(),CR.registerMark(lD.type,lD),CR.registerStageEventPlugin("gesture",Tb),wD(),BD(),zR(MR.name,MR);const RD="monotone",OD="linear",ID="bevel";function DD(t,e){return e("component",t)}function FD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=CR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const zD=(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},jD=(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)))},HD=(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},VD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=FD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ND=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const UD=(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 WD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=YD(VD(h,r,a,c),d,g),o.value=YD(VD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=VD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function GD(t,e,i,s,n,r,a){if(d(e)){WD(t,e(n,a),i,s,r,a)}else e&&WD(t,e,i,s,r,a)}const YD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class $D{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 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=>{y(t)?t.forEach((t=>{GD(a,t,e,i,s,n,r)})):d(t)?GD(a,t,e,i,s,n,r):t&&WD(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:VD(r.visible,t,n),value:YD(VD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:VD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=VD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&UD(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 XD={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}},KD=(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=AO([],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 qD(a,n,o)},qD=(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)=>{Xy(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=>{Xy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=XD[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},ZD=(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=>{Xy(t[e])||(t[e]=0)}))})),t},JD=`${ZR}_HIERARCHY_DEPTH`,QD=`${ZR}_HIERARCHY_ROOT`,tF=`${ZR}_HIERARCHY_ROOT_INDEX`;function eF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function iF(t,e,i){t&&(i.needDefaultSeriesField&&(t[sO]=i.defaultSeriesField),t[eO]=e,t[iO]=i.getKey(t,e,i))}function sF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function nF(t,e,i,s=0,n,r){void 0===r&&(r=e),iF(t,e,i),t[JD]=s,t[QD]=n||t[i.categoryField],t[tF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>nF(e,s,i,t[JD]+1,t[QD],r)))}const rF={label:{name:"label",type:"text"}},aF=`${ZR}_rect_x`,oF=`${ZR}_rect_x1`,lF=`${ZR}_rect_y`,hF=`${ZR}_rect_y1`,cF={data:!0},dF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},uF=[...Object.keys(fD),"normal"];function pF(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 _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=wR({},o[e],a);return _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function gF(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;const i=["custom","customParameters"];return t=I(t,null,i),yF(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}),i),t}(h,i)}function fF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function mF(t,e){var i;return null!==(i=null==t?void 0:t[eO])&&void 0!==i?i:e.context.graphicIndex}function vF(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 _F(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function yF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),yF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),yF(t[s],e,i))}function bF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class xF extends OI{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=KL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=CR.getSeriesMarkMap(o)?function(t,e,i){const s=CR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=wR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return wR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=wR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>wR({},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 SF extends II{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:`${ZR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=xF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=bF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(JO(this._rawData.dataSet,"invalidTravel",ZD),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=lI(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=oI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new eD(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=qD(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(){JO(this._dataSet,"dimensionStatistics",KD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&AO(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){JO(this._dataSet,"dimensionStatistics",KD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=AO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=pF({},gF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Wy(s)||Gy(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=wR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=wR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=AD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=AD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:sO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:nO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,nO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new $D(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},cF),dF),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=>dF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||hI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();bF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:sO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new aR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return JL(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:sO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,wR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:iO}_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!==oO&&t!==hO&&t!==aO&&t!==lO||(t=this.getStackValueField()),null!==(e=MO(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=>Xy(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:sO]}}function AF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();FC(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 kF(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}}}SF.mark=rF,SF.transformerConstructor=xF;class MF extends SF{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);FC(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:`${ZR}_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(oO),this.setFieldX2(aO)):(this.setFieldY(oO),this.setFieldY2(aO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(hO),this.setFieldX2(lO)):(this.setFieldY(hO),this.setFieldY2(lO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(dO),this.setFieldX2(cO)):(this.setFieldY(dO),this.setFieldY2(cO))}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(t.ChartEvent.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)&&(AF("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)}}function TF(t){return"bottom"===t||"top"===t}function wF(t){return"left"===t||"right"===t}function CF(t){return"z"===t}function EF(t,e){return dR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function BF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function PF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?TF(t)?"linear":"band":TF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const LF=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):["linear","log","symlog"].includes(e)?DD("axisLinear",i):{})&&void 0!==s?s:{},r=TF(t)?DD("axisX",i):wF(t)?DD("axisY",i):DD("axisZ",i);return wR({},DD("axis",i),n,r)};class RF{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:jy)("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:jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>jC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return TF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class OF extends RF{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:YO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const IF=(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))},DF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},FF=(t,e,i,s)=>{var n;const r=e.getScale(),a=jC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:zF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,jF=(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};class HF extends RF{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)=>!IF(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:YO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:YO.canvas}),callback:this.onMouseOut}),Wy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:YO.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Wy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var VF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(VF||(VF={}));const NF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class UF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(NF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:ID,curveType:OD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===RD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(NF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:vF(this._spec,NF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${ZR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[NF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,wR({},this._spec[NF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const WF=Object.assign(Object.assign({},rF),NF),GF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>GF(t,e[i])));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]))},YF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class $F extends aD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return YF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(zC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?GF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[iO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class XF extends $F{constructor(){super(...arguments),this.type=XF.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)===$L.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}XF.type="line";const KF=()=>{CR.registerMark(XF.type,XF),Kk(),jk(),MB(),bB(),SD(),CR.registerGraphicComponent("line",wg)};class qF extends aD{constructor(){super(...arguments),this.type=qF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}qF.type="symbol";const ZF=()=>{CR.registerMark(qF.type,qF),Kk(),Zk(),bB(),CR.registerGraphicComponent("symbol",kg)};class JF extends xF{_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 QF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function tz(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:!k(o.min),extendable_max:!k(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 ez(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 iz(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 sz(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 nz(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 rz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return PC(v)};class az{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class oz extends az{constructor(){super(oz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&QF(c)&&QF(d)))return;const u=tz(t,c),p=tz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!iz(u,p))return}else if(0===y&&0===b){if(!iz(p,u))return}else if(_||A)if(_&&!A){if(!ez(u,p))return}else if(A&&!_){if(!ez(p,u))return}else{if(f===b)return;if(f>b){if(!sz(u,p))return}else if(!sz(p,u))return}else{if(0===f&&0===y){if(!nz(u,p))return}else if(0===b&&0===g&&!nz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){JO(e.getOption().dataSet,"tickAlign",rz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}oz.pluginType="component",oz.type="AxisSyncPlugin";const lz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function hz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function cz(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 dz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const uz=t=>"band"===t||"ordinal"===t||"point"===t;function pz(t,e){return{id:t,label:t,value:e,rawValue:t}}function gz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class fz extends dD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const mz=`${ZR}_ARC_TRANSFORM_VALUE`,vz=`${ZR}_ARC_RATIO`,_z=`${ZR}_ARC_START_ANGLE`,yz=`${ZR}_ARC_END_ANGLE`,bz=`${ZR}_ARC_K`,xz=`${ZR}_ARC_MIDDLE_ANGLE`,Sz=`${ZR}_ARC_QUADRANT`,Az=`${ZR}_ARC_RADIAN`,kz=-Math.PI/2,Mz=3*Math.PI/2,Tz=.6,wz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Cz=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):"linear"===e?DD("axisLinear",i):{})&&void 0!==s?s:{},r=DD("angle"===t?"axisAngle":"axisRadius",i);return wR({},DD("axis",i),n,r)};function Ez(t,e,i,s){switch(t){case r.cartesianBandAxis:return LF(EF(i,["z"]),"band",e);case r.cartesianLinearAxis:return LF(EF(i,["z"]),"linear",e);case r.cartesianLogAxis:return LF(EF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LF(EF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LF(EF(i),void 0,e);case r.polarBandAxis:return Cz(i.orient,"band",e);case r.polarLinearAxis:return Cz(i.orient,"linear",e);case r.polarAxis:return Cz(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>TF(t.orient)));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>wF(t.orient)));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Bz(i,DD(t,e));default:return DD(t,e)}}const Bz=(t,e)=>{var i;const s=wR({},e,e[BF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Pz extends OI{getTheme(t,e){return Ez(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({},vR(e)),{[s]:0}))}}class Lz extends FI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Pz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:YO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Rz,Oz;Lz.transformerConstructor=Pz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Rz||(Rz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Oz||(Oz={}));class Iz extends aD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=CR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(UO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Iz.type="component";const Dz=()=>{CR.registerMark(Iz.type,Iz)},Fz=t=>t;class zz extends Lz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Rz.circleAxis:Rz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Oz.circleAxisGrid:Oz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=pF(null===(h=CR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new eD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return VL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?FC(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 VL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=NL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(VL(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=IO(s=t.domainLine)).startSymbol=IO(s.startSymbol),s.endSymbol=IO(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 zO(wR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:zO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 zO(wR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:zO(t.tick.style)),t.tick.state&&(i.tick.state=DO(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 zO(wR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:zO(t.subTick.style)),t.subTick.state&&(i.subTick.state=DO(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=lz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:wR({},d,zO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:zO(h.style)}),h.state&&(i.title.state.shape=DO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:zO(o.style)}),o.state&&(i.title.state.background=DO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=DO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=zO(t.background.style)),t.background.state&&(i.panel.state=DO(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 zO(wR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:zO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:zO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=FD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){QO(this._option.dataSet,"scale",Fz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===gT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}zz.specKey="axes";const jz=()=>{Dz(),CR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Hz=[oz];class Vz extends zz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),VL(this._regions,(t=>{const e=this.getOrient();TF(e)?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wF(e)?gz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):CF(e)&&gz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=wR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(wR({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=TF(this.getOrient()),n=t=>{var e;return(s?!TF(t.getOrient()):TF(t.getOrient()))&&FC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=EF(i,["z"]),CF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!dz(e))return null;const{axisType:t,componentName:s}=PF(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=>wF(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(!dz(t))return;const{axisType:s,componentName:n}=PF(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=CR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return TF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):CF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(Hz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){TF(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&&!TF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!CF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;wF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=TF(this.getOrient())?t.fieldX:CF(this.getOrient())?t.fieldZ:t.fieldY,FC(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:FC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(UO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(TF(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=TF(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)}))}collectScale(){const t=[];return VL(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]:TF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:CF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();VL(this._regions,(e=>{TF(t)?gz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):wF(t)?gz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):CF(t)&&gz(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=TF(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=TF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=wR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=TF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return pz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Vz.type=r.cartesianAxis,Vz.specKey="axes";const Nz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Uz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Gz=(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 Yz(t,e,i="count"){const s=Gz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $z=Math.sqrt(50),Xz=Math.sqrt(10),Kz=Math.sqrt(2);class qz{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=cz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=TF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Wz),e.sort(Wz),{domain:Uz(t,e),scope:Yz(t,e,i)}}(r,Iy(t),this._spec.breaks[0].scopeType);e=Iy(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}=cz(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>=$z?10:n>=Xz?5:n>=Kz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const Zz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Jz={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}}},Qz={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}}},tj={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}}};class ej extends Vz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!CF(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=TF(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=uR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Iy(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 JO(this._option.dataSet,t,DE),t}}ej.type=r.cartesianLinearAxis,ej.specKey="axes",ej.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(ej,qz);const ij=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(ej.type,ej)};class sj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new eD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=pz(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=>pz(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 nj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class rj extends Vz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,VE),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=ZC(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{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(rj.type,rj,!1)};class oj extends ej{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{TF(this.getOrient())?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):gz(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=wR({},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 wa(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 eD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>pz(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=>pz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}oj.type=r.cartesianTimeAxis,oj.specKey="axes",oj.builtInTheme={axis:tj,axisX:Jz,axisY:Qz};class lj extends ej{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}lj.type=r.cartesianLogAxis,lj.specKey="axes",lj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(lj,qz);class hj extends ej{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}hj.type=r.cartesianSymlogAxis,hj.specKey="axes",hj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(hj,qz);const cj=`${ZR}_hide_`;function dj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const uj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[cj]&&(dj(t,!0),t[cj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[cj]=!0,dj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},pj=()=>{CR.registerGrammarTransform("symbolOverlap",{transform:uj,runType:"afterEncode"})},gj={min:K,max:X,average:DL,sum:IL};function fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function mj(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 vj(t,e,i,s){return mj(t,e,i,"min",s)}function _j(t,e,i,s){return mj(t,e,i,"max",s)}function yj(t,e,i,s){return mj(t,e,i,"average",s)}function bj(t,e,i,s){return mj(t,e,i,"sum",s)}const xj=(t,e)=>{let i=d(t.size)?t.size():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=fj;if("min"===n?l=vj:"max"===n?l=_j:"average"===n?l=yj:"sum"===n&&(l=bj),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[]},Sj=()=>{CR.registerGrammarTransform("dataSampling",{transform:xj})};class Aj extends MF{constructor(){super(...arguments),this.type=$L.line,this.transformerConstructor=JF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(pF(null===(i=CR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),gF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Aj.type=$L.line,Aj.mark=WF,Aj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Aj.transformerConstructor=JF,G(Aj,UF);class kj{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)=>{hI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];zy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];zy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Mj{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)=>{Ky(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{AO(e,[{key:t,operations:FC(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&&AO(e,[{key:i.field,operations:FC(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?lR("colorOrdinal"):lR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Ky(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Ky(s.domain)?e.reRender=!0:U(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(!Ky(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=FC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=FC(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;FC(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(FC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=FC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));FC(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 Tj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class wj extends RI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:JR,height:QR},this._viewRect={width:JR,height:QR},this._viewBox={x1:0,y1:0,x2:JR,y2:QR},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=vR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new NO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new kj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Tj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=CR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=CR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=CR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof II)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 aD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof aD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&hI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=AI(this._spec,this._option,{width:JR,height:QR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=JL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Mj(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){kI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=JL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{kI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,kI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):kI(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()];kI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=fR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(UO.AFTER_MARK_RENDER_END,e)};this._event.on(UO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:HO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(jO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===VF.dimensionHover||s===VF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>jC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Cj=(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 Ej{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):TR(t,a,c.spec),TR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Cj(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=Cj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(CR.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(CR.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=CR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=CR.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=CR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):zD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=zD(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"];return 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}))}_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 Bj extends Ej{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&wR(i,MI(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 Pj extends Bj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),SI(t)}}const Lj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=TO(t,!0);for(const e in o)for(const i in o[e].nodes)BO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)EO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&CO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Oj{_beforeInit(){this._dataSet&&JO(this._dataSet,"stackSplit",Lj)}_initStack(){this._stack=new Rj(this),this._stack.init()}}const Ij={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:VF.dimensionHover};class Dj extends kD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Ij,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=HO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Dj.type="dimension-hover",Dj.defaultOptions=Ij;const Fj=()=>{CR.registerInteractionTrigger(Dj.type,Dj)},zj=()=>{CR.registerComposedEvent(VF.dimensionHover,HF),CR.registerComposedEvent(VF.dimensionClick,OF)},jj=t=>t.fieldX[0],Hj=t=>t.fieldY[0],Vj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Nj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Uj=(t,e)=>t?e?jj:Vj:e?Hj:Nj,Wj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=jF(t,(t=>TF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=jF(t,(t=>wF(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=>{jC(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=Gj(t,i,Uj(e,jC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Gj(t,i,Uj(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},Gj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Yj(t,s,i)},Yj=(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=FF(e,t,"cartesian",null!=i?i:TF(t.getOrient())?jj:Hj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},$j=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(jC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(FC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=hz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Kj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&Xj(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),Xj=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=FD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Kj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},qj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=Zj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},Zj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Jj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return $j(c,r,e),c.xField.cacheInfo?qj(c.xField):c.yField.cacheInfo?qj(c.yField):void 0},Qj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],tH=(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])&&Qj.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(eH(s).every((t=>{var e;return!UD("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},eH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},iH={dom:`${ZR}_TOOLTIP_HANDLER_DOM`,canvas:`${ZR}_TOOLTIP_HANDLER_CANVAS`},sH={key:"其他",value:"..."};var nH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(nH||(nH={}));class rH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=tH(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({},sH),t):sH;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)&&UD(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 aH extends rH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!jC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const oH=()=>{CR.registerTooltipProcessor("dimension",aH)};class lH extends rH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Uo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(HO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const hH=()=>{CR.registerTooltipProcessor("mark",lH)};class cH extends rH{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 dH=()=>{CR.registerTooltipProcessor("group",cH)};class uH extends wj{constructor(){super(...arguments),this.transformerConstructor=Pj,this.type="line",this.seriesType=$L.line}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}uH.type="line",uH.seriesType=$L.line,uH.transformerConstructor=Pj,G(uH,Oj);const pH=[...YF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class gH extends $F{constructor(){super(...arguments),this.type=gH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return pH}_getIgnoreAttributes(){return[]}}gH.type="area";const fH=()=>{CR.registerMark(gH.type,gH),Kk(),Ek(),MB(),bB(),SD(),CR.registerGraphicComponent("area",Jg)};class mH extends $D{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 vH=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}}),_H=()=>{CR.registerAnimation("area",bD),xD(),_D()};class yH extends JF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=wR({},f.style,g.style),l.state=wR({},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 bH extends MF{constructor(){super(...arguments),this.type=$L.area,this.transformerConstructor=yH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(bH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===RD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return hR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[oO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(pF(null===(e=CR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),gF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),gF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("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 mH(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(){super.onLayoutEnd(),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}}}bH.type=$L.area,bH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},bH.mark=vH,bH.transformerConstructor=yH,G(bH,UF);class xH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(t)}}class SH extends wj{constructor(){super(...arguments),this.transformerConstructor=xH,this.type="area",this.seriesType=$L.area}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}SH.type="area",SH.seriesType=$L.area,SH.transformerConstructor=xH,G(SH,Oj);function AH(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 kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:AH(t,e)}),MH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:AH(t,e)}),TH={type:"fadeIn"},wH={type:"growCenterIn"};function CH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return TH;case"scaleIn":return wH;default:return kH(t)}}class EH extends aD{constructor(){super(...arguments),this.type=EH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}EH.type="rect";const BH=()=>{Kk(),Gk(),vB("rect",SB),CR.registerMark(EH.type,EH),hw.registerBuiltInAnimate("growHeightIn",eC),hw.registerBuiltInAnimate("growHeightOut",iC),hw.registerBuiltInAnimate("growWidthIn",_C),hw.registerBuiltInAnimate("growWidthOut",yC),hw.registerBuiltInAnimate("growCenterIn",Jw),hw.registerBuiltInAnimate("growCenterOut",Qw),CR.registerGraphicComponent("rect",Pg)},PH=Object.assign(Object.assign({},rF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function LH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=yR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):hR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oF]):hR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=hR(this._dataToPosX(t),e,i),n=hR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):hR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hF]):hR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=hR(this._dataToPosY(t),e,i),n=hR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:vF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(JO(this._option.dataSet,"addVChartProperty",HD),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};JO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new eD(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=hF,s=lF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=oF,s=aF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=TO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)LH(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=hR(this[r](t),l,i),u=hR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[aO],n=t[oO],r=t[lO],h=t[hO];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]),{[aO]:i,[oO]:s}),a?{[lO]:o,[hO]: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(Pg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>hR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>hR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=kF(this);this._barMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),gF(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=yR(this._spec.barWidth,a)),l&&(c=Math.max(c,yR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,yR(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=yR(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=FC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}IH.type=$L.bar,IH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},IH.mark=PH,IH.transformerConstructor=OH;const DH=()=>{Sj(),BH(),CR.registerAnimation("bar",((t,e)=>({appear:CH(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t)}))),aj(),ij(),CR.registerSeries(IH.type,IH)};class FH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(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 zH extends wj{constructor(){super(...arguments),this.transformerConstructor=FH,this.type="bar",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}zH.type="bar",zH.seriesType=$L.bar,zH.transformerConstructor=FH,G(zH,Oj);const jH=[10,20],HH=IC.Linear,VH="circle",NH=IC.Ordinal,UH=["circle","square","triangle","diamond","star"],WH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},GH=Object.assign(Object.assign({},rF),{point:{name:"point",type:"symbol"}});class YH extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class $H extends MF{constructor(){super(...arguments),this.type=$L.scatter,this.transformerConstructor=YH,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=`${ZR}_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=`${ZR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:HH,defaultRange:jH},"size")}getShapeAttribute(t,e){return u(e)?VH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:NH,defaultRange:UH},"shape")}initMark(){this._symbolMark=this._createMark($H.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,$H.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=kF(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(pF(null===(i=CR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),gF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:VH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}$H.type=$L.scatter,$H.mark=GH,$H.builtInTheme={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"}}}}},$H.transformerConstructor=YH;const XH=()=>{ZF(),CR.registerAnimation("scatter",((t,e)=>Object.assign({appear:WH(0,e)},mD))),aj(),ij(),CR.registerSeries($H.type,$H)};class KH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class qH extends wj{constructor(){super(...arguments),this.transformerConstructor=KH,this.type="scatter",this.seriesType=$L.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}qH.type="scatter",qH.seriesType=$L.scatter,qH.transformerConstructor=KH,G(qH,Oj);class ZH extends SF{constructor(){super(...arguments),this.type=$L.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=`${ZR}_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 JH=`${ZR}_MAP_LOOK_UP_KEY`,QH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[eO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[JH]=e.nameMap[n]:t[JH]=n})),t.features);class tV extends $D{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 eV extends aD{constructor(){super(...arguments),this.type=eV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}eV.type="path";const iV=()=>{CR.registerMark(eV.type,eV),Kk(),Vk(),CR.registerGraphicComponent("path",Kg)},sV=Object.assign(Object.assign({},rF),{area:{name:"area",type:"path"}});class nV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 rV{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(){}}class aV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 oV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:rV}:Wy(e)||Gy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:aV}:null}const lV={debounce:xt,throttle:St};class hV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Wy(this._renderMode)||Gy(this._renderMode),oV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return oV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,lV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,lV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){oV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:$O.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:$O.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:$O.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||oV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=lV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=lV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:$O.chart})}));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:$O.chart,source:YO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp)}))}}function cV(t,e){return`${ZR}_${e}_${t}`}class dV extends Lz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:cV(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=wR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 nV(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===$L.map||e.type===$L.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),VL(this._regions,(t=>{var e;if(t.type===$L.map||t.type===$L.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==$L.map&&e.type!==$L.pictogram||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[JH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}dV.type=r.geoCoordinate,G(dV,hV);const uV=()=>{CR.registerComponent(dV.type,dV)};class pV extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class gV extends ZH{constructor(){super(...arguments),this.type=$L.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 !`),tI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),JO(this._dataSet,"copyDataView",aI),JO(this._dataSet,"map",QH),JO(this._dataSet,"lookup",jD);const s=tI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:JH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(gV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:vF(this._spec,gV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:sO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:sO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(pF(null===(t=CR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),gF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[eO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[eO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 eO}getActiveMarks(){return[this._pathMark]}}gV.type=$L.map,gV.mark=sV,gV.builtInTheme={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"}}}}},gV.transformerConstructor=pV;const fV=`${ZR}_waterfall_default_seriesField`,mV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[gO]=!0:delete t[gO]})),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=vV([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 f=g[0];let{start:m,end:v}=_V(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(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=vV(a,t,n,r,h,l,i,e),r.push(n)})),r};function vV(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}=_V(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===fV)&&(t[fV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function _V(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?zy("total.collectCountField error"):n=e[a].start;o<0?zy("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=ie(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 yV=(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)=>ie(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},bV={type:"fadeIn"},xV={type:"growCenterIn"};function SV(t,e){switch(e){case"fadeIn":return bV;case"scaleIn":return xV;default:return kH(t,!1)}}class AV extends aD{constructor(){super(...arguments),this.type=AV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}AV.type="rule";const kV=()=>{CR.registerMark(AV.type,AV),Kk(),jk(),CR.registerGraphicComponent("line",wg)},MV=Object.assign(Object.assign({},PH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),TV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:wV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function wV(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)=>wV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class CV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),JO(e,"dimensionTree",TV),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 EV extends OH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const BV={rect:DV,symbol:OV,arc:zV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=OV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:jV,line:HV,area:HV,rect3d:DV,arc3d:zV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function PV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=BV[t])&&void 0!==i?i:BV.point;return e.series.type===$L.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=RV(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:VV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function LV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==$L.sankey){const{formatFunc:t,args:n}=FD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function RV(t){return d(t)?e=>t(e.data):t}function OV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=RV(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:IV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function IV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function DV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=RV(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:FV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function FV(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 zV(t){var e;const{labelSpec:i}=t,s=null!==(e=RV(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 jV(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=LV(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),xg(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 HV(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}))):[{index:0,[sO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function VV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class NV extends IH{constructor(){super(...arguments),this.type=$L.waterfall,this.transformerConstructor=EV,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 CV(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=fV)}getSeriesKeys(){return this._seriesField===fV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),JO(this._dataSet,"waterfallFillTotal",yV),JO(this._dataSet,"waterfall",mV),(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=oI(this.getViewData(),this._dataSet,{name:`${ZR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new eD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:aO,endAs:oO,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=kF(this);this._barMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),gF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("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(){super.initMark();const t=this._createMark(NV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return jV(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?hR(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):hR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}NV.type=$L.waterfall,NV.mark=MV,NV.builtInTheme={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}}}},NV.transformerConstructor=EV;const UV=()=>{kV(),BH(),CR.registerAnimation("waterfall",((t,e)=>({appear:SV(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t,!1)}))),yD(),aj(),ij(),CR.registerSeries(NV.type,NV)},WV=`${ZR}_BOX_PLOT_OUTLIER_VALUE`;var GV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(GV||(GV={}));const YV=(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={[WV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class $V extends $D{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return this.series.getOutliersField();if(t===GV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case GV.MIN:return this.series.getMinField();case GV.MAX:return this.series.getMaxField();case GV.MEDIAN:return this.series.getMedianField();case GV.Q1:return this.series.getQ1Field();case GV.Q3:return this.series.getQ3Field();case GV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return e[WV];if(t===GV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case GV.MIN:return e[this.series.getMinField()];case GV.MAX:return e[this.series.getMaxField()];case GV.MEDIAN:return e[this.series.getMedianField()];case GV.Q1:return e[this.series.getQ1Field()];case GV.Q3:return e[this.series.getQ3Field()];case GV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[WV])}getDefaultContentList(t){return[{key:this.getContentKey(GV.OUTLIER),value:this.getContentValue(GV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(GV.MAX),value:this.getContentValue(GV.MAX)},{key:this.getContentKey(GV.Q3),value:this.getContentValue(GV.Q3)},{key:this.getContentKey(GV.MEDIAN),value:this.getContentValue(GV.MEDIAN)},{key:this.getContentKey(GV.Q1),value:this.getContentValue(GV.Q1)},{key:this.getContentKey(GV.MIN),value:this.getContentValue(GV.MIN)},{key:this.getContentKey(GV.SERIES_FIELD),value:this.getContentValue(GV.SERIES_FIELD)}]}}class XV extends aD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=CR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const KV=()=>{CR.registerGraphicComponent("glyph",Rg),Kk(),Rk()},qV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],ZV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class JV extends XV{constructor(){super(...arguments),this.type=JV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=ZV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}JV.type="boxPlot";const QV=Object.assign(Object.assign({},rF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},eN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},iN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=iN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=iN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=iN(t,"box").attribute.width,i=iN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=iN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=iN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=iN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=iN(t,"box").attribute.height,i=iN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},nN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=iN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=iN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=iN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=iN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=iN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=iN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=iN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=iN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=iN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class rN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oN extends rN{computeAttribute(){return tN(nN)(this.target,this.params,this.params.options)}}class lN extends aN{computeAttribute(){return eN(nN)(this.target,this.params,this.params.options)}}class hN extends MF{constructor(){super(...arguments),this.type=$L.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(){this._boxPlotMark=this._createMark(hN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(hN.mark.outlier,{key:eO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>hR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>hR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>hR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>hR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>hR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;JO(this._dataSet,"foldOutlierData",YV),JO(this._dataSet,"addVChartProperty",HD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${ZR}_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:eF.bind(this),call:iF}},!1),this._outlierDataView=new eD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=kF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=CR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(gF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(pF(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(pF(null===(a=CR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new $V(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]}}hN.type=$L.boxPlot,hN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},hN.mark=QV;const cN=()=>{KV(),jk(),Gk(),CR.registerGraphicComponent("line",(t=>wg(t))),CR.registerGraphicComponent("rect",(t=>Pg(t))),CR.registerMark(JV.type,JV),ZF(),_D(),aj(),ij(),hw.registerBuiltInAnimate("boxplotScaleIn",rN),hw.registerBuiltInAnimate("boxplotScaleOut",aN),hw.registerBuiltInAnimate("barBoxplotScaleIn",oN),hw.registerBuiltInAnimate("barBoxplotScaleOut",lN),CR.registerSeries(hN.type,hN)};class dN extends aD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Yg(t):xg(t)}}dN.type="text";const uN=()=>{CR.registerMark(dN.type,dN),Kk(),Qk(),$k(),CR.registerGraphicComponent("text",xg),CR.registerGraphicComponent("richtext",Yg)};class pN extends $D{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 gN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fN={type:"fadeIn"},mN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vN(t,e){return"fadeIn"===e?fN:gN(t)}const _N=Object.assign(Object.assign({},PH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class yN extends OH{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 bN extends IH{constructor(){super(...arguments),this.type=$L.rangeColumn,this._barMarkType="rect",this._barName=$L.bar,this.transformerConstructor=yN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,bN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(bN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(bN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=kF(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(pF(null===(i=CR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),gF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(pF(null===(n=CR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),gF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pN(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)}}bN.type=$L.rangeColumn,bN.mark=_N,bN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},bN.transformerConstructor=yN;const xN=()=>{BH(),uN(),CR.registerAnimation("rangeColumn",((t,e)=>({appear:vN(t,e),enter:gN(t),exit:mN(t),disappear:mN(t)}))),yD(),aj(),ij(),CR.registerSeries(bN.type,bN)};var SN,AN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(SN||(SN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(AN||(AN={}));class kN extends $D{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 MN=Object.assign({},vH);class TN extends bH{constructor(){super(...arguments),this.type=$L.rangeArea}initMark(){this._areaMark=this._createMark(TN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new kN(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))}}TN.type=$L.rangeArea,TN.mark=MN;class wN extends SF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Tz,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:[]};FC(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:[]};FC(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(t.ChartEvent.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)&&AF(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 CN(t){return Xy(t)?Number.parseFloat(t):0}const EN=(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&&BN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[mz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[mz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},BN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===CN(t[e])))||!i&&0===t.reduce(((t,i)=>t+CN(i[e])),0)));function PN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:PN(t,!0,dI.appear)}),RN={type:"fadeIn"},ON=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:PN(t,!0,dI.enter)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:PN(t,!0,dI.exit)}),DN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:PN(t,!0,dI.exit)});function FN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return RN;case"growRadius":return LN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class zN extends aD{constructor(t,e){super(t,e),this.type=jN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[xz])[t]+s,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 jN extends zN{constructor(){super(...arguments),this.type=jN.type}}jN.type="arc";const HN=()=>{Kk(),wk(),vB("arc",CB),hw.registerBuiltInAnimate("growRadiusIn",fC),hw.registerBuiltInAnimate("growRadiusOut",mC),hw.registerBuiltInAnimate("growAngleIn",qw),hw.registerBuiltInAnimate("growAngleOut",Zw),CR.registerGraphicComponent("arc",ef),CR.registerMark(jN.type,jN)},VN=Object.assign(Object.assign({},rF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class NN extends xF{_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=wR({},this._theme,i,t);const n=(t,e)=>wR({},"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 UN=`${ZR}_LABEL_VISIBLE`;class WN extends wN{constructor(){super(...arguments),this.transformerConstructor=NN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:gR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:gR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kz,this._endAngle=Mz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[xz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;JO(this._dataSet,"pie",EN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:_z,asEndAngle:yz,asRatio:vz,asMiddleAngle:xz,asRadian:Az,asQuadrant:Sz,asK:bz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new eD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},WN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return WL(_z)(t)}endAngleScale(t){return WL(yz)(t)}_computeLayoutRadius(){return wz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:cR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:cR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:WL(UN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[xz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===dI.appear)return this._startAngle;if(i===dI.disappear)return this._endAngle;const r=[dI.disappear,dI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[eO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=pF(null===(i=CR.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]}}WN.transformerConstructor=NN,WN.mark=VN,WN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class GN extends WN{constructor(){super(...arguments),this.type=$L.pie}}GN.type=$L.pie;const YN=()=>{HN(),CR.registerAnimation("pie",((t,e)=>({appear:FN(t,e),enter:ON(t),exit:IN(t),disappear:DN(t)}))),CR.registerAnimation("emptyCircle",((t,e)=>({appear:FN(t,e)}))),CR.registerSeries(GN.type,GN)};function $N(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const XN=t=>({type:$N(t.growField),options:{overall:!0}}),KN={type:"fadeIn"},qN=t=>({type:$N(t.growField)}),ZN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},JN=ZN;function QN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KN;case"growAngle":return XN(Object.assign(Object.assign({},t),{growField:"angle"}));default:return XN(Object.assign(Object.assign({},t),{growField:"radius"}))}}class tU extends wN{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(oO),this.setInnerRadiusField(aO)}setValueFieldToPercent(){this.setRadiusField(hO),this.setInnerRadiusField(lO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const eU=Object.assign(Object.assign({},rF),{rose:{name:"rose",type:"arc"}});class iU extends xF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class sU extends zz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=CR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=kz,this._endAngle=Mz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):gz(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:gR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:gR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:hz(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(){VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):gz(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 FC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:FC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>pz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 wz((()=>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=Tz,e=0;const i=this.getChart().getSpec();return VL(this.getRegions(),(s=>{const n=s;if(r=n.type,[$L.rose,$L.radar,$L.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(wR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(wR({},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)}}sU.type=r.polarAxis,sU.specKey="axes";const nU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},rU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class aU extends sU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}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 JO(this._option.dataSet,t,DE),t}}aU.type=r.polarLinearAxis,aU.specKey="axes",aU.builtInTheme={axis:tj,axisLinear:Zz,axisAngle:rU,axisRadius:nU},G(aU,qz);const oU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(aU.type,aU)};class lU extends sU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,WE),t}transformScaleDomain(){}}lU.type=r.polarBandAxis,lU.specKey="axes",lU.builtInTheme={axis:tj,axisBand:nj,axisAngle:rU,axisRadius:nU},G(lU,sj);const hU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(lU.type,lU)};class cU extends tU{constructor(){super(...arguments),this.type=$L.rose,this.transformerConstructor=iU,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(){this._roseMark=this._createMark(cU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,cU.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=>hR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=hR(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(pF(null===(i=CR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),gF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}cU.type=$L.rose,cU.mark=eU,cU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},cU.transformerConstructor=iU;const dU=()=>{CR.registerSeries(cU.type,cU),HN(),CR.registerAnimation("rose",((t,e)=>({appear:QN(t,e),enter:qN(t),exit:ZN(t),disappear:JN(t)}))),hU(),oU()};class uU extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,LL(this._fromAngle,this._toAngle)&&LL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class pU extends Uw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!HL(t)&&!HL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const gU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function fU(t,e,i){return"fadeIn"===e?gU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function mU(t,e,i){return"fadeIn"===e?gU(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 vU=(t,e)=>({custom:Vw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),_U=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}});class yU extends tU{constructor(){super(...arguments),this.type=$L.radar,this.transformerConstructor=JF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(yU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:OD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):kz},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(pF(null===(s=CR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),gF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=CR.getAnimationInKey(e);t.setAnimationConfig(pF(null==i?void 0:i(n,r),gF(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}}}yU.type=$L.radar,yU.mark=_U,yU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=JF,G(yU,UF);const bU=()=>{CR.registerSeries(yU.type,yU),fH(),KF(),ZF(),CR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:fU(t,e,"in"),exit:fU(t,e,"out"),disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{channel:["points","center"],custom:pU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),CR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:mU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:mU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:uU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing}]}))),CR.registerAnimation("radarGroup",((t,e)=>({appear:vU(t,"in"),disappear:vU(t,"out")}))),wk(),hU(),oU()};class xU extends $D{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=>fi.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 SU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(ZR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[eO]:r,[iO]:`${s}_${e}`})),r++}))})),n},AU={fill:"#bbb",fillOpacity:.2},kU=Object.assign(Object.assign({},rF),{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 MU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),JO(this._option.dataSet,"objFlat",SU),JO(this._option.dataSet,"copyDataView",aI),QO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(wR(AU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(MU.mark.group),this._containerMark=this._createMark(MU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(MU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(MU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(MU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(MU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(MU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(MU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:sO}}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 aR).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:sO}}initTooltip(){this._tooltipHelper=new xU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}MU.type=$L.dot,MU.mark=kU,MU.builtInTheme={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"}}}}};class TU extends $D{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=>fi.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 wU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CU=(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 EU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),JO(this._option.dataSet,"linkDotInfo",CU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(EU.mark.group),this._containerMark=this._createMark(EU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(EU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(EU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:sO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new TU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}EU.type=$L.link,EU.mark=wU,EU.builtInTheme={link:{arrow:{style:{size:10}}}};const BU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"}});class PU extends wN{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()?aO:bO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?oO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):kz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):Mz,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=hR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=hR(this.angleAxisHelper.dataToPosition([t[oO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?hR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(PU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return ef(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 IU=()=>{CR.registerAnimation("circularProgress",((t,e)=>({appear:OU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class DU extends xF{constructor(){super(...arguments),this._supportStack=!0}}class FU extends PU{constructor(){super(...arguments),this.type=$L.circularProgress,this.transformerConstructor=DU,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(k(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(k(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(){return this._progressMark=this._createMark(FU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:vF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(FU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?aO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?oO: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",t.AttributeLevel.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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}FU.type=$L.circularProgress,FU.mark=LU,FU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},FU.transformerConstructor=DU;const zU=()=>{CR.registerSeries(FU.type,FU),HN(),IU(),yD(),hU(),oU()};function jU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:jU(t)}),VU={type:"fadeIn"};function NU(t,e="grow"){return!1===e?{}:"fadeIn"===e?VU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:jU(t)}))(t)}class UU extends $D{enableByType(t){return"dimension"!==t}}const WU=Object.assign(Object.assign({},rF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class GU extends MF{constructor(){super(...arguments),this.type=$L.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;return this._progressMark=this._createMark(GU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return hR(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+n},y1:t=>{var e,i;return hR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return hR(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 e,s;return hR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return hR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(pF(null===(i=CR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new UU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GU.type=$L.linearProgress,GU.mark=WU,GU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YU=()=>{BH(),CR.registerAnimation("linearProgress",((t,e)=>({appear:NU(t,e),enter:NU(t),disappear:HU(t)}))),yD(),CR.registerSeries(GU.type,GU)},$U=[0],XU=[20,40],KU=[200,500],qU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],JU=`${ZR}_WORD_CLOUD_TEXT`,QU=Object.assign(Object.assign({},rF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),tW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class eW extends SF{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=XU}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:KU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:$U,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)?JU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:$U,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZU.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 e;this._wordMark=this._createMark(eW.mark.word,{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(eW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(pF(CR.getAnimationInKey("wordCloud")(n,s),gF("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 aR).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:sO])}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 wE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new wE).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[eO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:iO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:df}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:jg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}eW.mark=QU,eW.builtInTheme={wordCloud:tW};function iW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=sW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},nW=(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=nW(t.children,e,t,n))})),s},rW=(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=rW(t.children,e,t,n)),n=e(t,s,i,n)})),n},aW=(t,e=[],i)=>{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):aW(t.children,e,i)))})),e};function oW(t,e){let i,s;if(cW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function cW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function gW(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 fW(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 mW(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 vW(t){return{_:t,next:null,prev:null}}function _W(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];gW(n,s,r);let a,o,l,h,c,d,u,p=vW(s),g=vW(n),f=vW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=sW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:SW.defaultOpionts.nodeSort;nW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)nW([o],yW(h)),rW([o],bW(this._getPadding,.5,a)),nW([o],xW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);nW([o],yW(SW.defaultOpionts.setRadius)),rW([o],bW(Lt,1,a)),c&&rW([o],bW(this._getPadding,o.radius/t,a)),nW([o],xW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}SW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const AW=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=AW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function kW(t){return t.depth}function MW(t,e){return e-1-t.endDepth}const TW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),wW=(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},CW={left:kW,right:MW,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:kW,end:MW},EW=yt(0,1);class BW{constructor(t){this._ascendingSourceBreadth=(t,e)=>TW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>TW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},BW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):CW[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)};"vertical"===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<=0)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))),"vertical"===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=[];AW(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:Mt(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+=Mt(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=[wW(s[t.source]),wW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*EW(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(TW),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(TW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];PW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),LW);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({},RW.defaultOpionts,t):Object.assign({},RW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=sW(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=he({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)}}}function OW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:PW,slice:OW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?OW:PW)(t,e,i,s,n)}};class FW{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({},FW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?IW(this.options.aspectRatio):null!==(e=DW[this.options.splitType])&&void 0!==e?e:DW.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=sW(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)}))}}function zW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=zW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=jW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function YW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*$W({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},KW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VW,s=e.lossFunction||HW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:XW(l),arcs:l})}))},qW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:ZW,triangle:ZW,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 ZW(){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 JW(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 QW=t=>qW[t]?qW[t]():qW.circle(),tG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function eG(t){return d(t)?t:function(){return t}}class iG{constructor(t){var e,i;switch(this.options=j({},iG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=QW(this.options.shape),this.getText=null!==(e=eG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=eG(this.options.fontWeight),this.getTextFontSize=eG(this.options.fontSize),this.getTextFontStyle=eG(this.options.fontStyle),this.getTextFontFamily=eG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>tG(10,50);break;case"random-light":this.getTextColor=()=>tG(50,90);break;default:this.getTextColor=eG(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 ae(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():Tt(e);return ae(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 nG extends iG{constructor(t){var e;super(j({},nG.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<=nG.defaultOptions.minFontSize&&(this.options.minFontSize=nG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=sG[this.options.spiral])&&void 0!==e?e:sG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=eG(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}=JW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}lG(p,this._size)&&(p=hG(p,this._size))}else if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||aG(p,i))&&(!i||!rG(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 rG(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 aG(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,lG=(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 hG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},dG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},uG=(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()},pG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=JW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=QW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)uG(n,dG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)uG(n,dG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=dG({x:l,y:h},o,-Math.PI/2,5),e=dG({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]);uG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal"),vo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},_o=Symbol.for("RenderService");const yo=new class{get renderService(){return this._renderService||(this._renderService=vo.get(_o)),this._renderService}};let bo=0;class xo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=yo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++bo,t),this.tryRunAnimationFrameNextFrame(),bo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class So{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ao=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ko=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mo=function(t,e){return function(i,s){e(i,s,t)}},To=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 wo=class extends So{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new xo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return To(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Co,Eo,Bo,Po;wo=Ao([Ya(),Mo(0,Wa(lo)),Mo(0,$a(fo)),ko("design:paramtypes",[Object])],wo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Eo||(Eo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Bo||(Bo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Po||(Po={}));const Lo=Ht-1e-8;class Ro{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Lo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Io=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Do={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},Fo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let zo,jo,Ho,Vo,No,Uo;var Wo,Go,Yo,$o,Xo,Ko;function qo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Zo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Qo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=al(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ll(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new hl(i,n),new hl(n,s)]}class hl extends tl{constructor(t,e){super(),this.type=Xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p1.x):t===$o.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class cl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new hl(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===$o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===$o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class dl extends cl{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 ul(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function pl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?$o.ROW:$o.COLUMN;return"monotoneY"===t?new dl(t,s):new cl(t,s)}class gl{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 fl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new gl(n,s),t),n}function ml(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 vl{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&&ml(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:ml(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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("basis",i,t);return function(t,e){ul(t,e,2)}(new vl(n,s),t),n}function yl(t){return t<0?-1:1}function bl(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(yl(r)+yl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function xl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Sl(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 Al{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:Sl(this,this._t0,xl(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,Sl(this,xl(this,e=bl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Sl(this,this._t0,e=bl(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 kl extends Al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneX",i,t);return function(t,e){ul(t,e,2)}(new Al(n,s),t),n}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneY",i,t);return function(t,e){ul(t,e,2)}(new kl(n,s),t),n}let wl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Cl extends wl{lineEnd(){this.context.closePath()}}function El(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new wl(r,e,n),t),r}function Bl(t,e){return ul(t,e,1)}class Pl extends gl{lineEnd(){this.context.closePath()}}function Ll(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new Pl(n,s),t),n}function Rl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ol(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return fl(i,n);const o=pl(t,r,i);return ul(new e(o,s,a),i,2),o}}const Il=Ol("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Rl(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 Dl=Ol("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Rl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Fl extends tl{constructor(t,e,i){super(),this.type=Xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return rl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,el([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p2.x):t===$o.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=rl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Fl(i,a,r),new Fl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class zl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new hl(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Fl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function jl(t,e,i){var s,n;switch(e){case"linear":default:return fl(t,i);case"basis":return _l(t,i);case"monotoneX":return Ml(t,i);case"monotoneY":return Tl(t,i);case"step":return El(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new Cl(r,e,n),t),r}(t,.5,i);case"stepBefore":return El(t,0,i);case"stepAfter":return El(t,1,i);case"catmullRom":return Il(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Ll(t,i)}}class Hl extends Oo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ro(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Fo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Fo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Fo.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([Fo.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([Fo.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([Fo.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([Fo.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([Fo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Fo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new zl(this);Qo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Fo.M]=t=>`M${t[1]} ${t[2]}`,t[Fo.L]=t=>`L${t[1]} ${t[2]}`,t[Fo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Fo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Fo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Fo.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;tUo){let t,e=Ho;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Qo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===$o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===$o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),nh=Object.assign(Object.assign({},ql),{points:[],cornerRadius:0,closePath:!0}),rh=Object.assign(Object.assign({},ql),{width:100,height:100,spikes:5,thickness:.5}),ah=Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const oh=Object.assign(Object.assign({},ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),lh=Object.assign(Object.assign(Object.assign({},ql),$l),{strokeBoundsBuffer:0,keepDirIn3d:!0}),hh=Object.assign(Object.assign(Object.assign({},ql),$l),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ch=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},ql),{fill:!0,cornerRadius:0,cornerType:"round"}),dh=Object.assign(Object.assign({},ch),{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}),uh=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&&_(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 ph{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ph.IsGradientStr(t))try{const e=uh(t)[0];if(e){if("linear"===e.type)return ph.ParseLinear(e);if("radial"===e.type)return ph.ParseRadial(e);if("conic"===e.type)return ph.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:ph.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:ph.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const mh={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"}},vh=!0,_h=!1,yh=/\w|\(|\)|-/,bh=/[.?!,;:/,。?!、;:]/,xh=/\S/,Sh=(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})};function Ah(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=yo.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=kh(t,a)),a}function kh(t,e,i=!1){let s=e;for(;yh.test(t[s-1])&&yh.test(t[s])||bh.test(t[s]);)if(s--,s<=0)return i?Mh(t,e):e;return s}function Mh(t,e){let i=e;for(;yh.test(t[i+1])&&yh.test(t[i])||bh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Th(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=yo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}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};let Ch=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=lh.fontSize}){let i=0,s=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=kh(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,a=!1){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=kh(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}};Ch=wh([Ya()],Ch);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};const Bh=Symbol.for("TextMeasureContribution");let Ph=class extends Ch{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ph=Eh([Ya()],Ph);const Lh=Symbol.for("CanvasFactory"),Rh=Symbol.for("Context2dFactory");function Oh(t){return vo.getNamed(Lh,yo.global.env)(t)}const Ih=1e-4,Dh=Math.sqrt(3),Fh=1/3;function zh(t){return t>-Zh&&tZh||t<-Zh}const Hh=[0,0],Vh=[0,0],Nh=[0,0];function Uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Wh(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 Yh(t){return(t%=Vt)<0&&(t+=Vt),t}function $h(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function qh(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(zh(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 Qh=[-1,-1,-1],tc=[-1,-1];function ec(){const t=tc[0];tc[0]=tc[1],tc[1]=t}function ic(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(zh(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,Fh):Math.pow(i,Fh),s=s<0?-Math.pow(-s,Fh):Math.pow(s,Fh);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+Dh*Math.sin(e)))/(3*a),h=(-o+i*(s-Dh*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,Qh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&ec(),p=Gh(e,s,r,o,tc[0]),u>1&&(g=Gh(e,s,r,o,tc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(zh(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,Qh);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=Wh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Qh[0]=-l,Qh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Qh[0]+t&&a<=Qh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Qh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function rc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function ac(t,e){let i=rc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-rc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;oc[0]=S,oc[1]=A,ac(oc,Boolean(a[6])),S=oc[0],A=oc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Fo.M:u=m,p=v,c=u,d=p;break;case Fo.L:if(i){if(qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Fo.C:if(i){if(Xh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Fo.Q:if(i){if($h(c,d,m,v,_,y,e,s,n))return!0}else h+=sc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Fo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Kh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=nc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Fo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(qh(u,p,o,p,e,s,n)||qh(o,p,o,l,e,s,n)||qh(o,l,u,l,e,s,n)||qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Fo.Z:if(i){if(qh(c,d,u,p,e,s,n))return!0}else h+=Le(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},dc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const uc=Symbol.for("VWindow"),pc=Symbol.for("WindowHandlerContribution");let gc=class extends So{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(vo.getNamed(pc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=yo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};gc=cc([Ya(),dc("design:paramtypes",[])],gc);var fc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vc=function(t,e){return function(i,s){e(i,s,t)}};let _c=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=yo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=hc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:$l.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:$l.fontFamily,fontSize:$l.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=vo.get(uc),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 yc;_c=fc([Ya(),vc(0,Wa(lo)),vc(0,$a(Bh)),mc("design:paramtypes",[Object])],_c),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(yc||(yc={}));const bc=new Ue;let xc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=yc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=yc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}scale(t,e,i){return this.mode===yc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===yc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return bc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}translate(t,e){return this.mode===yc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===yc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};xc=fc([Ya(),mc("design:paramtypes",[])],xc);const Sc={arc:Zl,area:Jl,circle:Ql,line:ih,path:sh,symbol:oh,text:lh,rect:ah,polygon:nh,star:rh,richtext:hh,richtextIcon:dh,image:ch,group:th,glyph:eh},Ac=Object.keys(Sc);function kc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Mc={arc:Object.assign({},Sc.arc),area:Object.assign({},Sc.area),circle:Object.assign({},Sc.circle),line:Object.assign({},Sc.line),path:Object.assign({},Sc.path),symbol:Object.assign({},Sc.symbol),text:Object.assign({},Sc.text),rect:Object.assign({},Sc.rect),polygon:Object.assign({},Sc.polygon),star:Object.assign({},Sc.star),richtext:Object.assign({},Sc.richtext),richtextIcon:Object.assign({},Sc.richtextIcon),image:Object.assign({},Sc.image),group:Object.assign({},Sc.group),glyph:Object.assign({},Sc.glyph)};class Tc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Ac.forEach((t=>{this._defaultTheme[t]=Object.create(Mc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Ac.forEach((s=>{const n=Object.create(Mc[s]);t&&t[s]&&kc(n,t[s]),i[s]&&kc(n,i[s]),e[s]&&kc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Ac.forEach((t=>{kc(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 wc=new Tc;function Cc(t,e){return t.glyphHost?Cc(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)):wc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Cc(t.attachedThemeGraphic)||wc.getTheme()}var Ec=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 Bc 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ec(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Rc))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(Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Dc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Fc(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(Fc(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,Fc(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 Rc))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"):Fc(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 Oc))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=Dc.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 zc(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 Rc,this.rootWheelEvent=new Oc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Nc{static GetImage(t,e){var i;const s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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):Nc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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"},Nc.cache.set(t,s),s.dataPromise=yo.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=Nc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Nc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=yo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=yo.global.loadBlob(t):"json"===e&&(i.dataPromise=yo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Nc.isLoading&&Nc.toLoadAueue.length){Nc.isLoading=!0;const t=Nc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Nc.cache.set(i,n),n.dataPromise=yo.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((()=>{Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()})).catch((t=>{console.error(t),Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()}))}}),0)}static loadImage(t,e){const i=Uc(t,Nc.toLoadAueue);if(-1!==i)return Nc.toLoadAueue[i].marks.push(e),void Nc.loading();Nc.toLoadAueue.push({url:t,marks:[e]}),Nc.loading()}static improveImageLoading(t){const e=Uc(t,Nc.toLoadAueue);if(-1!==e){const t=Nc.toLoadAueue.splice(e,1);Nc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Uc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Yc[0]=t[0],Yc[2]=t[0],Yc[1]=t[1],Yc[3]=t[1],Yc):t:t:0,Xc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Kc=[1,2,3,0,1,2,3,0];function qc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Xc[0].x=i,Xc[1].y=i,Xc[2].x=-i,Xc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}td.TimeOut=1e3/60;const ed=new td,id=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class sd{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 nd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var rd=new class extends sd{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 nd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return nd(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 ad=new class extends sd{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 od(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 ld=new class extends sd{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 od(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}};function hd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var cd=new class extends sd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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)}};function dd(t,e,i,s,n=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 ud extends sd{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 dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}}var pd=new ud;var gd=new class extends ud{constructor(){super(...arguments),this.type="triangle"}};const fd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),md=Math.sin(Ht/10)*fd,vd=-Math.cos(Ht/10)*fd;function _d(t,e,i,s){const n=md*e,r=vd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 yd=new class extends sd{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 _d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return _d(t,this.parseSize(e)/2+n,i,s)}};const bd=Xt(3);function xd(t,e,i,s){const n=e,r=n/bd,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 Sd=new class extends sd{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 xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function Ad(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 kd=new class extends sd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2+n,i,s)}};function Md(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Td=new class extends sd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};const wd=-.5,Cd=Xt(3)/2,Ed=1/Xt(12);function Bd(t,e,i,s){const n=e/2,r=e*Ed,a=n,o=e*Ed+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(wd*n-Cd*r+i,Cd*n+wd*r+s),t.lineTo(wd*a-Cd*o+i,Cd*a+wd*o+s),t.lineTo(wd*l-Cd*h+i,Cd*l+wd*h+s),t.lineTo(wd*n+Cd*r+i,wd*r-Cd*n+s),t.lineTo(wd*a+Cd*o+i,wd*o-Cd*a+s),t.lineTo(wd*l+Cd*h+i,wd*h-Cd*l+s),t.closePath(),!1}var Pd=new class extends sd{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 Bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2+n,i,s)}};function Ld(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 Rd=new class extends sd{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 Ld(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends sd{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=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 Fd=new class extends sd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};const zd=Xt(3);function jd(t,e,i,s){const n=e*zd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Hd=new class extends sd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return jd(t,this.parseSize(e)/2/zd,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2/zd+n,i,s)}};function Vd(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 Nd=new class extends sd{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Wd=new class extends sd{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends sd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends sd{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var qd=new class extends sd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Jd=new class extends sd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(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 tu=new class extends sd{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 Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(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 eu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function iu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var su=new class extends sd{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)?iu(t,e,i,s):eu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?iu(t,e+2*n,i,s):eu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const nu=new Ve;class ru{constructor(t,e,i=!1){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(),Qo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Qo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{nu.x1=i.bounds.x1*t,nu.y1=i.bounds.y1*t,nu.x2=i.bounds.x2*t,nu.y2=i.bounds.y2*t,e.union(nu)}))}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 au={};[rd,ad,ld,cd,Hd,gd,yd,Sd,kd,Td,Pd,Rd,Id,pd,Fd,Nd,Wd,Yd,Xd,su,qd,Jd,tu].forEach((t=>{au[t.type]=t}));const ou={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class lu{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 hu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function cu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=cu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=hu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=cu(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 lu(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 lu(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 pu(t,e){return gu(t)}function gu(t,e){const i={};for(let e=0;eAu.set(t,!0)));const ku=new Map;function Mu(t){if(Au.has(t))return!0;if(ku.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>ku.set(t,!0)));const Tu=xu(),wu=xu(),Cu=xu(),Eu=xu(),Bu=xu(),Pu=xu(),Lu=xu(),Ru=xu(),Ou=xu(),Iu=xu();xu();const Du=xu();xu();const Fu=xu();xu();const zu=xu(),ju=xu(),Hu=Symbol.for("GraphicService"),Vu=Symbol.for("GraphicCreator"),Nu={"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"},Uu=Object.keys(Nu),Wu={duration:200,easing:"cubicOut"};function Gu(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 Yu(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 $u(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 Xu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ku(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 qu{constructor(){this.pools=[]}static identity(t){return Gu(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 qu.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},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ep=new Ue(1,0,0,1,0,0),ip={x:0,y:0};let sp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Hl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Zu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}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,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ip),function(t,e,i){return lc(t,0,!1,e,i)}(this.path.commandList,ip.x,ip.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ip);const i=gh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return lc(t,e,!0,i,s)}(this.path.commandList,i,ip.x,ip.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(t=!0,e=this.dpr){this.setTransformFromMatrix(ep,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};sp=Qu([Ya(),tp("design:paramtypes",[Object,Number])],sp);const np={WIDTH:500,HEIGHT:500,DPR:1};class rp{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}set nativeCanvas(t){this._nativeCanvas=t}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=np.WIDTH,height:n=np.HEIGHT,dpr:r=np.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var ap;rp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ap||(ap={}));class op{static Get(t,e=ap.Color1,i=[0,0,0,1]){if(e===ap.Color1){const e=op.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];op.store1[t]=e,op.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=op.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(op.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],op.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===ap.Color1){if(op.store1[t])return;op.store1[t]=i,op.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(op.store255[t])return;op.store255[t]=i,op.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function lp(t,e=!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 hp(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)=>{var a,o;return cp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):cp(t,e,i,s,n)}function cp(t,e,i,s,n){if(!t||!e)return t&&lp(t)||e&&lp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=op.Get(t,ap.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=op.Get(e,ap.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:lp(a)})))});return o?hp(r,l,i,s,n):hp(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:gp(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:gp(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:gp(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),lp(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)}function dp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}op.store255={},op.store1={};const up=[0,0,0,0],pp=[0,0,0,0];function gp(t,e,i){return op.Get(t,ap.Color255,up),op.Get(e,ap.Color255,pp),`rgba(${Math.round(up[0]+(pp[0]-up[0])*i)},${Math.round(up[1]+(pp[1]-up[1])*i)},${Math.round(up[2]+(pp[2]-up[2])*i)},${up[3]+(pp[3]-up[3])*i})`}class fp{static GetCanvas(){try{return fp.canvas||(fp.canvas=yo.global.createCanvas({})),fp.canvas}catch(t){return null}}static GetCtx(){if(!fp.ctx){const t=fp.GetCanvas();fp.ctx=t.getContext("2d")}return fp.ctx}}class mp extends We{static getInstance(){return mp._instance||(mp._instance=new mp),mp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=fp.GetCanvas(),s=fp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new mp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class vp{static GetSize(t){for(let e=0;e=t)return vp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=vp.GenKey(t,e,i,s,n),l=vp.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=vp.GenKey(t,e,i,s,n);vp.cache[l]?vp.cache[l].push({width:a,height:o,pattern:r}):vp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}vp.cache={},vp.ImageSize=[20,40,80,160,320,640,1280,2560];const _p=new Ve,yp=new Ue;new Ve;const bp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],xp=["x","y"],Sp=["scaleX","scaleY"],Ap=["angle"],kp=new ne,Mp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Bc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=au[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===((i=t=ou[t]||t).startsWith("{const e=(new Hl).fromString(t.d),i={};Uu.forEach((e=>{t[e]&&(i[Nu[e]]=t[e])})),n.push({path:e,attribute:i}),_p.union(e.bounds)}));const r=_p.width(),a=_p.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ru(t,n,!0);return Tp.userSymbolMap[t]=l,l}var i;const s=(new Hl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new ru(t,s);return Tp.userSymbolMap[t]=o,o}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=$c(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 Ro(t);return Qo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Wo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Wo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Wo.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&Wo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Wo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Go.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Wu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Yo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Yo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Yo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Wo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Wo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Wo.UPDATE_SHAPE_AND_BOUNDS)===Wo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Wo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Wo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Wo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Wo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Wo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Wo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}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&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),yo.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=yp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:yo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Hl).fromString(t):this.pathProxy=new Hl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),yo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Ic(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||yo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new sp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var wp;Tp.userSymbolMap={},Tp.mixin(jc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(wp||(wp={}));let Cp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Pu,this._childUpdateTag=Wo.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 Tc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tc)}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===Go.GLOBAL){const i=new ne(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&Wo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=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 Cc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return yo.graphicService.updateTempAABBBounds(i),yo.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&=Wo.CLEAR_BOUNDS,this._childUpdateTag&=Wo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Wo.UPDATE_BOUNDS||(this._childUpdateTag|=Wo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Wo.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=yo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Ep(t){return new Cp(t)}Cp.NOWORK_ANIMATE_ATTR=Mp;class Bp extends Cp{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 Tc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{yo.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=>{yo.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 Pp=Symbol.for("TransformUtil"),Lp=Symbol.for("GraphicUtil"),Rp=Symbol.for("LayerService"),Op=Symbol.for("StaticLayerHandlerContribution"),Ip=Symbol.for("DynamicLayerHandlerContribution"),Dp=Symbol.for("VirtualLayerHandlerContribution");var Fp,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)};let Hp=Fp=class{static GenerateLayerId(){return`${Fp.idprefix}_${Fp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=yo.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?vo.get(Op):"dynamic"===t?vo.get(Ip):vo.get(Dp),e}createLayer(t,e={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 Bp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Fp.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)}};Hp.idprefix="visactor_layer",Hp.prefix_count=0,Hp=Fp=zp([Ya(),jp("design:paramtypes",[])],Hp);var Vp=new Ra((t=>{t(mo).to(wo).inSingletonScope(),t(uc).to(gc),t(Lp).to(_c).inSingletonScope(),t(Pp).to(xc).inSingletonScope(),t(Rp).to(Hp).inSingletonScope()}));function Np(t,e){return!(!t&&!e)}function Up(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Wp(t,e,i){return i&&t*e>0}function Gp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Yp(t,e){return t*e>0}function $p(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Xp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Kp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Kp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Xp(g,f,u,p,n,t,Number(c)),l=Xp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Xp(S,A,b,x,r,-n,Number(c)),l=Xp(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const Zp=Symbol.for("ArcRenderContribution"),Jp=Symbol.for("AreaRenderContribution"),Qp=Symbol.for("CircleRenderContribution"),tg=Symbol.for("GroupRenderContribution"),eg=Symbol.for("ImageRenderContribution"),ig=Symbol.for("PathRenderContribution"),sg=Symbol.for("PolygonRenderContribution"),ng=Symbol.for("RectRenderContribution"),rg=Symbol.for("SymbolRenderContribution"),ag=Symbol.for("TextRenderContribution"),og=Symbol.for("InteractiveSubRenderContribution");function lg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function hg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}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)}};function pg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Gu(t),Yu(t,t,[n+o,r+l,a+h]),Yu(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),Yu(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]),f){const i=Ju.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]}Yu(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),Yu(i,i,[-s[0],-s[1],0]),Xu(t,t,i)}}let gg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Ro(t);return Qo(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=hg(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=lg(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){yu(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;yu(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};gg=cg([Ya(),ug(0,Wa(Vu)),dg("design:paramtypes",[Object])],gg);const fg=(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},mg=["radius","startAngle","endAngle",...bp];class vg extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Eu}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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.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>Vt-Ft?i.set(-r,-r,r,r):qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mg)}needUpdateTag(t){return super.needUpdateTag(t,mg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Hl,s.arc(0,0,r,a,o),s}clone(){return new vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vg.NOWORK_ANIMATE_ATTR}}function _g(t){return new vg(t)}vg.NOWORK_ANIMATE_ATTR=Mp;class yg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Co.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=ju,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 Cc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new xg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=yo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){yu(n,o/Math.abs(r+a),!0,l),i.union(n)}return yo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new yg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new yg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=lg(_,a),e=this.cache.verticalList.length*v,i=hg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Su.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=lg(_,a),S=this.cache.verticalList.length*v,A=hg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=id(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=bg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=bg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return xg.baselineMapAlign}getAlignMapBaseline(){return xg.alignMapBaseline}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Mp),xg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},xg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Ag=["symbolType","size",...bp];let kg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=zu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Cc(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}=yo.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;yu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return yo.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,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}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 Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Mp);const Tg=["segments","points","curveType","curveTension",...bp];let wg=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=Ru}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=Jc(i,s,e))}getGraphicTheme(){return Cc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Hl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const Eg=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}},Bg=["width","x1","y1","height","cornerRadius",...bp];class Pg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=Du}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Eg(e);return t=new Hl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Mp;class Rg extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=Bu,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,e=!1,i){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 Cc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Rg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Og(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Mp;class Ig{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=mh[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}}}function Dg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Fg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=id(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Th(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Th(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Dg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Ah(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Th(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const zg=["width","height","image",...bp];class jg extends Tp{constructor(t){super(t),this.type="image",this.numberType=Lu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Cc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ch[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}clone(){return new jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Mp);class Vg extends jg{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=$c(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=$c(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=ch.width,height:e=ch.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 Ng{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 Vg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Fg){const e=xh.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 Vg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Th(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)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||_h;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,Sh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?fh(t,s,{AABBBounds:i}):s,Sh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Vg)break;const{width:n}=Th(t,s.character,s.ascentDescentMode),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 Vg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ug{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=mh[this.direction]}store(t){if(t instanceof Vg){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 Ng(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,e=!1){t instanceof Vg?"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||this.newLine)&&("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=Ah(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 Fg(i,t.newLine,t.character,t.ascentDescentMode),new Fg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Wg=!1;try{Wg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Wg=!1}const Gg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...bp];class Yg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Fu,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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Cc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1)))}static splitText(t){if(Wg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Yg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),yo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}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;e0&&!Yg.AllSingleCharacter(_)&&(_=Yg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Ig(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ug(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Yg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Yg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Mp);const Xg=["path","customPath",...bp];class Kg extends Tp{constructor(t){super(t),this.type="path",this.numberType=Ou}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 Cc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return yo.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,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){return(new Hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Mp);const Zg=["segments","points","curveType","curveTension",...bp];class Jg extends Tp{constructor(t){super(t),this.type="area",this.numberType=Cu}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 Cc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Hl;const 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 Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const tf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...bp];class ef extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Tu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return yo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(qc(l,o,s,i),qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Mp);const nf=["points","cornerRadius",...bp];class rf extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Cc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Hl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Mp;class of extends Cp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function lf(t){return new of(t)}const hf=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 cf,df;function uf(t){return cf||(cf=hf.CreateGraphic("text",{})),cf.initAttributes(t),cf.AABBBounds}var pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gf=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)}};class mf{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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Cc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=hc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),hc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const vf=new mf;let _f=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)}))}};_f=pf([Ya(),ff(0,Wa(lo)),ff(0,$a(og)),gf("design:paramtypes",[Object])],_f);const yf=new 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){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const bf=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,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class xf{constructor(){this.time=Ko.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=hc.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])),hc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=hc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Mg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:gh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),qp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},kf=Sf,Mf=vf;const Tf=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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:gh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},wf=Sf,Cf=vf;const Ef=new class extends mf{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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Bf=zt/2;function Pf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Bf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Bf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Bf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Bf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Rf{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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:gh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Pf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Of=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)}};Of=Lf([Ya()],Of);let If=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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Pf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};If=Lf([Ya()],If);const Df=new Rf,Ff=Sf,zf=vf;const jf=new class extends Rf{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)}},Hf=vf;const Vf=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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:gh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Nf=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,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Uf=Sf,Wf=vf;const Gf={x:0,y:0,z:0,lastModelMatrix:null};class Yf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(yf),this.builtinContributions.push(bf),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)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Cc(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,_=Wp(d,u,h),y=Yp(d,g),b=Np(h),x=Up(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Qo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Wp(o,l,n),p=Yp(o,c),g=Np(n,r),f=Up(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,s=!1){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;Gf.x=n,Gf.y=r,Gf.z=a,Gf.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=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(s,d||s,n),Gf.x=0,Gf.y=0,Gf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Ju.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,Gf.z=a,i.setTransformForCurrent()}else if(p)Gf.x=0,Gf.y=0,Gf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,this.transformWithoutTranslate(i,Gf.x,Gf.y,Gf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Gf.x=0,Gf.y=0,Gf.z=0;return Gf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Ju.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Xf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let qf=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[Af,Mf,kf],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=Xp(v,_,f,m,n,t,Number(u)),o=Xp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Xp(M,T,A,k,r,-n,Number(u)),o=Xp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Gc[s]=t,i&&(i=!(null!==(e=Gc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Gc[e]=!!t[e],i&&(i=!!Gc[e]);else Gc[0]=!1,Gc[1]=!1,Gc[2]=!1,Gc[3]=!1;return{isFullStroke:i,stroke:Gc}})(d);if((_||E)&&(e.beginPath(),qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),qp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),hp(o.color,l.color,h,!1)}(0,0,h,n);a||Wp&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};qf=$f([Ya(),Kf(0,Wa(lo)),Kf(0,$a(Zp)),Xf("design:paramtypes",[Object])],qf);var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Tf,Cf,wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function em(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]=al(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 im(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 sm(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=im(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),em(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=$o.ROW:"y"===s?u=$o.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 rm=class extends Yf{constructor(){super(...arguments),this.numberType=Ru}draw(t,e,i,s){const n=Cc(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;if(!e)return;t.beginPath();sm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=jl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function am(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),em(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),em(t,l,1,s),o=!1):o=!0}t.closePath()}rm=nm([Ya()],rm);const om=new class extends xf{constructor(){super(...arguments),this.time=Ko.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Qc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Qc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Qc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Qc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},lm=vf;var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[om,lm],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=Cc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=jl(B(t.points,x),E,{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=jl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=jl(e,E,{curveTension:b}),n=jl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Cc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=$o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?$o.ROW:null==_.y1?$o.COLUMN:Number.isFinite(S+A)?S>A?$o.ROW:$o.COLUMN:$o.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?$o.ROW:$o.COLUMN,Number.isFinite(c)||(o=$o.COLUMN),Number.isFinite(d)||(o=$o.ROW);const u=i*(o===$o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),sm(t,i[0]?e.top:e.bottom,l,x===$o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};um=hm([Ya(),dm(0,Wa(lo)),dm(0,$a(Jp)),cm("design:paramtypes",[Object])],um);const pm=Sf,gm=vf;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},mm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vm=function(t,e){return function(i,s){e(i,s,t)}};let _m=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[gm,pm],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:Cc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Qo(t.pathShape.commandList,e,i,s,1,1,f);else{Qo((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,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=Cc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};_m=fm([Ya(),vm(0,Wa(lo)),vm(0,$a(ig)),mm("design:paramtypes",[Object])],_m);var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Du,this.builtinContributions=[Df,zf,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Gp(g,f,T,w,h),E=$p(g,v,T,w,M),B=Np(h,c),P=Up(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Pf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Sm=ym([Ya(),xm(0,Wa(lo)),xm(0,$a(ng)),bm("design:paramtypes",[Object])],Sm);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)},Mm=function(t,e){return function(i,s){e(i,s,t)}};let Tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Vf,Wf,Uf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Cc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Tm=Am([Ya(),Mm(0,Wa(lo)),Mm(0,$a(rg)),km("design:paramtypes",[Object])],Tm);const wm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Cm=new class extends mf{constructor(){super(...arguments),this.time=Ko.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=wm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=uf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Pf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&wm.free(E),C()}};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)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Lm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Cm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Cc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=id(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(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)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Cc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:lg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Rm(t,e,i,s){if(e&&e.length){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},jm=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 Vm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Fm,Dm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Rm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Rm(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,_=v/m;const y=Om(d,u),b=Om(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Im(h,_,y,d,u),A=Im(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Om(k,M),w=Im(h,Om(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Vm=zm([Ya(),Hm(0,Wa(lo)),Hm(0,$a(sg)),jm("design:paramtypes",[Object])],Vm);var Nm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Um=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 Gm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Pu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Cc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Gp(p,m,g,f,c),C=$p(p,v,g,f),E=Np(c,u),B=Up(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Pf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Ko.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ko.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=yo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Cc(t,null==s?void 0:s.theme).group,i=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(i,p||i,n),a.modelMatrix=i,Ju.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ju.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Gm=Nm([Ya(),Wm(0,Wa(lo)),Wm(0,$a(tg)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};const Km=["","repeat-x","repeat-y","repeat"];let qm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[jf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Pf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Km[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Nc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Cc(t).image;this._draw(t,a,!1,i)}};qm=Ym([Ya(),Xm(0,Wa(lo)),Xm(0,$a(eg)),$m("design:paramtypes",[Object])],qm);const Zm=Symbol.for("IncrementalDrawContribution"),Jm=Symbol.for("ArcRender"),Qm=Symbol.for("AreaRender"),tv=Symbol.for("CircleRender"),ev=Symbol.for("GraphicRender"),iv=Symbol.for("GroupRender"),sv=Symbol.for("LineRender"),nv=Symbol.for("PathRender"),rv=Symbol.for("PolygonRender"),av=Symbol.for("RectRender"),ov=Symbol.for("SymbolRender"),lv=Symbol.for("TextRender"),hv=Symbol.for("RichTextRender"),cv=Symbol.for("GlyphRender"),dv=Symbol.for("ImageRender"),uv=Symbol.for("DrawContribution"),pv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===wu,!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+=Vt;for(;o<0;)o+=Vt;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 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},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mv=Symbol.for("DrawItemInterceptor"),vv=new Ve,_v=new Ve;class yv{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){vv.copy(s.dirtyBounds),_v.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(vv),s.backupDirtyBounds.copy(_v)),!0}}class bv{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 xv=class{constructor(){this.order=1,this.interceptors=[new yv,new Av,new Sv,new bv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Ju.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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},Mv=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)}};let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=kv([Ya(),Tv(0,Wa(uv)),Mv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(_o).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=Cc(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 ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=pv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(Hu).to(gg),t(Vu).toConstantValue(hf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&vo.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Bh).to(Ph).inSingletonScope(),co(t,Bh)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=yo.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=Oh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Op).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=yo.global,this.layerService=yo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Zu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,ql.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=wm.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())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),wm.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||vo.get(Zm);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 h_=class extends rm{constructor(){super(...arguments),this.numberType=Ru}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=Cc(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=Wp(u,p,c),_=Yp(u,g),y=Np(c),b=Up(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends um{constructor(){super(...arguments),this.numberType=Cu}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=Cc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Wp(u,d,c),f=Np(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,ql.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,ql.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(ev)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(mv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(mf).toSelf().inSingletonScope(),t(xf).toSelf().inSingletonScope(),t(uv).to(o_),t(Zm).to(v_),t(iv).to(Gm).inSingletonScope(),t(ev).toService(iv),co(t,tg),t(_f).toSelf().inSingletonScope(),co(t,og),co(t,ev),t(xv).toSelf().inSingletonScope(),t(mv).toService(xv),co(t,mv)}));function y_(){y_.__loaded||(y_.__loaded=!0,vo.load(Vp),vo.load(jv),vo.load(Cv),vo.load(zv),vo.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(vo),function(t){t.load(__)}(vo))}y_.__loaded=!1,y_();const b_=vo.get(mo);yo.global=b_;const x_=vo.get(Lp);yo.graphicUtil=x_;const S_=vo.get(Pp);yo.transformUtil=S_;const A_=vo.get(Hu);yo.graphicService=A_;const k_=vo.get(Rp);yo.layerService=k_;class M_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class T_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=yo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=yo.global.getRequestAnimationFrame();this.rafId=t((()=>{yo.global.devicePixelRatio!==this.dpr&&(this.dpr=yo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=yo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,yo.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 C_=new Ve;class E_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(C_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(C_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=yo.global&&yo.global.env;return t?"browser"===t:B_}let L_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};L_._pluginClasses={};const R_="white";class O_ extends Cp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Tc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=yo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=vo.get(uc),this.renderService=vo.get(_o),this.pluginService=vo.get(Vv),this.layerService=vo.get(Rp),this.graphicService=vo.get(Hu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Vc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=L_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=L_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=L_.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 M_))}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 T_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new E_,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=L_.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=L_.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=L_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=vo.get(uc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=vo.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},D_=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 F_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return D_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};F_=I_([Ya()],F_);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 H_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};H_=z_([Ya(),j_("design:paramtypes",[])],H_);var V_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},N_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},U_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=yo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Cc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=Cc(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&&Ju.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}};function G_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Y_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function J_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),sy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ny=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return sy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return sy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ny(n[0],s,i),ny(n[1],e-s,i)}};let ry=!1;const ay=new Ra((t=>{ry||(ry=!0,t(qf).toSelf().inSingletonScope(),t(Jm).to(qf).inSingletonScope(),t(ev).toService(Jm),t(Zp).toService(_f),co(t,Zp))}));let oy=!1;const ly=new Ra((t=>{oy||(oy=!0,t(Sm).toSelf().inSingletonScope(),t(av).to(Sm).inSingletonScope(),t(ev).toService(av),t(If).toSelf(),t(Of).toSelf(),t(ng).toService(If),t(ng).toService(Of),t(ng).toService(_f),co(t,ng))}));let hy=!1;const cy=new Ra((t=>{hy||(hy=!0,t(rm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(sv).to(rm).inSingletonScope(),t(ev).toService(sv))}));let dy=!1;const uy=new Ra((t=>{dy||(dy=!0,t(um).toSelf().inSingletonScope(),t(Qm).to(um).inSingletonScope(),t(ev).toService(Qm),t(Jp).toService(_f),co(t,Jp),t(d_).toSelf().inSingletonScope())}));let py=!1;const gy=new Ra((t=>{py||(py=!0,t(Tm).toSelf().inSingletonScope(),t(ov).to(Tm).inSingletonScope(),t(ev).toService(ov),t(rg).toService(_f),co(t,rg))}));let fy=!1;const my=new Ra((t=>{fy||(fy=!0,t(tm).toSelf().inSingletonScope(),t(tv).to(tm).inSingletonScope(),t(ev).toService(tv),t(Qp).toService(_f),co(t,Qp))}));let vy=!1;const _y=new Ra((t=>{vy||(vy=!0,t(lv).to(Lm).inSingletonScope(),t(ev).toService(lv),t(ag).toService(_f),co(t,ag))}));let yy=!1;const by=new Ra((t=>{yy||(yy=!0,t(_m).toSelf().inSingletonScope(),t(nv).to(_m).inSingletonScope(),t(ev).toService(nv),t(ig).toService(_f),co(t,ig))}));let xy=!1;const Sy=new Ra((t=>{xy||(xy=!0,t(rv).to(Vm).inSingletonScope(),t(ev).toService(rv),t(sg).toService(_f),co(t,sg))}));var Ay=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Bu}reInit(){}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=Cc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Ay([Ya()],ky);let My=!1;const Ty=new Ra((t=>{My||(My=!0,t(cv).to(ky).inSingletonScope(),t(ev).toService(cv))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ey=class extends Yf{constructor(){super(),this.numberType=Fu,this.builtinContributions=[Cm],this.init()}drawShape(t,e,i,s,n){const r=Cc(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=Wp(o,l,!0),d=Wp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Cc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Pf(e,i-t,s-n,v,_,f,!0)),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=Cc(t).richtext;this._draw(t,s,!1,i)}};Ey=wy([Ya(),Cy("design:paramtypes",[])],Ey);let By=!1;const Py=new Ra((t=>{By||(By=!0,t(hv).to(Ey).inSingletonScope(),t(ev).toService(hv))}));let Ly=!1;const Ry=new Ra((t=>{Ly||(Ly=!0,t(dv).to(qm).inSingletonScope(),t(ev).toService(dv),t(eg).toService(_f),co(t,eg))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Fy=(t,e)=>(d(jy.warnHandler)&&jy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),zy=(t,e,i)=>{if(!d(jy.errorHandler))throw new Error(t);jy.errorHandler.call(null,t,e)},jy={silent:!1,warnHandler:!1,errorHandler:!1},Hy=P_(),Vy=Hy&&globalThis?globalThis.document:void 0;function Ny(t){return("desktop-browser"===t||"mobile-browser"===t)&&Hy}function Uy(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Gy=0;function Yy(){return Gy>=9999999&&(Gy=0),Gy++}function $y(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Ky=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class qy extends Cp{constructor(t,e){super(t),this._skipRenderAttributes=Ky,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},kb=(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,e={}){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.startTime=Dc.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=Dc.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||Ab(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=kb(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=Dc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Ab(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("pointerleave",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("pointerleave",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=Dc.now()-i>this.config.press.time&&kb(s[0],t){yo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Cb=[0,0,0];let Eb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Wl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},$l),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&vp.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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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,e=yo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=yo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:$l.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:$l.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&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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=fh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:gh(this,a,this.dpr),r.strokeStyle=fh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};Eb.env="browser",Eb=Tb([Ya(),wb("design:paramtypes",[Object,Number])],Eb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lb=class extends rp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=yo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Eb(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 Rb(t,e){return new Ra((i=>{i(Lh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Rh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Lb.env="browser",Lb=Bb([Ya(),Pb("design:paramtypes",[Object])],Lb);const Ob=Rb(Lb,Eb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fb=function(t,e){return function(i,s){e(i,s,t)}};let zb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=hc.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 Hb=class{constructor(){this.type="group",this.numberType=Pu}contains(t,e,i){return!1}};Hb=jb([Ya()],Hb);const Vb=new Ra(((t,e,i,s)=>{Vb.__vloaded||(Vb.__vloaded=!0,t(xb).to(Hb).inSingletonScope(),t(Sb).toService(xb),co(t,Sb))}));Vb.__vloaded=!1;var Nb=Vb;const Ub=new Ra(((t,e,i,s)=>{i(zb)||t(zb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(zb):t(Ev).toService(zb)}));var Wb,Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let $b=Wb=class extends H_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=yo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Lb(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 Lb({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)}};$b.env="browser",$b.idprefix="visactor_window",$b.prefix_count=0,$b=Wb=Gb([Ya(),Yb("design:paramtypes",[])],$b);const Xb=new Ra((t=>{t($b).toSelf(),t(pc).toDynamicValue((t=>t.container.get($b))).whenTargetNamed($b.env)}));var Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zb=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 Jb{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 Qb(t,e=!1){const i=document.createElement("img");if(yo.global.isImageAnonymous&&(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 tx=class extends F_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Jb(t)}return new Ve}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 Qb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qb(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:La.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(...t){}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}}loadFont(t,e,i){return Zb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};tx=Kb([Ya(),qb("design:paramtypes",[])],tx);const ex=new Ra((t=>{ex.isBrowserBound||(ex.isBrowserBound=!0,t(tx).toSelf().inSingletonScope(),t(fo).toService(tx))}));function ix(t,e=!0){ix.__loaded||(ix.__loaded=!0,t.load(ex),t.load(Ob),t.load(Xb),e&&function(t){t.load(Nb),t.load(Ub)}(t))}ex.isBrowserBound=!1,ix.__loaded=!1;var sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 nx=class extends Eb{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}};nx.env="feishu",nx=sx([Ya()],nx);var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let ox=class extends rp{constructor(t){super(t)}init(){this._context=new nx(this,this._dpr)}release(...t){}};ox.env="feishu",ox=rx([Ya(),ax("design:paramtypes",[Object])],ox);const lx=Rb(ox,nx);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},cx=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)}};class ux{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 px=class extends H_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ux}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ox(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 ox({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()}};px.env="feishu",px=hx([Ya(),dx(0,Wa(mo)),cx("design:paramtypes",[Object])],px);const gx=new Ra((t=>{t(px).toSelf(),t(pc).toDynamicValue((t=>t.container.get(px))).whenTargetNamed(px.env)}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 sp(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}};_x=fx([Ya(),vx(0,Wa(lo)),vx(0,$a(Zy)),vx(1,Wa(lo)),vx(1,$a(Pv)),vx(2,Wa(lo)),vx(2,$a(Lv)),mx("design:paramtypes",[Object,Object,Object])],_x);const yx=new Ra((t=>{yx.__vloaded||(yx.__vloaded=!0,co(t,Zy))}));yx.__vloaded=!1;var bx=yx;class xx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:gh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Mx=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};Mx=Sx([Ya(),kx(0,Wa(Jm)),Ax("design:paramtypes",[Object])],Mx);let Tx=!1;const wx=new Ra(((t,e,i,s)=>{Tx||(Tx=!0,t(Jy).to(Mx).inSingletonScope(),t(Zy).toService(Jy))}));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)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Px=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};Px=Cx([Ya(),Bx(0,Wa(Qm)),Ex("design:paramtypes",[Object])],Px);let Lx=!1;const Rx=new Ra(((t,e,i,s)=>{Lx||(Lx=!0,t(Qy).to(Px).inSingletonScope(),t(Zy).toService(Qy))}));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},Ix=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 xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};Fx=Ox([Ya(),Dx(0,Wa(tv)),Ix("design:paramtypes",[Object])],Fx);let zx=!1;const jx=new Ra(((t,e,i,s)=>{zx||(zx=!0,t(tb).to(Fx).inSingletonScope(),t(Zy).toService(tb))}));class Hx{constructor(){this.type="glyph",this.numberType=Bu}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},Nx=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 Wx=class extends Hx{constructor(t){super(),this.canvasRenderer=t}};Wx=Vx([Ya(),Ux(0,Wa(cv)),Nx("design:paramtypes",[Object])],Wx);let Gx=!1;const Yx=new Ra(((t,e,i,s)=>{Gx||(Gx=!0,t(lb).to(Wx).inSingletonScope(),t(Wx).toService(lb))}));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 Xx=class{constructor(){this.type="image",this.numberType=Lu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Xx=$x([Ya()],Xx);let Kx=!1;const qx=new Ra(((t,e,i,s)=>{Kx||(Kx=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=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 tS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};tS=Zx([Ya(),Qx(0,Wa(sv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new Ra(((t,e,i,s)=>{eS||(eS=!0,t(ib).to(tS).inSingletonScope(),t(Zy).toService(ib))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};aS=sS([Ya(),rS(0,Wa(rv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new Ra(((t,e,i,s)=>{oS||(oS=!0,t(ob).to(aS).inSingletonScope(),t(Zy).toService(ob))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};uS=hS([Ya(),dS(0,Wa(nv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new Ra(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(uS).inSingletonScope(),t(Zy).toService(sb))})),fS=new Ve;class mS{constructor(){this.type="rect",this.numberType=Du}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:gh(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;fS.setValue(i.x1,i.y1,i.x2,i.y2),fS.expand(-r/2),h=!fS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yS=function(t,e){return function(i,s){e(i,s,t)}};let bS=class extends mS{constructor(t){super(),this.canvasRenderer=t}};bS=vS([Ya(),yS(0,Wa(av)),_S("design:paramtypes",[Object])],bS);let xS=!1;const SS=new Ra(((t,e,i,s)=>{xS||(xS=!0,t(nb).to(bS).inSingletonScope(),t(Zy).toService(nb))}));let AS=!1;const kS=new Ra(((t,e,i,s)=>{AS||(AS=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));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},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}};CS=MS([Ya(),wS(0,Wa(ov)),TS("design:paramtypes",[Object])],CS);let ES=!1;const BS=new Ra(((t,e,i,s)=>{ES||(ES=!0,t(rb).to(CS).inSingletonScope(),t(Zy).toService(rb))}));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};let LS=class{constructor(){this.type="text",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};LS=PS([Ya()],LS);let RS=!1;const OS=new Ra(((t,e,i,s)=>{RS||(RS=!0,t(ab).to(LS).inSingletonScope(),t(Zy).toService(ab))})),IS=new Ra(((t,e,i,s)=>{i(_x)||t(_x).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(_x):t(Ev).toService(_x)}));class DS{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 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},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jS=class extends F_{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 DS(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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};jS=FS([Ya(),zS("design:paramtypes",[])],jS);const HS=new Ra((t=>{HS.isFeishuBound||(HS.isFeishuBound=!0,t(jS).toSelf().inSingletonScope(),t(fo).toService(jS))}));function VS(t,e=!0){VS.__loaded||(VS.__loaded=!0,t.load(HS),t.load(lx),t.load(gx),e&&function(t){t.load(bx),t.load(IS),t.load(wx),t.load(Rx),t.load(jx),t.load(Yx),t.load(qx),t.load(iS),t.load(lS),t.load(gS),t.load(SS),t.load(kS),t.load(BS),t.load(OS)}(t))}HS.isFeishuBound=!1,VS.__loaded=!1;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},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends Eb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};WS.env="node",WS=NS([Ya(),US("design:paramtypes",[Object,Number])],WS);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},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends rp{constructor(t){super(t)}init(){this._context=new WS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};$S.env="node",$S=GS([Ya(),YS("design:paramtypes",[Object])],$S);const XS=Rb($S,WS);var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZS=function(t,e){return function(i,s){e(i,s,t)}};let JS=class extends H_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new $S(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new $S({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};JS.env="node",JS=KS([Ya(),ZS(0,Wa(mo)),qS("design:paramtypes",[Object])],JS);const QS=new Ra((t=>{t(JS).toSelf(),t(pc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)}));var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eA=class extends F_{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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};eA=tA([Ya()],eA);const iA=new Ra((t=>{iA.isNodeBound||(iA.isNodeBound=!0,t(eA).toSelf().inSingletonScope(),t(fo).toService(eA))}));function sA(t,e=!0){sA.__loaded||(sA.__loaded=!0,t.load(iA),t.load(XS),t.load(QS))}iA.isNodeBound=!1,sA.__loaded=!1;var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};oA=nA([Ya(),aA(0,Wa(Jm)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new Ra(((t,e,i,s)=>{lA||(lA=!0,t(hb).to(oA).inSingletonScope(),t(Sb).toService(hb))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends mS{constructor(t){super(),this.canvasRenderer=t}};pA=cA([Ya(),uA(0,Wa(av)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new Ra(((t,e,i,s)=>{gA||(gA=!0,t(fb).to(pA).inSingletonScope(),t(Sb).toService(fb))}));class mA extends Yf{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:gh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};bA=vA([Ya(),yA(0,Wa(sv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Ra(((t,e,i,s)=>{xA||(xA=!0,t(pb).to(bA).inSingletonScope(),t(Sb).toService(pb))}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MA=function(t,e){return function(i,s){e(i,s,t)}};let TA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};TA=AA([Ya(),MA(0,Wa(Qm)),kA("design:paramtypes",[Object])],TA);let wA=!1;const CA=new Ra(((t,e,i,s)=>{wA||(wA=!0,t(cb).to(TA).inSingletonScope(),t(Sb).toService(cb))}));class EA extends Yf{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&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let RA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}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:gh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Ju.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};RA=BA([Ya(),LA(0,Wa(ov)),PA("design:paramtypes",[Object])],RA);let OA=!1;const IA=new Ra(((t,e,i,s)=>{OA||(OA=!0,t(mb).to(RA).inSingletonScope(),t(Sb).toService(mb))}));var DA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};let jA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};jA=DA([Ya(),zA(0,Wa(tv)),FA("design:paramtypes",[Object])],jA);let HA=!1;const VA=new Ra(((t,e,i,s)=>{HA||(HA=!0,t(db).to(jA).inSingletonScope(),t(Sb).toService(db))}));var NA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let GA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ju}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=hg(a,u,n),v=lg(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&&Ju.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};GA=NA([Ya(),WA(0,Wa(lv)),UA("design:paramtypes",[Object])],GA);let YA=!1;const $A=new Ra(((t,e,i,s)=>{YA||(YA=!0,t(vb).to(GA).inSingletonScope(),t(Sb).toService(vb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};ZA=XA([Ya(),qA(0,Wa(nv)),KA("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new Ra(((t,e,i,s)=>{JA||(JA=!0,t(gb).to(ZA).inSingletonScope(),t(Sb).toService(gb))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ek=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 sk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};sk=tk([Ya(),ik(0,Wa(rv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new Ra(((t,e,i,s)=>{nk||(nk=!0,t(_b).to(sk).inSingletonScope(),t(Sb).toService(_b))}));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 Hx{constructor(t){super(),this.canvasRenderer=t}};hk=ak([Ya(),lk(0,Wa(cv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new Ra(((t,e,i,s)=>{ck||(ck=!0,t(bb).to(hk).inSingletonScope(),t(Sb).toService(bb))}));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 fk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};fk=uk([Ya(),gk(0,Wa(hv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new Ra(((t,e,i,s)=>{mk||(mk=!0,t(yb).to(fk).inSingletonScope(),t(Sb).toService(yb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Lu}};xk=_k([Ya(),bk(0,Wa(dv)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new Ra(((t,e,i,s)=>{Sk||(Sk=!0,t(ub).to(xk).inSingletonScope(),t(Sb).toService(ub))})),kk=P_();function Mk(){Mk.__loaded||(Mk.__loaded=!0,hf.RegisterGraphicCreator("arc",sf),vo.load(ay),vo.load(kk?hA:wx))}Mk.__loaded=!1;const Tk=Mk;function wk(){wk.__loaded||(wk.__loaded=!0,hf.RegisterGraphicCreator("area",Qg),vo.load(uy),vo.load(kk?CA:Rx))}wk.__loaded=!1;const Ck=wk;function Ek(){Ek.__loaded||(Ek.__loaded=!0,hf.RegisterGraphicCreator("circle",_g),vo.load(my),vo.load(kk?VA:jx))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,hf.RegisterGraphicCreator("glyph",Og),vo.load(Ty),vo.load(kk?dk:Yx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,hf.RegisterGraphicCreator("group",Ep))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,hf.RegisterGraphicCreator("image",Hg),vo.load(Ry),vo.load(kk?Ak:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,hf.RegisterGraphicCreator("line",Cg),vo.load(cy),vo.load(kk?SA:iS))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,hf.RegisterGraphicCreator("path",qg),vo.load(by),vo.load(kk?QA:gS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,hf.RegisterGraphicCreator("polygon",af),vo.load(Sy),vo.load(kk?rk:lS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,hf.RegisterGraphicCreator("rect",Lg),vo.load(ly),vo.load(kk?fA:SS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,hf.RegisterGraphicCreator("richtext",$g),vo.load(Py),vo.load(kk?vk:kS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,hf.RegisterGraphicCreator("shadowRoot",lf))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,hf.RegisterGraphicCreator("symbol",Mg),vo.load(gy),vo.load(kk?IA:BS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,hf.RegisterGraphicCreator("text",Sg),vo.load(_y),vo.load(kk?$A:OS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Ok(),Wk()}const tM=-.5*Math.PI,eM=1.5*Math.PI,iM="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 sM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sM||(sM={}));const nM={[sM.selectedReverse]:{},[sM.selected]:{},[sM.hover]:{},[sM.hoverReverse]:{}},rM={container:"",width:30,height:30,style:{}},aM="scrollDrag";function oM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const lM={debounce:xt,throttle:St};Qk();let hM=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=oM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:lM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(aM,{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",lM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};hM.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};var cM,dM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 uM=cM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=cM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(aM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new hM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(uM)||(t(uM).toSelf(),t(Hv).toService(uM))}));function gM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&gM(t,e)}))}const fM=t=>!u(t)&&!1!==t.visible;function mM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function vM(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 yM=["#ffffff","#000000"];function bM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return xM(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(...yM);for(const n of a)if(t!==n&&xM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function xM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(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=AM(t),s=AM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function AM(t){const e=si(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 kM(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 MM(t,e){return[t[0]*e,t[1]*e]}function TM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const CM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:iM,fontSize:14},s),getTextBounds:i?void 0:uf,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function EM(t,e,i={}){if(!t)return{width:0,height:0};const s=uf({text:t,fontFamily:e.fontFamily||i.fontFamily||iM,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 BM(t,e="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 PM(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 LM(t,e="type"){const i=BM(t,e);return"rich"===i?hf.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),hf.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 DM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function FM(){Ok(),Wk(),qk(),Yk(),Jk()}var zM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=zM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Hl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},jM.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))}}jM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const HM={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}},VM={poptip:j({},HM)};var NM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}KM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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 ZM=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={};j(s,KM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new KM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,VM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};ZM=qM([Ya()],ZM);var JM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 QM{constructor(){this.activeEvent="onRegister",this._uid=La.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 tT=class extends QM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};tT=JM([Ya()],tT);let eT=class extends QM{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)}};eT=JM([Ya()],eT);const iT=new Ra(((t,e,i,s)=>{i(ZM)||(t(ZM).toSelf().inSingletonScope(),t(og).toService(ZM)),i(tT)||(t(tT).toSelf(),t(Hv).toService(tT)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT))}));class sT extends qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ok(),zk();class nT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nT.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})}}nT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ok(),Wk();class rT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Tk();class aT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}aT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ok(),Tk();class oT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=tM,endAngle:s=eM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}oT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Hk();class lT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function hT(){Ok(),zk(),Nk(),qk()}function cT(){Ok(),zk(),Tk(),qk()}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},hT();class dT extends qy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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(k(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=hf.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),P(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=hf.line;Y(i)[0].cornerRadius&&(t=hf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=hf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}dT.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}}},cT();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=hf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var pT,gT;!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"}(pT||(pT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gT||(gT={}));const fT={[gT.selectedReverse]:{},[gT.selected]:{},[gT.hover]:{},[gT.hoverReverse]:{}},mT={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}}},vT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const _T=Math.sin(Math.PI/10);function yT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function bT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function xT(t){const e={};return gM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ST(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function AT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return MM(r,(s?-1:1)*(n?-1:1)*t/TM(r))}function kT(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 TT(t,e,i){var s;if(bT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function wT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(sM.hover,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.hoverReverse,!0)})),s):i},ET=(t,e,i)=>i?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),null):i,BT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(sM.selected)?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.selectedReverse),t.removeState(sM.selected))})),null):s.name&&!P(s.states)?(s.addState(sM.selected,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.selectedReverse,!0)})),s):i};class PT extends qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const LT={type:"default",duration:300,easing:"linear"};class RT extends PT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=CT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=hf.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._prepare(),this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(LT)}_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=hf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pT.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=hf.group({x:0,y:0,pickable:!1});t.name=pT.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=hf.group({x:0,y:0,pickable:!1});i.name=pT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=hf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=pT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=nM;else{const t=this.data[s],e=j({},nM,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=hf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=pT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=nM;else{const i=j({},nM,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=hf.group({x:0,y:0,pickable:!1});return r.name=`${pT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=LM(this._getLabelAttribute(t,e,n,i));if(a.name=pT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=nM;else{const s=j({},nM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new jM(Object.assign({},e));i.name=pT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ST(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},mT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},gM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const OT={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&&TT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function IT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function DT(t,e,i,s,n=!1){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:OT[n]||OT.parity;if(s.length>=3&&wT(s,r)){do{s=a(s,r)}while(s.length>=3&&wT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);TT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),DT(l,s,n,(t=>TT(t,l,r))),DT(h,s,o,(t=>TT(t,h,r)||!(!n||t===l)&&TT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function zT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},VT(t,e.attribute.angle)),{angle:HT(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({},NT(t,e.attribute.angle)),{angle:HT(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 HT(t=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 VT(t,e=0){let 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=HT(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 NT(t,e=0){let 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=HT(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 UT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=bT(h),m=yT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 WT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class GT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=TM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return MM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class YT{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-YT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*YT.bounceIn(2*t):.5*YT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){YT[t]=e}}function $T(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}YT.quadIn=YT.getPowIn(2),YT.quadOut=YT.getPowOut(2),YT.quadInOut=YT.getPowInOut(2),YT.cubicIn=YT.getPowIn(3),YT.cubicOut=YT.getPowOut(3),YT.cubicInOut=YT.getPowInOut(3),YT.quartIn=YT.getPowIn(4),YT.quartOut=YT.getPowOut(4),YT.quartInOut=YT.getPowInOut(4),YT.quintIn=YT.getPowIn(5),YT.quintOut=YT.getPowOut(5),YT.quintInOut=YT.getPowInOut(5),YT.backIn=YT.getBackIn(1.7),YT.backOut=YT.getBackOut(1.7),YT.backInOut=YT.getBackInOut(1.7),YT.elasticIn=YT.getElasticIn(1,.3),YT.elasticOut=YT.getElasticOut(1,.3),YT.elasticInOut=YT.getElasticInOut(1,.3*1.5),YT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),YT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},YT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)YT[`flicker${t}`]=e=>$T(e,t);for(let t=2;t<10;t++)YT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function XT(t,e,i){return t+(e-t)*i}const KT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=XT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=XT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=XT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=XT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=XT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=XT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=XT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=XT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=XT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=hp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?dp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=hp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?dp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=XT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=XT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=XT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=XT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=XT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=XT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=XT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Jc(e,i,s),r.addUpdateBoundTag()}}};function qT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=YT[s])&&void 0!==n?n:YT.linear:YT.linear,"wait"===t&&(this.onUpdate=ZT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=ZT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=op.Get(i,ap.Color255),r=op.Get(s,ap.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(KT["fill"===e?"fillPure":"strokePure"])}else KT[e]?t.push(KT[e]):t.push(qT)}else KT[e]?t.push(KT[e]):t.push(qT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class QT extends JT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Po.END?this.removeAnimate(t,!0):t.status!==Po.RUNNING&&t.status!==Po.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ew=new tw;ew.isGlobal=!0;class iw{constructor(t=La.GenAutoIncrementId(),e=ew,i){this.id=t,this.status=Po.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new JT(Bo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new QT(Bo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new JT(Bo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Po.RUNNING&&(this.status=Po.PAUSED)}resume(){this.status===Po.PAUSED&&(this.status=Po.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Po.END&&this.onEnd(),this.status=Po.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Po.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Po.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Po.END);this.status=Po.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const sw=new xo;class nw{constructor(){this.released=!1}tick(t,e){sw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class rw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Eo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Eo.INITIAL,yo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),yo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new nw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Eo.INITIAL&&(this.status=Eo.PAUSE,!0)}resume(){return this.status!==Eo.INITIAL&&(this.status=Eo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Eo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Eo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Eo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}ow.getInstance();class lw{static registerBuiltInAnimate(t,e){lw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Po.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}lw.builtInAnimateMap={};const hw="appear",cw="disappear",dw="update",uw="highlight",pw="unhighlight";class gw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=ow.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hw],[{name:hw,animation:t}],e)}applyDisappearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyUpdateState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyHighlightState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mw)._getAnimationStateManager(t),t}}class vw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new iw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:ew,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new tw}createTicker(t){return new rw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _w(){G(Tp,mw),G(Tp,vw)}class yw extends JT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bw extends yw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Sw(t){return new xw(t)}class Aw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kw=1e3,Mw="quadInOut",Tw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],ww=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=hp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Cw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Z_(t):[],n=Z_(e);i&&s&&(i.fromTransform&&J_(s,i.fromTransform.clone().getInverse()),J_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Bw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Pw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Bw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?op.Get(t,ap.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lw extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Cw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&ww(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Rw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Ew(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Pw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Mw);return c.play(d),c};class Ow extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Cw(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&ww(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Iw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Tw.includes(t))(i)||(e[i]=t[i])})),e},Dw=(t,e,i)=>{const s=Iw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=yo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Fw=(t,e,i)=>{const s=[],n=i?null:Iw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Iw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Eg(t.attribute),n=ty(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(yo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ty(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ty(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ey(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ey(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(yo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:iy(i)}];const s=[];return ny(i,e,s),s})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ny(l,e,h),h})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Z_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(yo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Dw(t,s,e),s};class jw extends yw{constructor(t,e,i,s,n){super(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(){super.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:Yo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Yo.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:Yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Hw extends jw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=yo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vw extends jw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=yo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Nw extends yw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Zc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Uw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends Uw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const $w=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Xw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Kw extends Xw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$w(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class qw extends Xw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Zw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Jw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Qw=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class tC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Qw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const iC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class sC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Zc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class nC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:iC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class rC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:iC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const aC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class oC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:aC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class lC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:aC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const hC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class cC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class dC extends sC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const uC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class pC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends pC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=uC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class fC extends pC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const mC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class vC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=mC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _C extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{onBind(){var t;const e=Sw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class bC extends bw{onBind(){const t=Sw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function xC(){Ok(),zk(),Yk(),Jk(),lw.registerBuiltInAnimate("axisEnter",yC),lw.registerBuiltInAnimate("axisUpdate",bC)}var SC=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=hf.group({zIndex:999});e.name=pT.axisBreak,e.id=this._getNodeId(`${pT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},vT,s),a=null!==(e=r.size)&&void 0!==e?e:vT.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=hf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=pT.axisBreakSymbol;const h=hf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=pT.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=hf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=pT.background,n.id=this._getNodeId("background"),n.states=j({},fT,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=SC(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];P(l)||(c.state={line:j({},fT,l),symbol:j({},fT,l)});const d=new dT(c);d.name=pT.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=SC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},fT,c.text),shape:j({},fT,c.shape),panel:j({},fT,c.background)}});return E.angle=w,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 VT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return NT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),jT(i,t),!zT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=bT(a),l=yT(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=WT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=WT(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);k(i)&&(c=Yt(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&&k(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);UT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&FT(t,{orient:o,method:m,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(k(c)&&(!k(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=hf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pT.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=EM(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=ri(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}}AC.defaultAttributes=mT,G(AC,GT);class kC{isInValidValue(t){const{startAngle:e=tM,endAngle:i=eM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=tM,endAngle:i=eM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return AT(t,i,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 MC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=MC(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 CC=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),k(l)&&l>=3){const t=kT(n,l,c,e,i);h=hf.path(Object.assign(Object.assign({},a.style),{path:MT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=hf.circle(t)}h.name=pT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},fT,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=CC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},fT,d.text),shape:j({},fT,d.shape),panel:j({},fT,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}=MC(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&&TC(e,c,i)}else e.AABBBounds.width()>r&&TC(e,r,i)}else o>a.x&&h.x2>n.x2?(TC(e,n.x2-o,i),r&&wC(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}}EC.defaultAttributes=mT,G(EC,kC);const BC=t=>t.map(((t,e)=>({index:e,value:t}))),PC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},LC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=CM(a),_=t.range();let y=[];for(let i=0;i{IC[t]=!0}));const HC=t=>-Math.log(-t),VC=t=>-Math.exp(-t),NC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,UC=t=>10===t?NC:t===Math.E?Math.exp:e=>Math.pow(t,e),WC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),GC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),YC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function $C(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 XC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function KC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function qC(t,e,i,s){return 1===i&&(i=0),KC(t,i,s)*(e/(1-i))}function ZC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function JC(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]{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 tE{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=ZC(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 eE=Symbol("implicit");class iE extends tE{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=OC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=eE}clone(){const t=(new iE).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!==eE)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 sE(t,e,r,n)}class rE extends iE{constructor(t){super(),this.type=OC.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=qC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:nE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return nE(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 rE(!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:aE}=ni;function oE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=aE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?aE(t,e):e instanceof ei?aE(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):At(Number(t),Number(e))}class lE extends tE{constructor(t=jC,e=jC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jC,this._piecewise=XC,this._interpolate=oE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?JC:XC,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:jC),this.rescale(i)):this._clamp!==jC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 hE=Math.sqrt(50),cE=Math.sqrt(10),dE=Math.sqrt(2),uE=[1,2,5,10],pE=(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=vE(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?fE(0,-(e-1)/s,s):fE((e-1)/s,0,s)},gE=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 pE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pE(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=fE(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=fE(t,e,l);return n&&r.reverse(),r})),vE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uE[0];return i>=hE?s=uE[3]:i>=cE?s=uE[2]:i>=dE&&(s=uE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _E(t,e,i){const s=(e-t)/Math.max(0,i);return vE(s)}function yE(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;e0;){if(s=_E(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function xE(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 SE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AE=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})),kE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=mE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SE(t,e,n):SE(t,e,QC(n)),h=SE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),ME=mt(((t,e,i,s,n)=>yE(s(t),s(e),i).map((t=>QC(n(t))))));class TE extends lE{constructor(){super(...arguments),this.type=OC.Linear}clone(){var t;const e=new TE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return gE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=mE(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(t=10){const e=this.calculateVisibleDomain(this._range);return yE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 CE(t){return e=>-t(-e)}function EE(t=Number.EPSILON){return e=>Math.max(e,t)}class BE extends lE{constructor(){super(WC(10),UC(10)),this.type=OC.Log,this._limit=EE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new BE).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=WC(this._base),s=UC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=HC,this.untransformer=VC):(this._logs=i,this._pows=s,this._limit=EE(),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 jC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return AE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(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))))}}}G(BE,wE);class PE extends TE{constructor(){super(GC(1),YC(1)),this.type=OC.Symlog,this._const=1}clone(){return(new PE).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=GC(t),this.untransformer=YC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return AE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(PE,wE);class LE{constructor(){this.type=OC.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)&&k(+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 LE).domain(this._domain).range(this._range).unknown(this._unknown)}}function RE(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 OE(t,e,i,s,n=!1){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,n,r;if(!DC(t.type))return BC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return BC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=RE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=RE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=RE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=RC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=RC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?DE.greedy:DE.parity;for(;l.length>=3&&wT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;TT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),OE(t,l,a,(e=>TT(e,t,i))),OE(n,l,o,(e=>TT(e,n,i)||!(!a||e===t)&&TT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return BC(m)},DE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&TT(i,t,e)||(i=t,0))))}},FE=(t,e,i,s)=>{const n=RC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},zE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,jE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?BC([s[s.length-1]]):BC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=FE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=VE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=FE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!zE(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?jE(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=CM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=ST(r,AT(s,r,e,n));return o=a,l=AT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 BC(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=NE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WE(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 BC(c)},WE=(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&&PC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},GE=new Uint32Array(33),YE=new Uint32Array(33);YE[0]=0,GE[0]=~YE[0];for(let t=1;t<=32;++t)YE[t]=YE[t-1]<<1|1,GE[t]=~YE[t];function $E(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&GE[31&o]&YE[1+(31&l)])return!0}else{if(i[h]&GE[31&o])return!0;if(i[c]&YE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,GE[31&o]&YE[1+(31&l)]);else for(s(h,GE[31&o]),s(c,YE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,YE[31&a]|GE[1+(31&o)]);else for(n(l,YE[31&a]),n(h,GE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 XE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function KE(t,e,i=!1){return i?XE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function qE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=KE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=XE(t,r)),e.getRange(r)))}function ZE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return ZE(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 ZE(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 ZE(t,e,n,s,h,c)}return!1}const QE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],tB=["top","inside-top","inside"];function eB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const iB={mode:"same-time",duration:300,easing:"linear"};function sB(t){return 3===t||4===t}function nB(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 rB=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 aB(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)}}var oB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const cB=(t,e)=>Math.ceil(t)>Math.floor(e),dB=([t,e],[i,s])=>s>t&&e>i;function uB(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 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);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(sM.hover,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gM(this,(t=>{P(t.states)||(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void gM(this,(t=>{P(t.states)||(t.removeState(sM.selectedReverse),t.removeState(sM.selected))}));P(e.states)||(e.addState(sM.selected,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.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)===Yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Yo.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(Se(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[aB(g,f,c,d,a,o),aB(-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=hf.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.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return LM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&cB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&cB(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(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(uB([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])&&!dB([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 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},h),{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(KE(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(KE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(KE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{fB[t]=e};var vB=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{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,i,s)}}_B.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const yB=()=>{mB("symbol",_B),mB("line-data",_B)};var bB=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{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}}}xB.tag="rect-label",xB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var SB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};AB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const kB=()=>{mB("line",AB),mB("area",AB)};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);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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new TB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):sB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=sB(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=sB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=sB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?sB(t.quadrant)?"left":"right":sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 BB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 PB(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=MT(t,!!n),o=MT(r,!!n);const h=re.distancePP(s,l),c=re.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=BB(e,t,!1,!!n),o=BB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=MT(t,!!n),o=MT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}EB.defaultAttributes={pickable:!1};class LB extends qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.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 ST(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?`${pT.grid}-sub`:`${pT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=MT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BB(t,o,!1,!!a)}const u=hf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:LB.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=MT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=hf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:LB.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}}LB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ok(),Hk();class RB extends LB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LB.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=tM,endAngle:r=eM}=this.attribute;i=kT(t,s,re.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=j({},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})}}G(RB,GT);var OB=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"})}}G(IB,kC);const DB="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",FB={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:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zB={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 jB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={}));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);nt,this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=oM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===jB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===jB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=jB.endHandler):h+=l:this._activeTag===jB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===jB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=oM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===jB.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===jB.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=HB(c,["formatMethod"]),{formatMethod:g}=d,f=HB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},zB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},zB.horizontal),V),{pickable:!U&&(null===(b=V.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},zB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},zB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},zB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},zB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zB.vertical),{pickable:!U}),"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 jM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var UB,WB,GB,YB;function $B(){Ok(),FM(),_w()}NB.defaultAttributes=FB,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"}(UB||(UB={})),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"}(WB||(WB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(GB||(GB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(YB||(YB={}));class XB extends qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=CT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=hf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=hf.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=hf.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 KB(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 qB(t,e,i,s){t&&(KB(t.startSymbol,e,i,s),t.lines.forEach((t=>KB(t,e,i,s))),KB(t.line,e,i,s),KB(t.endSymbol,e,i,s))}function ZB(t,e,i,s){t&&(KB(t.getTextShape(),e,i,s),KB(t.getBgRect(),e,i,s))}function JB(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 QB(t,e,i,s){t&&(JB(t.startSymbol,e,i,s),t.lines.forEach((t=>JB(t,e,i,s))),JB(t.line,e,i,s),JB(t.endSymbol,e,i,s))}function tP(t,e,i,s){t&&(JB(t.getTextShape(),e,i,s),JB(t.getBgRect(),e,i,s))}function eP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;KB(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)})),KB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;KB(t.getTextShape(),e,l,n),KB(t.getBgRect(),e,l,n)}))}function iP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function sP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function nP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function rP(t,e,i,s,n,r){var a;qB(t,n,s,r),KB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?ZB(i,n,s,r):KB(i,n,s,r)}function aP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;KB(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)})),KB(e,n+o+l,h,r),KB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(KB(i.getTextShape(),n+o+l+h+c,d,r),KB(i.getBgRect(),n+o+l+c,d,r)):KB(i,n+o+l+c,d,r)}function oP(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?eP(t,e,s,r,a):"fadeIn"===i&&iP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?eP(t,e,s,n,a):"fadeIn"===i&&iP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function lP(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&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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?rP(n,r,e,i,s,o):"callIn"===t&&aP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?rP(n,r,e,i,s,a):"callIn"===t&&aP(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;QB(t,n,s,r),JB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?tP(i,n,s,r):JB(i,n,s,r)}(n,r,e,t,i,s)}}const dP={type:"clipIn",duration:500,easing:"linear",delay:0},uP={type:"fadeIn",duration:500,easing:"linear",delay:0},pP={type:"callIn",duration:500,easing:"linear",delay:0},gP={type:"fadeOut",duration:500,easing:"linear",delay:0};class fP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new jM(Object.assign(Object.assign({},h),{state:{panel:j({},nM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},nM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},nM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},nM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class mP extends XB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=dP,this.defaultExitAnimation=gP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;DM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(mP,fP);const vP=.001,_P={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:UB.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]}},yP={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"}}},bP={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:{autoRotate:!0,position:GB.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]}},xP={interactive:!0,label:{position:WB.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}},SP={interactive:!0,label:{autoRotate:!0,position:GB.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}},AP={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"}},kP={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"}},MP={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 TP(){wP._animate=oP}$B(),hT(),_w();class wP extends mP{markerAnimate(t){wP._animate&&this._animationConfig&&wP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(mM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return vM(Math.abs(e),Math.PI/2,vP)||vM(Math.abs(e),3*Math.PI/2,vP)?_M(i,e,t):mM(e)?yP.postiveXAxis[t]:yP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new dT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",wP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(wP.defaultAttributes.label)}}function CP(){EP._animate=lP}wP.defaultAttributes=_P,$B(),Nk(),_w();class EP extends XB{markerAnimate(t){EP._animate&&this._animationConfig&&EP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},EP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=hf.polygon(Object.assign({points:e},i));n.states=j({},nM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",EP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},nM,null==i?void 0:i.area)),this._updateMarkLabels(EP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}EP.defaultAttributes=xP,G(EP,fP),$B(),cT(),_w();class BP extends mP{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case GB.arcInnerStart:l=n;case GB.arcOuterStart:l=n;break;case GB.arcInnerEnd:l=r;case GB.arcOuterEnd:l=r;break;case GB.center:case GB.arcInnerMiddle:case GB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return AP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new uT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",BP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(BP.defaultAttributes.label)}}BP.defaultAttributes=bP,$B(),Tk(),_w();class PP extends XB{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case GB.center:h=(s+n)/2,c=(r+a)/2;break;case GB.arcInnerStart:h=s,c=r;break;case GB.arcOuterStart:h=n,c=r;break;case GB.arcInnerEnd:h=s,c=a;break;case GB.arcOuterEnd:h=n,c=a;break;case GB.arcInnerMiddle:h=s,c=(r+a)/2;break;case GB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},AP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=hf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},nM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",PP.defaultAttributes.label)}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=j({},nM,null==o?void 0:o.area)),this._updateMarkLabels(PP.defaultAttributes.label)}isValidPoints(){return!0}}function LP(){RP._animate=cP}PP.defaultAttributes=SP,G(PP,fP),$B(),hT(),cT(),qk(),Dk(),zk(),_w();class RP extends XB{markerAnimate(t){RP._animate&&this._animationConfig&&RP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=gP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return vM(Math.abs(s),Math.PI/2,vP)||vM(Math.abs(s),3*Math.PI/2,vP)?_M(t,s,n):mM(s)?MP.postiveXAxis[n]:MP.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,style:d,position:u=YB.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},nM,null==p?void 0:p.textBackground),text:j({},nM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},nM,null==p?void 0:p.itemContent));const v=mM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=hf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"text"===n?o=new jM(Object.assign(Object.assign({},i),{state:{panel:j({},nM,null==s?void 0:s.textBackground),text:j({},nM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=hf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"image"===n?(o=hf.image(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},nM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=vM(c,0,vP)||vM(d,0,vP),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=OM(e-u,t-d),o=OM(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(NP.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(NP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===NP.focus||"focus"===o){const s=a.hasState(HP.focus);a.toggleState(HP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover,HP.focus],t),this._setLegendItemState(e,HP.selected,t)})):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover,HP.focus],t),this._setLegendItemState(e,HP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(VP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HP.selected,HP.selectedHover],t),this._setLegendItemState(a,HP.unSelected,t)):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t))}else this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover],t),this._setLegendItemState(e,HP.unSelected,t))}))}this._dispatchLegendEvent(VP.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,HP.selected),this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover])):(this._removeLegendItemState(e,[HP.selected,HP.selectedHover]),this._setLegendItemState(e,HP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FP,spaceRow:l=zP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=hf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=hf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,NP.item,t,w)):(w=hf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,NP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?HP.selected:HP.unSelected);const C=hf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=hf.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,NP.itemShape,t,w,S.state),s.addState(e?HP.selected:HP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=hf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,NP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=LM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,NP.itemLabel,t,w,A.state),D.addState(e?HP.selected:HP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=LM(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,NP.itemValue,t,w,k.state),r.addState(e?HP.selected:HP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 DP(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 DP(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 hM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new hM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FP,spaceRow:o=zP}=n,l=this._itemsContainer,{space:h=jP,defaultCurrent:c=1}=r,d=YP(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=hf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FP,spaceRow:a=zP}=s,o=this._itemsContainer,{space:l=jP,defaultCurrent:h=1}=n,c=YP(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 _=hf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=hf.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(HP.selected)?this._setLegendItemState(t,HP.selectedHover,e):this._setLegendItemState(t,HP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===NP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(VP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HP.unSelectedHover)||t.hasState(HP.selectedHover))&&(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HP.unSelectedHover)&&!t.hasState(HP.selectedHover)||(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===NP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(VP.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!==NP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(VP.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!==NP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},$P,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(HP.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 KP;function qP(t){return y(t)?t:[t,t]}function ZP(t){return t?"ew-resize":"ns-resize"}XP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FP,spaceRow:zP,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:jP,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"}(KP||(KP={})),WP();class JP extends qy{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:j({},JP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:qP(d)[0],endValue:qP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=hf.group({x:0,y:0});f.name=KP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=hf.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)),m.name=KP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=hf.group({x:g?v:0,y:g?0:v});f.add(_);const y=hf.group({x:0,y:0});let b;if(y.name=KP.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=hf.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=KP.endText,f.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=hf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KP.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,f]=qP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(v.name=KP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(i.name=KP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=KP.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 f=hf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=KP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":ZP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=hf.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=KP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return hf.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":ZP(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),hf.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=hf.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=hf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===KP.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===KP.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===KP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}JP.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}}},GP(),WP();class QP extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},QP.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tL(t="bottom"){let 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`}QP.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"}}},GP(),WP(),Hk();class eL extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=hf.group({x:0,y:0});this._innerView.add(x);const S=new JP({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:tL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=hf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eL.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)"}},Ok(),Jk(),Yk();let iL=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},rM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},rM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};iL.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 sL={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"}}};Ok(),Jk(),Yk();let nL=class extends qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(sL,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=LM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=EM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 rL extends kg{constructor(t){super(t)}}var aL,oL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aL||(aL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oL||(oL={}));class lL extends qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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"},lL.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"},lL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.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 rL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rL(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(aL.OnPlay)},this.pause=()=>{this._dispatchEvent(aL.OnPause)},this.forward=()=>{this._dispatchEvent(aL.OnForward)},this.backward=()=>{this._dispatchEvent(aL.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()}}lL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lL.defaultAttributes={[oL.Start]:{},[oL.Pause]:{},[oL.Backward]:{},[oL.Forward]:{}};const hL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cL=[200,10];var dL,uL;!function(t){t.Default="default",t.Reverse="reverse"}(dL||(dL={})),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"}(uL||(uL={}));const pL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),fL=t=>"top"===t||"bottom"===t;class mL extends qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(fL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cL[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:cL[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 JP(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=fL(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 lL(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=fL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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:fL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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 vL(){WP(),Ok(),qk()}mL.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({},hL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hL),{key:"backward",position:"start"})}},vL();class _L extends mL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:dL.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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(uL.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(uL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.change),this.dispatchCustomEvent(uL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yL,bL=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())}))};vL();class xL extends mL{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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change))},this.play=()=>bL(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(uL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.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(uL.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.brushActive="brushActive",t.brushClear="brushClear"}(yL||(yL={}));const SL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},AL=5;const kL={debounce:xt,throttle:St};Ok(),Nk();let ML=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=SL.updateTrigger,endTrigger:i=SL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:kL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=SL.trigger,resetTrigger:e=SL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(yL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(yL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=AL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(yL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(yL.brushActive,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._dispatchBrushEvent(yL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=AL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=SL.updateTrigger,endTrigger:e=SL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=hf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};ML.defaultAttributes=SL;const TL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},wL=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}},CL={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:iM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ok(),Wk(),qk(),Jk(),Yk();let BL=class t extends qy{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=ri(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:fM(u)&&fM(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:fM(u)&&fM(u.value)},wL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:fM(u)&&fM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:fM(u)&&fM(u.value)},wL(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},rM),u.value),visible:fM(u)&&fM(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=fM(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 _=fM(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(!fM(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)+(fM(n.key)?r+n.key.spacing:0)+(fM(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&&(RM(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:fM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(fM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=id(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(fM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},wL(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},wL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},rM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(fM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},wL(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},wL(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=>EL.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)&&fM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=fM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=CM(d),_=CM(u);let y=0;if(fM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(fM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&au[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 TL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return TL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};BL.defaultAttributes=CL;const PL=pt;function LL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function OL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function IL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function DL(t,e){const i=IL(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 FL(t,e){const i=zL(t),s=zL(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 zL(t,e={x:0,y:0}){return re.distancePP(t,e)}function jL(t){return k(t.x)&&k(t.y)}function HL(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 VL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const NL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function WL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&WL(t[i],e)}}var GL,YL,$L;function XL(t){var e,i;const{type:s}=t;return s===YL.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(GL||(GL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(YL||(YL={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}($L||($L={}));const KL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},qL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function ZL(t,e){var i;if(!t)return[];const s=nR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?iR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>eR(i)?QL(t,i,e):i)).filter(p)}))):i.map((i=>eR(i)?QL(t,i,e):i)).filter(p):[]}return[]}function JL(t,e){var i,s;return iR(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 QL(t,e,i){var s;const n=nR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=KL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=qL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 tR=(t,e)=>{if(e&&eR(t)){const i=QL(e,t);if(i)return i}return t};function eR(t){return t&&"palette"===t.type&&!!t.key}function iR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function sR(t){return y(t)?{dataScheme:t}:t}function nR(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=XL(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 rR extends iE{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(!iR(this._range))return void super.range(this._range);const t=JL(this._range,this._domain);super.range(t)}}const aR={linear:TE,band:rE,point:class extends rE{constructor(t){super(!1),this.type=OC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:iE,threshold:LE,colorOrdinal:rR};function oR(t){const e=aR[t];return e?new e:null}function lR(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 hR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function cR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function dR(t){return!!_(t)&&(!!t.endsWith("%")&&$y(t.substring(0,t.length-1)))}function uR(t){return!!g(t)&&("percent"in t||"offset"in t)}function pR(t,e,i,s=0){var n,r;return S(t)?t:dR(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 gR(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]=pR(t[s],e.size,i)}))})),o}function fR(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}}function mR(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)||dR(t)||d(t)||uR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function vR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const _R=(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},yR=[{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"]}];function bR(t,e){return t&&e.key in t?t[e.key]:e.default}function xR(t){return t&&"token"===t.type&&!!t.key}const SR={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%"},AR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:yR,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"}}},token:SR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},kR={name:"dark",colorScheme:{default:{dataScheme:yR,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}}}}}},MR=(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]={}),MR(t[s],e.slice(1),i))};function TR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=sR(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)})}wR._charts={},wR._series={},wR._components={},wR._graphicComponents={},wR._marks={},wR._regions={},wR._animations={},wR._implements={},wR._chartPlugin={},wR._vChartPlugin={},wR._componentPlugin={},wR.transforms={fields:Yr,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}},wR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},wR._layout={},wR._grammarTransforms={},wR._stageEventPlugins={},wR.registerStageEventPlugin=(t,e)=>{wR._stageEventPlugins[t]=e},wR.getStageEventPlugin=t=>wR._stageEventPlugins[t],wR._interactionTriggers={},wR.registerInteractionTrigger=(t,e)=>{wR._interactionTriggers[t]=e},wR._composedEventMap={},wR.registerComposedEvent=(t,e)=>{wR._composedEventMap[t]=e},wR._tooltipProcessors={},wR.registerTooltipProcessor=(t,e)=>{wR._tooltipProcessors[t]=e},wR.createTooltipProcessor=(t,e)=>{const i=wR._tooltipProcessors[t];return i?new i(e):null};const BR=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},PR=BR(),LR={[AR.name]:AR},RR=AR.name,OR=new Map(Object.keys(LR).map((t=>[t,LR[t]]))),IR=new Map,DR=new Map(Object.keys(LR).map((t=>[t,t===RR]))),FR=(t,e)=>{if(!t)return;const i=VR(e);OR.set(t,i),DR.set(t,!0)},zR=(t=RR)=>(DR.has(t)&&!DR.get(t)&&FR(t,OR.get(t)),OR.get(t)),jR=t=>OR.delete(t)&&IR.delete(t)&&DR.delete(t),HR=t=>!!_(t)&&OR.has(t),VR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:RR;return CR({},zR(i),t)};class NR{static registerInstance(t){NR.instances.set(t.id,t)}static unregisterInstance(t){NR.instances.delete(t.id)}static getInstance(t){return NR.instances.get(t)}static instanceExist(t){return NR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return NR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}NR.instances=new Map;class UR{static registerTheme(t,e){FR(t,e)}static getTheme(t,e=!1){return zR(t)}static removeTheme(t){return jR(t)}static themeExist(t){return HR(t)}static getDefaultTheme(){return UR.themes.get(RR)}static setCurrentTheme(t){UR.themeExist(t)&&(UR._currentThemeName=t,NR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return UR.getTheme(UR._currentThemeName,t)}static getCurrentThemeName(){return UR._currentThemeName}}function WR(t){return _(t)?UR.themeExist(t)?UR.getTheme(t):{}:g(t)?t:{}}UR.themes=OR,UR._currentThemeName=RR;const GR=["animationThreshold","colorScheme","name","padding"];function YR(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];GR.includes(n)?s[n]=r:m(r)?eR(r)?s[n]=tR(r,e):xR(r)?s[n]=bR(i,r):s[n]=YR(r,e,i):s[n]=r})),s}function $R(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]=$R(t[s],e)}return i}return y(t)?t.map((t=>$R(t,e))):t}function XR(t,e){if(!t)return t;if(m(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}const KR=(t,e,i,s)=>((t,e,i)=>CM(t,e,i,{fontFamily:SR.fontFamily,fontSize:SR.fontSize}))(e,i,s).measure(t),qR="__VCHART",ZR=500,JR=500,QR=`${qR}_MEASURE_CANVAS_ID`,tO=`${qR}_DEFAULT_DATA_INDEX`,eO=`${qR}_DEFAULT_DATA_KEY`,iO=`${qR}_DEFAULT_DATA_SERIES_FIELD`,sO=`${qR}_DEFAULT_SERIES_STYLE_NAME`,nO=`${qR}_STACK_KEY`,rO=`${qR}_STACK_START`,aO=`${qR}_STACK_END`,oO=`${qR}_STACK_START_PERCENT`,lO=`${qR}_STACK_END_PERCENT`,hO=`${qR}_STACK_START_OffsetSilhouette`,cO=`${qR}_STACK_END_OffsetSilhouette`,dO=`${qR}_STACK_TOTAL`,uO=`${qR}_STACK_TOTAL_PERCENT`,pO=`${qR}_STACK_TOTAL_TOP`,gO=`${qR}_STACK_TOTAL_BOTTOM`,fO=`${qR}_MOSAIC_VALUE_START_PERCENT`,mO=`${qR}_MOSAIC_VALUE_END_PERCENT`,vO=`${qR}_MOSAIC_CAT_START_PERCENT`,_O=`${qR}_MOSAIC_CAT_END_PERCENT`,yO=`${qR}_SEGMENT_START`,bO=`${qR}_SEGMENT_END`,xO=`${qR}_KEY`;function SO(t,e){for(let i=0;it.key===e))}function kO(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 MO(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:{}},BO(t,a,n[o],l,e,r))})),s?TO(n):n}function TO(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))):TO(t[e].nodes);return t}function wO(t,e){if("values"in t&&t.values.length){const i=OL(t.values,e),s=RL(t.values,lO);t.values.forEach((t=>{t[dO]=i,t[uO]=s}))}else for(const i in t.nodes)wO(t.nodes[i],e)}function CO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][aO]/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)EO(t.nodes[r],e,i,s,n)}function BO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[aO]=function(t){if(k(t))return t;const e=+t;return k(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)),BO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const PO=(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]=RO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function OO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>FO(t.style(e,i,s,n)):P(t.style)||(e.style=FO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>FO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=FO(t.state[e]))})),e.state=i}return e}function IO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e,s,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}function DO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),FO(i)}function FO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const zO=t=>"line"===t||"area"===t,jO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return zO(i)?e:null==e?void 0:e[0]},HO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let VO=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},n=wR.getComposedEvent(t);if(n){const e=new n(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(wR.getComposedEvent(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()}};var NO;!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"}(NO||(NO={}));const UO=["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 WO,GO,YO;t.ChartEvent=void 0,(WO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",WO.rendered="rendered",WO.renderFinished="renderFinished",WO.animationFinished="animationFinished",WO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",WO.afterInitData="afterInitData",WO.afterInitEvent="afterInitEvent",WO.afterInitMark="afterInitMark",WO.rawDataUpdate="rawDataUpdate",WO.viewDataFilterOver="viewDataFilterOver",WO.viewDataUpdate="viewDataUpdate",WO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",WO.markDeltaYUpdate="markDeltaYUpdate",WO.viewDataLabelUpdate="viewDataLabelUpdate",WO.scaleDomainUpdate="scaleDomainUpdate",WO.scaleUpdate="scaleUpdate",WO.dataZoomChange="dataZoomChange",WO.drill="drill",WO.layoutStart="layoutStart",WO.layoutEnd="layoutEnd",WO.layoutRectUpdate="layoutRectUpdate",WO.playerPlay="playerPlay",WO.playerPause="playerPause",WO.playerEnd="playerEnd",WO.playerChange="playerChange",WO.playerForward="playerForward",WO.playerBackward="playerBackward",WO.scrollBarChange="scrollBarChange",WO.brushStart="brushStart",WO.brushChange="brushChange",WO.brushEnd="brushEnd",WO.brushClear="brushClear",WO.brushActive="brushActive",WO.legendSelectedDataChange="legendSelectedDataChange",WO.legendFilter="legendFilter",WO.legendItemClick="legendItemClick",WO.legendItemHover="legendItemHover",WO.legendItemUnHover="legendItemUnHover",WO.tooltipShow="tooltipShow",WO.tooltipHide="tooltipHide",WO.tooltipRelease="tooltipRelease",WO.afterResize="afterResize",WO.afterRender="afterRender",WO.afterLayout="afterLayout",WO.afterMarkLayoutEnd="afterMarkLayoutEnd",WO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(GO||(GO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(YO||(YO={}));const $O=[YO.mark,YO.model,YO.chart,YO.vchart];class XO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(YO.vchart,[]),this._levelNodes.set(YO.chart,[]),this._levelNodes.set(YO.model,[]),this._levelNodes.set(YO.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 KO={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 qO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>jO(t)))};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)||GO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||GO.chart);o.get(t)||o.set(t,new XO);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)||GO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||GO.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)||GO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||GO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i<$O.length;)n=this._invoke(s.getHandlers($O[i]),t,e),i++}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?$O.indexOf(t.filter.level)<$O.indexOf(e.level)&&t.callback!==e.handler&&s.preventHandler(t):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(){[GO.chart,GO.window,GO.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&&L(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 KO[a]&&(a=KO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?YO.model:YO.vchart:YO.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=GO.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!==YO.model&&s!==YO.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=YO.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 GO.chart:return this._viewBubbles;case GO.window:return this._windowBubbles;case GO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case GO.chart:return this._viewListeners;case GO.window:return this._windowListeners;case GO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return UO.includes(t)||Object.values(NO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&wR.hasInteractionTrigger(e)}}function ZO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QO=new Map;let tI;function eI(){tI||(tI=new Ta,JO(tI,"geojson",ba),JO(tI,"topojson",Sa),ZO(tI,"simplify",Wr))}function iI(t,e,i={type:"geojson",centroid:!0}){QO.has(t)&&Fy(`map type of '${t}' already exists, will be overwritten.`),eI();const s=new wa(tI),n=j({},{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}),QO.set(t,s)}function sI(t){QO.has(t)?QO.delete(t):Fy(`map type of '${t}' does not exists.`)}function nI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const rI=(t,e)=>0===t.length?[]:1===t.length?nI(t[0],null==e?void 0:e.deep):t.map((t=>nI(t,null==e?void 0:e.deep)));function aI(e,i,s){ZO(i=i instanceof Ta?i:e.dataSet,"copyDataView",rI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function oI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Fy(`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 Fy(`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([]),Fy("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 lI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var hI,cI,dI,uI;t.TransformLevel=void 0,(hI=t.TransformLevel||(t.TransformLevel={}))[hI.copyDataView=-10]="copyDataView",hI[hI.treemapFilter=-8]="treemapFilter",hI[hI.treemapFlatten=-7]="treemapFlatten",hI[hI.dotObjFlat=-7]="dotObjFlat",hI[hI.linkDotInfo=-7]="linkDotInfo",hI[hI.sankeyLayout=-7]="sankeyLayout",hI[hI.dataZoomFilter=-6]="dataZoomFilter",hI[hI.legendFilter=-5]="legendFilter",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"}(cI||(cI={})),function(t){t.data="data",t.mark="mark"}(dI||(dI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(uI||(uI={}));const pI=["line","area","trail"];function gI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(xO,i?t.slice().sort(i):t.slice()),{keys:[xO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const fI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function mI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{mI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function _I(t,e,i,s){const n=gI(t,(t=>i(t))),r=gI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 yI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Ep({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Uy(o))&&!1!==c&&wR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=uI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>mI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>mI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{mI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Dy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===uI.before&&(this._layoutState=uI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=uI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Dy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=vI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=_I(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=_I(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=gI(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=gI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===GO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:jO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===GO.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===GO.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===GO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===GO.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===GO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{mI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=vI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Ny(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return _u(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{yo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{mI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function bI(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:zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function xI(t){t.crosshair=Y(t.crosshair||{}).map((e=>TR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function SI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Ny(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Wy(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 AI(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 kI(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}}var MI,TI,wI,CI,EI,BI;t.LayoutZIndex=void 0,(MI=t.LayoutZIndex||(t.LayoutZIndex={}))[MI.SeriesGroup=0]="SeriesGroup",MI[MI.Axis_Grid=50]="Axis_Grid",MI[MI.CrossHair_Grid=100]="CrossHair_Grid",MI[MI.Region=450]="Region",MI[MI.Mark=300]="Mark",MI[MI.Node=400]="Node",MI[MI.Axis=100]="Axis",MI[MI.MarkLine=500]="MarkLine",MI[MI.MarkArea=100]="MarkArea",MI[MI.MarkPoint=500]="MarkPoint",MI[MI.DataZoom=500]="DataZoom",MI[MI.ScrollBar=500]="ScrollBar",MI[MI.Player=500]="Player",MI[MI.Legend=500]="Legend",MI[MI.CrossHair=500]="CrossHair",MI[MI.Indicator=500]="Indicator",MI[MI.Title=500]="Title",MI[MI.Label=500]="Label",MI[MI.Brush=500]="Brush",MI[MI.CustomMark=500]="CustomMark",MI[MI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(TI=t.LayoutLevel||(t.LayoutLevel={}))[TI.Indicator=10]="Indicator",TI[TI.Region=20]="Region",TI[TI.Axis=30]="Axis",TI[TI.DataZoom=40]="DataZoom",TI[TI.Player=40]="Player",TI[TI.ScrollBar=40]="ScrollBar",TI[TI.Legend=50]="Legend",TI[TI.Title=70]="Title",TI[TI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(wI=t.AttributeLevel||(t.AttributeLevel={}))[wI.Default=0]="Default",wI[wI.Theme=1]="Theme",wI[wI.Chart=2]="Chart",wI[wI.Base_Series=3]="Base_Series",wI[wI.Series=4]="Series",wI[wI.Mark=5]="Mark",wI[wI.User_Chart=6]="User_Chart",wI[wI.User_Series=7]="User_Series",wI[wI.User_Mark=8]="User_Mark",wI[wI.User_SeriesStyle=9]="User_SeriesStyle",wI[wI.Built_In=99]="Built_In";class PI{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({},PI.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]))))}}PI.defaultMarkInfo={};class LI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class RI{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=>TR({},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 OI extends LI{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=RI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new PI,this._lastLayoutRect=null,this.id=Yy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new VO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${qR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=wR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class II{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=gR(mR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:pR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:pR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:pR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:pR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:pR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:pR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=pR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=pR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=pR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(fR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class DI extends OI{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,this._transformLayoutPadding=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 II(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 FI extends RI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zI extends DI{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(e,i){var s;super(e,i),this.transformerConstructor=FI,this.modelType="region",this.specKey="region",this.type=zI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function jI(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 HI(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 VI(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 NI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),VI(d,!0,p,l),s&&HI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function UI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=YI(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),VI(d,!1,p,o),s&&HI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function GI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=YI(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=YI(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"left",s),r.length&&NI(r,e,i,!0,"left",s),a.length&&UI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"top",s),r.length&&WI(r,e,i,!0,"top",s),a.length&&GI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"right",s),r.length&&NI(r,e,i,!0,"right",s),a.length&&UI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"bottom",s),r.length&&WI(r,e,i,!0,"bottom",s),a.length&&GI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=YI(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=YI(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:zy)("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}}}$I.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(CI||(CI={})),t.STATE_VALUE_ENUM=void 0,(EI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",EI.STATE_HOVER="hover",EI.STATE_HOVER_REVERSE="hover_reverse",EI.STATE_DIMENSION_HOVER="dimension_hover",EI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",EI.STATE_SELECTED="selected",EI.STATE_SELECTED_REVERSE="selected_reverse",EI.STATE_SANKEY_EMPHASIS="selected",EI.STATE_SANKEY_EMPHASIS_REVERSE="blur",EI.STATE_HIGHLIGHT="highlight",EI.STATE_BLUR="blur",EI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(BI||(BI={}));const XI=["linear","radial","conical"],KI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const qI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{qI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class ZI extends LI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class JI extends ZI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,pI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!qI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(qR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(qR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(DC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class QI extends LI{constructor(){super(...arguments),this.id=Yy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=wR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class tD extends QI{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const eD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,iD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=eD(l.delay,n,a,o),d=eD(l.duration,n,a,o),u=eD(l.oneByOne,n,a,o),p=eD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Rw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ew(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Pw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Yo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kw,null!==(l=i.easing)&&void 0!==l?l:Mw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Ow({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Mw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Rw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},sD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},nD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class rD extends QI{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new tD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Ep("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Hl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new JI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&TR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(FC(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=oR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):XI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):FC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=JL(ZL(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({},KI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)XI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=JL(ZL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return gI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return wR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[eO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=gI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{nD(t),s.push(...t.getGraphics())})),e.forEach((t=>{nD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);iD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=sD(e,n),r=sD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===cI.exit?cI.exit:i===cI.update?cI.update:cI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===CI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===CI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=CI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=CI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=CI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=cI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=cI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return fI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=fI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=HO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=wR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=wR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===uI.before||(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===CI.exit&&!e.isExiting)if(e.context.animationState===CI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Ep({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var aD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(aD||(aD={}));class oD extends rD{constructor(){super(...arguments),this.type=oD.type,this._marks=[],this._diffState=CI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Fy("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?(Fy("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))}getMarkInUserId(t){let e;return mI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===CI.update){const t=this.hasAnimation(),e=HO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=CI.update}render(){this._isCommited&&(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}oD.type="group";const lD={measureText:KR};class hD{static instance(){return hD.instance_||(hD.instance_=new hD),hD.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 cD{constructor(){this.id=Yy(),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))?Fy("不要重复添加相同的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 dD extends cD{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}}const uD={type:"fadeIn"};function pD(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 uD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const gD={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"}},fD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},mD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},vD=()=>{wR.registerAnimation("scaleInOut",(()=>fD))},_D=()=>{wR.registerAnimation("fadeInOut",(()=>mD))},yD=(t,e)=>({appear:pD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Nw,duration:gD.update.duration,easing:gD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),bD=()=>{wR.registerAnimation("line",yD)},xD=()=>{lw.registerBuiltInAnimate("growPointsIn",nC),lw.registerBuiltInAnimate("growPointsOut",rC),lw.registerBuiltInAnimate("growPointsXIn",oC),lw.registerBuiltInAnimate("growPointsXOut",lC),lw.registerBuiltInAnimate("growPointsYIn",cC),lw.registerBuiltInAnimate("growPointsYOut",dC),lw.registerBuiltInAnimate("clipIn",Gw),lw.registerBuiltInAnimate("clipOut",Yw)},SD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class AD{constructor(t){this._markSet=new PI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 kD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class MD extends AD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},kD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}MD.type="element-highlight",MD.defaultOptions=kD;const TD=()=>{wR.registerInteractionTrigger(MD.type,MD)},wD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class CD extends AD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},wD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}CD.type="element-select",CD.defaultOptions=wD;const ED=()=>{wR.registerInteractionTrigger(CD.type,CD)};class BD extends cD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class PD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>wR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>wR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>wR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return wR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>wR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){wR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}static getFunction(t){return t?hD.instance().getFunction(t):null}static getFunctionList(){return hD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=wR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=wR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,QO.get(e);var e}static registerSVG(t,e,i){const s=wR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=wR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){NR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Yy(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=AI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?wR.getSeriesBuiltInTheme(e):wR.getComponentBuiltInTheme(e);i=i?TR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=YR({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},WL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Ny(v);if(S?ix(vo):"node"===v&&sA(vo),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=UR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new yI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new qO(this,this._compiler),this._event=new VO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),NR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=TR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=$R(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;PD.getFunctionList()&&PD.getFunctionList().length&&(t=XR(t,PD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=wR.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=wR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=wR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 SI(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:ZR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:JR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,JO(this._dataSet,"dataview",Aa),JO(this._dataSet,"array",s),ZO(this._dataSet,"copyDataView",rI);for(const t in wR.transforms)ZO(this._dataSet,t,wR.transforms[t]);for(const t in wR.dataParser)JO(this._dataSet,t,wR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?cI.none:cI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,NR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=oI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?TR({},t[n][e.index],i):i):t[n]=s?TR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?TR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?TR({},t[n],i):i)}))}(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=TR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=CR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=WR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}else{const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(VM.poptip,HM,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=!!Ny(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.getTheme("background")||this._option.background}getCurrentTheme(){return WR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!UR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 bI(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(!Ny(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?vR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Fy("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?vR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Fy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return hD.instance().getFunction(t)}registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}getFunctionList(){return hD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=wR.getChartPlugins();t.length>0&&(this._chartPlugin=new dD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=wR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new BD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}PD.InstanceManager=NR,PD.ThemeManager=UR,PD.globalConfig={uniqueTooltip:!0},PD.Utils=lD,PD.vglobal=b_;wR.registerRegion("region",zI),wR.registerLayout("base",$I),Xk(),Ok(),wR.registerMark(oD.type,oD),wR.registerStageEventPlugin("gesture",Mb),TD(),ED(),FR(kR.name,kR);const LD="monotone",RD="linear",OD="bevel";function ID(t,e){return e("component",t)}function DD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=wR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const FD=(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},zD=(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)))},jD=(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},HD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=DD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VD=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const ND=(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 UD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=GD(HD(h,r,a,c),d,g),o.value=GD(HD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=HD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function WD(t,e,i,s,n,r,a){if(d(e)){UD(t,e(n,a),i,s,r,a)}else e&&UD(t,e,i,s,r,a)}const GD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class YD{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 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=>{y(t)?t.forEach((t=>{WD(a,t,e,i,s,n,r)})):d(t)?WD(a,t,e,i,s,n,r):t&&UD(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:HD(r.visible,t,n),value:GD(HD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:HD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=HD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&ND(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 $D={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}},XD=(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=SO([],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 KD(a,n,o)},KD=(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)=>{$y(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=>{$y(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$D[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},qD=(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=>{$y(t[e])||(t[e]=0)}))})),t},ZD=`${qR}_HIERARCHY_DEPTH`,JD=`${qR}_HIERARCHY_ROOT`,QD=`${qR}_HIERARCHY_ROOT_INDEX`;function tF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function eF(t,e,i){t&&(i.needDefaultSeriesField&&(t[iO]=i.defaultSeriesField),t[tO]=e,t[eO]=i.getKey(t,e,i))}function iF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function sF(t,e,i,s=0,n,r){void 0===r&&(r=e),eF(t,e,i),t[ZD]=s,t[JD]=n||t[i.categoryField],t[QD]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>sF(e,s,i,t[ZD]+1,t[JD],r)))}const nF={label:{name:"label",type:"text"}},rF=`${qR}_rect_x`,aF=`${qR}_rect_x1`,oF=`${qR}_rect_y`,lF=`${qR}_rect_y1`,hF={data:!0},cF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},dF=[...Object.keys(gD),"normal"];function uF(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 vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=TR({},o[e],a);return vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function pF(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;const i=["custom","customParameters"];return t=I(t,null,i),_F(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}),i),t}(h,i)}function gF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function fF(t,e){var i;return null!==(i=null==t?void 0:t[tO])&&void 0!==i?i:e.context.graphicIndex}function mF(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 vF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _F(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),_F(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),_F(t[s],e,i))}function yF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class bF extends RI{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=XL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=wR.getSeriesMarkMap(o)?function(t,e,i){const s=wR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=TR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return TR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=TR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>TR({},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 xF extends OI{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:`${qR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=bF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=yF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(ZO(this._rawData.dataSet,"invalidTravel",qD),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=oI(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=aI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=aI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new tD(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=KD(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(){ZO(this._dataSet,"dimensionStatistics",XD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&SO(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){ZO(this._dataSet,"dimensionStatistics",XD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=SO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&SO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=uF({},pF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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)||Wy(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=TR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=TR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=SD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=SD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=SD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:iO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:sO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,sO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new YD(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},hF),cF),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=>cF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||lI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();yF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:iO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new rR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return ZL(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:iO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,TR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:eO}_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!==aO&&t!==lO&&t!==rO&&t!==oO||(t=this.getStackValueField()),null!==(e=kO(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=>$y(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:iO]}}function SF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();DC(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 AF(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}}}xF.mark=nF,xF.transformerConstructor=bF;class kF extends xF{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);DC(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:`${qR}_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(aO),this.setFieldX2(rO)):(this.setFieldY(aO),this.setFieldY2(rO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(lO),this.setFieldX2(oO)):(this.setFieldY(lO),this.setFieldY2(oO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(cO),this.setFieldX2(hO)):(this.setFieldY(cO),this.setFieldY2(hO))}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(t.ChartEvent.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)&&(SF("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)}}function MF(t){return"bottom"===t||"top"===t}function TF(t){return"left"===t||"right"===t}function wF(t){return"z"===t}function CF(t,e){return cR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function EF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function BF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?MF(t)?"linear":"band":MF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const PF=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):["linear","log","symlog"].includes(e)?ID("axisLinear",i):{})&&void 0!==s?s:{},r=MF(t)?ID("axisX",i):TF(t)?ID("axisY",i):ID("axisZ",i);return TR({},ID("axis",i),n,r)};class LF{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:zy)("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:zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>zC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return MF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class RF extends LF{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:GO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const OF=(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))},IF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},DF=(t,e,i,s)=>{var n;const r=e.getScale(),a=zC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:FF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,zF=(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};class jF extends LF{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)=>!OF(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:GO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:GO.canvas}),callback:this.onMouseOut}),Uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:GO.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})}}var HF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(HF||(HF={}));const VF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class NF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(VF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:OD,curveType:RD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===LD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(VF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:mF(this._spec,VF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${qR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[VF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,TR({},this._spec[VF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const UF=Object.assign(Object.assign({},nF),VF),WF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>WF(t,e[i])));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]))},GF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class YF extends rD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return GF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(FC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?WF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[eO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class $F extends YF{constructor(){super(...arguments),this.type=$F.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)===YL.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}$F.type="line";const XF=()=>{wR.registerMark($F.type,$F),Xk(),zk(),kB(),yB(),xD(),wR.registerGraphicComponent("line",Cg)};class KF extends rD{constructor(){super(...arguments),this.type=KF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}KF.type="symbol";const qF=()=>{wR.registerMark(KF.type,KF),Xk(),qk(),yB(),wR.registerGraphicComponent("symbol",Mg)};class ZF extends bF{_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 JF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function QF(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:!k(o.min),extendable_max:!k(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 tz(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 ez(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 iz(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 sz(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 nz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return BC(v)};class rz{constructor(t){this.id=Yy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class az extends rz{constructor(){super(az.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!DC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&JF(c)&&JF(d)))return;const u=QF(t,c),p=QF(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!ez(u,p))return}else if(0===y&&0===b){if(!ez(p,u))return}else if(_||A)if(_&&!A){if(!tz(u,p))return}else if(A&&!_){if(!tz(p,u))return}else{if(f===b)return;if(f>b){if(!iz(u,p))return}else if(!iz(p,u))return}else{if(0===f&&0===y){if(!sz(u,p))return}else if(0===b&&0===g&&!sz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){ZO(e.getOption().dataSet,"tickAlign",nz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}az.pluginType="component",az.type="AxisSyncPlugin";const oz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function lz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function hz(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 cz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const dz=t=>"band"===t||"ordinal"===t||"point"===t;function uz(t,e){return{id:t,label:t,value:e,rawValue:t}}function pz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class gz extends cD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const fz=`${qR}_ARC_TRANSFORM_VALUE`,mz=`${qR}_ARC_RATIO`,vz=`${qR}_ARC_START_ANGLE`,_z=`${qR}_ARC_END_ANGLE`,yz=`${qR}_ARC_K`,bz=`${qR}_ARC_MIDDLE_ANGLE`,xz=`${qR}_ARC_QUADRANT`,Sz=`${qR}_ARC_RADIAN`,Az=-Math.PI/2,kz=3*Math.PI/2,Mz=.6,Tz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},wz=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):"linear"===e?ID("axisLinear",i):{})&&void 0!==s?s:{},r=ID("angle"===t?"axisAngle":"axisRadius",i);return TR({},ID("axis",i),n,r)};function Cz(t,e,i,s){switch(t){case r.cartesianBandAxis:return PF(CF(i,["z"]),"band",e);case r.cartesianLinearAxis:return PF(CF(i,["z"]),"linear",e);case r.cartesianLogAxis:return PF(CF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return PF(CF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return PF(CF(i),void 0,e);case r.polarBandAxis:return wz(i.orient,"band",e);case r.polarLinearAxis:return wz(i.orient,"linear",e);case r.polarAxis:return wz(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>MF(t.orient)));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>TF(t.orient)));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Ez(i,ID(t,e));default:return ID(t,e)}}const Ez=(t,e)=>{var i;const s=TR({},e,e[EF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Bz extends RI{getTheme(t,e){return Cz(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({},mR(e)),{[s]:0}))}}class Pz extends DI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Bz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Ic||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:GO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 gz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Lz,Rz;Pz.transformerConstructor=Bz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Lz||(Lz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Rz||(Rz={}));class Oz extends rD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=wR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(NO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Oz.type="component";const Iz=()=>{wR.registerMark(Oz.type,Oz)},Dz=t=>t;class Fz extends Pz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Lz.circleAxis:Lz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Rz.circleAxisGrid:Rz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=uF(null===(h=wR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new tD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return HL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?DC(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 HL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=VL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(HL(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=OO(s=t.domainLine)).startSymbol=OO(s.startSymbol),s.endSymbol=OO(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 FO(TR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:FO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 FO(TR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:FO(t.tick.style)),t.tick.state&&(i.tick.state=IO(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 FO(TR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:FO(t.subTick.style)),t.subTick.state&&(i.subTick.state=IO(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=oz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:TR({},d,FO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:FO(h.style)}),h.state&&(i.title.state.shape=IO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:FO(o.style)}),o.state&&(i.title.state.background=IO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=IO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=FO(t.background.style)),t.background.state&&(i.panel.state=IO(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 FO(TR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:FO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:FO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=DD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){JO(this._option.dataSet,"scale",Dz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===pT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Fz.specKey="axes";const zz=()=>{Iz(),wR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},jz=[az];class Hz extends Fz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),HL(this._regions,(t=>{const e=this.getOrient();MF(e)?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):TF(e)?pz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):wF(e)&&pz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=TR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(TR({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=MF(this.getOrient()),n=t=>{var e;return(s?!MF(t.getOrient()):MF(t.getOrient()))&&DC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=CF(i,["z"]),wF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!cz(e))return null;const{axisType:t,componentName:s}=BF(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=>TF(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(!cz(t))return;const{axisType:s,componentName:n}=BF(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=wR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return MF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):wF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(jz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){MF(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&&!MF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!wF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;TF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=MF(this.getOrient())?t.fieldX:wF(this.getOrient())?t.fieldZ:t.fieldY,DC(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:DC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(NO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(MF(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=MF(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)}))}collectScale(){const t=[];return HL(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]:MF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:wF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HL(this._regions,(e=>{MF(t)?pz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):TF(t)?pz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):wF(t)&&pz(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=MF(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=MF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=TR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=MF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return uz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:DC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Hz.type=r.cartesianAxis,Hz.specKey="axes";const Vz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Nz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Wz=(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 Gz(t,e,i="count"){const s=Wz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Yz=Math.sqrt(50),$z=Math.sqrt(10),Xz=Math.sqrt(2);class Kz{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=hz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=MF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Uz),e.sort(Uz),{domain:Nz(t,e),scope:Gz(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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}=hz(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>=Yz?10:n>=$z?5:n>=Xz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const qz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Zz={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}}},Jz={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}}},Qz={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}}};class tj extends Hz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!wF(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=MF(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=dR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 ZO(this._option.dataSet,t,IE),t}}tj.type=r.cartesianLinearAxis,tj.specKey="axes",tj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(tj,Kz);const ej=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(tj.type,tj)};class ij{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new tD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=uz(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=>uz(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 sj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class nj extends Hz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,HE),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=qC(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{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(nj.type,nj,!1)};class aj extends tj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{MF(this.getOrient())?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):pz(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=TR({},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 wa(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 tD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>uz(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=>uz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}aj.type=r.cartesianTimeAxis,aj.specKey="axes",aj.builtInTheme={axis:Qz,axisX:Zz,axisY:Jz};class oj extends tj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new BE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}oj.type=r.cartesianLogAxis,oj.specKey="axes",oj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(oj,Kz);class lj extends tj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}lj.type=r.cartesianSymlogAxis,lj.specKey="axes",lj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(lj,Kz);const hj=`${qR}_hide_`;function cj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const dj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[hj]&&(cj(t,!0),t[hj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[hj]=!0,cj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},uj=()=>{wR.registerGrammarTransform("symbolOverlap",{transform:dj,runType:"afterEncode"})},pj={min:K,max:X,average:IL,sum:OL};function gj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function fj(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 mj(t,e,i,s){return fj(t,e,i,"min",s)}function vj(t,e,i,s){return fj(t,e,i,"max",s)}function _j(t,e,i,s){return fj(t,e,i,"average",s)}function yj(t,e,i,s){return fj(t,e,i,"sum",s)}const bj=(t,e)=>{let i=d(t.size)?t.size():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=gj;if("min"===n?l=mj:"max"===n?l=vj:"average"===n?l=_j:"sum"===n&&(l=yj),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[]},xj=()=>{wR.registerGrammarTransform("dataSampling",{transform:bj})};class Sj extends kF{constructor(){super(...arguments),this.type=YL.line,this.transformerConstructor=ZF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(uF(null===(i=wR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Sj.type=YL.line,Sj.mark=UF,Sj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Sj.transformerConstructor=ZF,G(Sj,NF);class Aj{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)=>{lI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];Fy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Fy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class kj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{SO(e,[{key:t,operations:DC(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&&SO(e,[{key:i.field,operations:DC(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?oR("colorOrdinal"):oR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:U(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=DC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=DC(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;DC(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(DC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=DC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));DC(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 Mj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Tj extends LI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Yy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ZR,height:JR},this._viewRect={width:ZR,height:JR},this._viewBox={x1:0,y1:0,x2:ZR,y2:JR},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=mR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new VO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Aj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Mj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=wR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=wR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=wR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof OI)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 rD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof rD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&lI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=SI(this._spec,this._option,{width:ZR,height:JR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=ZL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new kj(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){AI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=ZL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{AI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,AI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):AI(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()];AI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=gR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NO.AFTER_MARK_RENDER_END,e)};this._event.on(NO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:jO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(zO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===HF.dimensionHover||s===HF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>zC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const wj=(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 Cj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):MR(t,a,c.spec),MR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=wj(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=wj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(wR.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(wR.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=wR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=wR.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=wR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):FD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=FD(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"];return 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}))}_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 Ej extends Cj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&TR(i,kI(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 Bj extends Ej{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),xI(t)}}const Pj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=MO(t,!0);for(const e in o)for(const i in o[e].nodes)EO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)CO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&wO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Rj{_beforeInit(){this._dataSet&&ZO(this._dataSet,"stackSplit",Pj)}_initStack(){this._stack=new Lj(this),this._stack.init()}}const Oj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:HF.dimensionHover};class Ij extends AD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Oj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=jO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Ij.type="dimension-hover",Ij.defaultOptions=Oj;const Dj=()=>{wR.registerInteractionTrigger(Ij.type,Ij)},Fj=()=>{wR.registerComposedEvent(HF.dimensionHover,jF),wR.registerComposedEvent(HF.dimensionClick,RF)},zj=t=>t.fieldX[0],jj=t=>t.fieldY[0],Hj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Vj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Nj=(t,e)=>t?e?zj:Hj:e?jj:Vj,Uj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=zF(t,(t=>MF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=zF(t,(t=>TF(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=>{zC(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=Wj(t,i,Nj(e,zC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Wj(t,i,Nj(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},Wj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Gj(t,s,i)},Gj=(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=DF(e,t,"cartesian",null!=i?i:MF(t.getOrient())?zj:jj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},Yj=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(zC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(DC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=lz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Xj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&$j(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),$j=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=DD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Xj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},Kj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},qj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Zj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return Yj(c,r,e),c.xField.cacheInfo?Kj(c.xField):c.yField.cacheInfo?Kj(c.yField):void 0},Jj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],Qj=(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])&&Jj.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(tH(s).every((t=>{var e;return!ND("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},tH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},eH={dom:`${qR}_TOOLTIP_HANDLER_DOM`,canvas:`${qR}_TOOLTIP_HANDLER_CANVAS`},iH={key:"其他",value:"..."};var sH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sH||(sH={}));class nH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=Qj(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({},iH),t):iH;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)&&ND(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 rH extends nH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!zC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aH=()=>{wR.registerTooltipProcessor("dimension",rH)};class oH extends nH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Go.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(jO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lH=()=>{wR.registerTooltipProcessor("mark",oH)};class hH extends nH{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 cH=()=>{wR.registerTooltipProcessor("group",hH)};class dH extends Tj{constructor(){super(...arguments),this.transformerConstructor=Bj,this.type="line",this.seriesType=YL.line}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}dH.type="line",dH.seriesType=YL.line,dH.transformerConstructor=Bj,G(dH,Rj);const uH=[...GF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class pH extends YF{constructor(){super(...arguments),this.type=pH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return uH}_getIgnoreAttributes(){return[]}}pH.type="area";const gH=()=>{wR.registerMark(pH.type,pH),Xk(),Ck(),kB(),yB(),xD(),wR.registerGraphicComponent("area",Qg)};class fH extends YD{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 mH=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}}),vH=()=>{wR.registerAnimation("area",yD),bD(),vD()};class _H extends ZF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=TR({},f.style,g.style),l.state=TR({},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 yH extends kF{constructor(){super(...arguments),this.type=YL.area,this.transformerConstructor=_H,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(yH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===LD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return lR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[aO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(uF(null===(e=wR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("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 fH(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(){super.onLayoutEnd(),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}}}yH.type=YL.area,yH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},yH.mark=mH,yH.transformerConstructor=_H,G(yH,NF);class bH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(t)}}class xH extends Tj{constructor(){super(...arguments),this.transformerConstructor=bH,this.type="area",this.seriesType=YL.area}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}xH.type="area",xH.seriesType=YL.area,xH.transformerConstructor=bH,G(xH,Rj);function SH(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 AH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SH(t,e)}),kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SH(t,e)}),MH={type:"fadeIn"},TH={type:"growCenterIn"};function wH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MH;case"scaleIn":return TH;default:return AH(t)}}class CH extends rD{constructor(){super(...arguments),this.type=CH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CH.type="rect";const EH=()=>{Xk(),Wk(),mB("rect",xB),wR.registerMark(CH.type,CH),lw.registerBuiltInAnimate("growHeightIn",tC),lw.registerBuiltInAnimate("growHeightOut",eC),lw.registerBuiltInAnimate("growWidthIn",vC),lw.registerBuiltInAnimate("growWidthOut",_C),lw.registerBuiltInAnimate("growCenterIn",Zw),lw.registerBuiltInAnimate("growCenterOut",Jw),wR.registerGraphicComponent("rect",Lg)},BH=Object.assign(Object.assign({},nF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function PH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=_R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[rF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):lR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):lR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=lR(this._dataToPosX(t),e,i),n=lR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[oF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):lR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):lR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=lR(this._dataToPosY(t),e,i),n=lR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},OH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:mF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(OH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(ZO(this._option.dataSet,"addVChartProperty",jD),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};ZO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new tD(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=lF,s=oF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=aF,s=rF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=MO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PH(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=lR(this[r](t),l,i),u=lR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[rO],n=t[aO],r=t[oO],h=t[lO];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]),{[rO]:i,[aO]:s}),a?{[oO]:o,[lO]: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(Lg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>lR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>lR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=AF(this);this._barMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pF(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=_R(this._spec.barWidth,a)),l&&(c=Math.max(c,_R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,_R(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=_R(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=DC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}OH.type=YL.bar,OH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},OH.mark=BH,OH.transformerConstructor=RH;const IH=()=>{xj(),EH(),wR.registerAnimation("bar",((t,e)=>({appear:wH(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t)}))),rj(),ej(),wR.registerSeries(OH.type,OH)};class DH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(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 FH extends Tj{constructor(){super(...arguments),this.transformerConstructor=DH,this.type="bar",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}FH.type="bar",FH.seriesType=YL.bar,FH.transformerConstructor=DH,G(FH,Rj);const zH=[10,20],jH=OC.Linear,HH="circle",VH=OC.Ordinal,NH=["circle","square","triangle","diamond","star"],UH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},WH=Object.assign(Object.assign({},nF),{point:{name:"point",type:"symbol"}});class GH extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class YH extends kF{constructor(){super(...arguments),this.type=YL.scatter,this.transformerConstructor=GH,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=`${qR}_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=`${qR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:jH,defaultRange:zH},"size")}getShapeAttribute(t,e){return u(e)?HH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VH,defaultRange:NH},"shape")}initMark(){this._symbolMark=this._createMark(YH.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,YH.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=AF(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(uF(null===(i=wR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:HH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}YH.type=YL.scatter,YH.mark=WH,YH.builtInTheme={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"}}}}},YH.transformerConstructor=GH;const $H=()=>{qF(),wR.registerAnimation("scatter",((t,e)=>Object.assign({appear:UH(0,e)},fD))),rj(),ej(),wR.registerSeries(YH.type,YH)};class XH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class KH extends Tj{constructor(){super(...arguments),this.transformerConstructor=XH,this.type="scatter",this.seriesType=YL.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}KH.type="scatter",KH.seriesType=YL.scatter,KH.transformerConstructor=XH,G(KH,Rj);class qH extends xF{constructor(){super(...arguments),this.type=YL.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=`${qR}_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 ZH=`${qR}_MAP_LOOK_UP_KEY`,JH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[tO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[ZH]=e.nameMap[n]:t[ZH]=n})),t.features);class QH extends YD{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 tV extends rD{constructor(){super(...arguments),this.type=tV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}tV.type="path";const eV=()=>{wR.registerMark(tV.type,tV),Xk(),Hk(),wR.registerGraphicComponent("path",qg)},iV=Object.assign(Object.assign({},nF),{area:{name:"area",type:"path"}});class sV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 nV{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(){}}class rV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:nV}:Uy(e)||Wy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:rV}:null}const oV={debounce:xt,throttle:St};class lV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Uy(this._renderMode)||Wy(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,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,oV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,oV[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:YO.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:YO.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||aV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:YO.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:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=oV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=oV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:YO.chart})}));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:YO.chart,source:GO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp)}))}}function hV(t,e){return`${qR}_${e}_${t}`}class cV extends Pz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:hV(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=TR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 sV(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===YL.map||e.type===YL.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),HL(this._regions,(t=>{var e;if(t.type===YL.map||t.type===YL.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==YL.map&&e.type!==YL.pictogram||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[ZH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}cV.type=r.geoCoordinate,G(cV,lV);const dV=()=>{wR.registerComponent(cV.type,cV)};class uV extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class pV extends qH{constructor(){super(...arguments),this.type=YL.map,this.transformerConstructor=uV,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 !`),QO.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),ZO(this._dataSet,"copyDataView",rI),ZO(this._dataSet,"map",JH),ZO(this._dataSet,"lookup",zD);const s=QO.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:ZH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(pV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:mF(this._spec,pV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:iO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:iO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(uF(null===(t=wR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new QH(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[tO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[tO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 tO}getActiveMarks(){return[this._pathMark]}}pV.type=YL.map,pV.mark=iV,pV.builtInTheme={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"}}}}},pV.transformerConstructor=uV;const gV=`${qR}_waterfall_default_seriesField`,fV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[pO]=!0:delete t[pO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=mV([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 f=g[0];let{start:m,end:v}=vV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=mV(r,t,n,a,c,h,i,e),a.push(n)})),a};function mV(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}=vV(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===gV)&&(t[gV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function vV(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?Fy("total.collectCountField error"):n=e[a].start;o<0?Fy("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=ie(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 _V=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},yV={type:"fadeIn"},bV={type:"growCenterIn"};function xV(t,e){switch(e){case"fadeIn":return yV;case"scaleIn":return bV;default:return AH(t,!1)}}class SV extends rD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Cg(t)}}SV.type="rule";const AV=()=>{wR.registerMark(SV.type,SV),Xk(),zk(),wR.registerGraphicComponent("line",Cg)},kV=Object.assign(Object.assign({},BH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),MV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:TV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function TV(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)=>TV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class wV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),ZO(e,"dimensionTree",MV),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 CV extends RH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const EV={rect:IV,symbol:RV,arc:FV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=RV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:zV,line:jV,area:jV,rect3d:IV,arc3d:FV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function BV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=EV[t])&&void 0!==i?i:EV.point;return e.series.type===YL.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=LV(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:HV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function PV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==YL.sankey){const{formatFunc:t,args:n}=DD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function LV(t){return d(t)?e=>t(e.data):t}function RV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=LV(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:OV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function OV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function IV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=LV(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:DV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function DV(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 FV(t){var e;const{labelSpec:i}=t,s=null!==(e=LV(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 zV(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=PV(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),Sg(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 jV(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}))):[{index:0,[iO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function HV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class VV extends OH{constructor(){super(...arguments),this.type=YL.waterfall,this.transformerConstructor=CV,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 wV(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=gV)}getSeriesKeys(){return this._seriesField===gV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),ZO(this._dataSet,"waterfallFillTotal",_V),ZO(this._dataSet,"waterfall",fV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=aI(this.getViewData(),this._dataSet,{name:`${qR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new tD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:rO,endAs:aO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=AF(this);this._barMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("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(){super.initMark();const t=this._createMark(VV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return zV(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?lR(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):lR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}VV.type=YL.waterfall,VV.mark=kV,VV.builtInTheme={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}}}},VV.transformerConstructor=CV;const NV=()=>{AV(),EH(),wR.registerAnimation("waterfall",((t,e)=>({appear:xV(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t,!1)}))),_D(),rj(),ej(),wR.registerSeries(VV.type,VV)},UV=`${qR}_BOX_PLOT_OUTLIER_VALUE`;var WV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(WV||(WV={}));const GV=(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={[UV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class YV extends YD{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return this.series.getOutliersField();if(t===WV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case WV.MIN:return this.series.getMinField();case WV.MAX:return this.series.getMaxField();case WV.MEDIAN:return this.series.getMedianField();case WV.Q1:return this.series.getQ1Field();case WV.Q3:return this.series.getQ3Field();case WV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return e[UV];if(t===WV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case WV.MIN:return e[this.series.getMinField()];case WV.MAX:return e[this.series.getMaxField()];case WV.MEDIAN:return e[this.series.getMedianField()];case WV.Q1:return e[this.series.getQ1Field()];case WV.Q3:return e[this.series.getQ3Field()];case WV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[UV])}getDefaultContentList(t){return[{key:this.getContentKey(WV.OUTLIER),value:this.getContentValue(WV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(WV.MAX),value:this.getContentValue(WV.MAX)},{key:this.getContentKey(WV.Q3),value:this.getContentValue(WV.Q3)},{key:this.getContentKey(WV.MEDIAN),value:this.getContentValue(WV.MEDIAN)},{key:this.getContentKey(WV.Q1),value:this.getContentValue(WV.Q1)},{key:this.getContentKey(WV.MIN),value:this.getContentValue(WV.MIN)},{key:this.getContentKey(WV.SERIES_FIELD),value:this.getContentValue(WV.SERIES_FIELD)}]}}class $V extends rD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Og(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=wR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const XV=()=>{wR.registerGraphicComponent("glyph",Og),Xk(),Lk()},KV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],qV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class ZV extends $V{constructor(){super(...arguments),this.type=ZV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=KV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}ZV.type="boxPlot";const JV=Object.assign(Object.assign({},nF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),QV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},eN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),iN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=eN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=eN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=eN(t,"box").attribute.width,i=eN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=eN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=eN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=eN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=eN(t,"box").attribute.height,i=eN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=eN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=eN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=eN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=eN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=eN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=eN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=eN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=eN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=eN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class nN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return QV(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class rN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends nN{computeAttribute(){return QV(sN)(this.target,this.params,this.params.options)}}class oN extends rN{computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}}class lN extends kF{constructor(){super(...arguments),this.type=YL.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(){this._boxPlotMark=this._createMark(lN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(lN.mark.outlier,{key:tO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>lR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>lR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>lR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>lR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>lR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;ZO(this._dataSet,"foldOutlierData",GV),ZO(this._dataSet,"addVChartProperty",jD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${qR}_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:tF.bind(this),call:eF}},!1),this._outlierDataView=new tD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=AF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=wR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uF(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(uF(null===(a=wR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new YV(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]}}lN.type=YL.boxPlot,lN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},lN.mark=JV;const hN=()=>{XV(),zk(),Wk(),wR.registerGraphicComponent("line",(t=>Cg(t))),wR.registerGraphicComponent("rect",(t=>Lg(t))),wR.registerMark(ZV.type,ZV),qF(),vD(),rj(),ej(),lw.registerBuiltInAnimate("boxplotScaleIn",nN),lw.registerBuiltInAnimate("boxplotScaleOut",rN),lw.registerBuiltInAnimate("barBoxplotScaleIn",aN),lw.registerBuiltInAnimate("barBoxplotScaleOut",oN),wR.registerSeries(lN.type,lN)};class cN extends rD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?$g(t):Sg(t)}}cN.type="text";const dN=()=>{wR.registerMark(cN.type,cN),Xk(),Jk(),Yk(),wR.registerGraphicComponent("text",Sg),wR.registerGraphicComponent("richtext",$g)};class uN extends YD{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 pN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),gN={type:"fadeIn"},fN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function mN(t,e){return"fadeIn"===e?gN:pN(t)}const vN=Object.assign(Object.assign({},BH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class _N extends RH{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 yN extends OH{constructor(){super(...arguments),this.type=YL.rangeColumn,this._barMarkType="rect",this._barName=YL.bar,this.transformerConstructor=_N}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,yN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(yN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(yN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=AF(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(uF(null===(i=wR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uF(null===(n=wR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new uN(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)}}yN.type=YL.rangeColumn,yN.mark=vN,yN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},yN.transformerConstructor=_N;const bN=()=>{EH(),dN(),wR.registerAnimation("rangeColumn",((t,e)=>({appear:mN(t,e),enter:pN(t),exit:fN(t),disappear:fN(t)}))),_D(),rj(),ej(),wR.registerSeries(yN.type,yN)};var xN,SN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(xN||(xN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(SN||(SN={}));class AN extends YD{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 kN=Object.assign({},mH);class MN extends yH{constructor(){super(...arguments),this.type=YL.rangeArea}initMark(){this._areaMark=this._createMark(MN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AN(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))}}MN.type=YL.rangeArea,MN.mark=kN;class TN extends xF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Mz,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:[]};DC(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:[]};DC(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(t.ChartEvent.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)&&SF(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 wN(t){return $y(t)?Number.parseFloat(t):0}const CN=(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&&EN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[fz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[fz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},EN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===wN(t[e])))||!i&&0===t.reduce(((t,i)=>t+wN(i[e])),0)));function BN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const PN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:BN(t,!0,cI.appear)}),LN={type:"fadeIn"},RN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:BN(t,!0,cI.enter)}),ON=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:BN(t,!0,cI.exit)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:BN(t,!0,cI.exit)});function DN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return LN;case"growRadius":return PN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return PN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class FN extends rD{constructor(t,e){super(t,e),this.type=zN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[bz])[t]+s,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 zN extends FN{constructor(){super(...arguments),this.type=zN.type}}zN.type="arc";const jN=()=>{Xk(),Tk(),mB("arc",wB),lw.registerBuiltInAnimate("growRadiusIn",gC),lw.registerBuiltInAnimate("growRadiusOut",fC),lw.registerBuiltInAnimate("growAngleIn",Kw),lw.registerBuiltInAnimate("growAngleOut",qw),wR.registerGraphicComponent("arc",sf),wR.registerMark(zN.type,zN)},HN=Object.assign(Object.assign({},nF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class VN extends bF{_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=TR({},this._theme,i,t);const n=(t,e)=>TR({},"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 NN=`${qR}_LABEL_VISIBLE`;class UN extends TN{constructor(){super(...arguments),this.transformerConstructor=VN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:pR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:pR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Az,this._endAngle=kz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[bz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;ZO(this._dataSet,"pie",CN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:vz,asEndAngle:_z,asRatio:mz,asMiddleAngle:bz,asRadian:Sz,asQuadrant:xz,asK:yz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new tD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},UN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return UL(vz)(t)}endAngleScale(t){return UL(_z)(t)}_computeLayoutRadius(){return Tz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:hR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:hR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:UL(NN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[bz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===cI.appear)return this._startAngle;if(i===cI.disappear)return this._endAngle;const r=[cI.disappear,cI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[tO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=uF(null===(i=wR.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]}}UN.transformerConstructor=VN,UN.mark=HN,UN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class WN extends UN{constructor(){super(...arguments),this.type=YL.pie}}WN.type=YL.pie;const GN=()=>{jN(),wR.registerAnimation("pie",((t,e)=>({appear:DN(t,e),enter:RN(t),exit:ON(t),disappear:IN(t)}))),wR.registerAnimation("emptyCircle",((t,e)=>({appear:DN(t,e)}))),wR.registerSeries(WN.type,WN)};function YN(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const $N=t=>({type:YN(t.growField),options:{overall:!0}}),XN={type:"fadeIn"},KN=t=>({type:YN(t.growField)}),qN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},ZN=qN;function JN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XN;case"growAngle":return $N(Object.assign(Object.assign({},t),{growField:"angle"}));default:return $N(Object.assign(Object.assign({},t),{growField:"radius"}))}}class QN extends TN{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(aO),this.setInnerRadiusField(rO)}setValueFieldToPercent(){this.setRadiusField(lO),this.setInnerRadiusField(oO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const tU=Object.assign(Object.assign({},nF),{rose:{name:"rose",type:"arc"}});class eU extends bF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class iU extends Fz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=wR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=Az,this._endAngle=kz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):pz(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:pR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:pR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:lz(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(){HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):pz(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 DC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:DC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>uz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 Tz((()=>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=Mz,e=0;const i=this.getChart().getSpec();return HL(this.getRegions(),(s=>{const n=s;if(r=n.type,[YL.rose,YL.radar,YL.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(TR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(TR({},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)}}iU.type=r.polarAxis,iU.specKey="axes";const sU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},nU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class rU extends iU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}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 ZO(this._option.dataSet,t,IE),t}}rU.type=r.polarLinearAxis,rU.specKey="axes",rU.builtInTheme={axis:Qz,axisLinear:qz,axisAngle:nU,axisRadius:sU},G(rU,Kz);const aU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(rU.type,rU)};class oU extends iU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,UE),t}transformScaleDomain(){}}oU.type=r.polarBandAxis,oU.specKey="axes",oU.builtInTheme={axis:Qz,axisBand:sj,axisAngle:nU,axisRadius:sU},G(oU,ij);const lU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(oU.type,oU)};class hU extends QN{constructor(){super(...arguments),this.type=YL.rose,this.transformerConstructor=eU,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(){this._roseMark=this._createMark(hU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,hU.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=>lR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=lR(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(uF(null===(i=wR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}hU.type=YL.rose,hU.mark=tU,hU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},hU.transformerConstructor=eU;const cU=()=>{wR.registerSeries(hU.type,hU),jN(),wR.registerAnimation("rose",((t,e)=>({appear:JN(t,e),enter:KN(t),exit:qN(t),disappear:ZN(t)}))),lU(),aU()};class dU extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,PL(this._fromAngle,this._toAngle)&&PL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class uU extends Nw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!jL(t)&&!jL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const pU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function gU(t,e,i){return"fadeIn"===e?pU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function fU(t,e,i){return"fadeIn"===e?pU(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 mU=(t,e)=>({custom:Hw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),vU=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}});class _U extends QN{constructor(){super(...arguments),this.type=YL.radar,this.transformerConstructor=ZF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(_U.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:RD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):Az},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(uF(null===(s=wR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=wR.getAnimationInKey(e);t.setAnimationConfig(uF(null==i?void 0:i(n,r),pF(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}}}_U.type=YL.radar,_U.mark=vU,_U.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_U.transformerConstructor=ZF,G(_U,NF);const yU=()=>{wR.registerSeries(_U.type,_U),gH(),XF(),qF(),wR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:gU(t,e,"in"),enter:gU(t,e,"in"),exit:gU(t,e,"out"),disappear:"clipIn"===e?void 0:gU(t,e,"out"),update:[{channel:["points","center"],custom:uU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),wR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:dU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing}]}))),wR.registerAnimation("radarGroup",((t,e)=>({appear:mU(t,"in"),disappear:mU(t,"out")}))),Tk(),lU(),aU()};class bU extends YD{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=>fi.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 xU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(qR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[tO]:r,[eO]:`${s}_${e}`})),r++}))})),n},SU={fill:"#bbb",fillOpacity:.2},AU=Object.assign(Object.assign({},nF),{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 kU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZO(this._option.dataSet,"objFlat",xU),ZO(this._option.dataSet,"copyDataView",rI),JO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(TR(SU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(kU.mark.group),this._containerMark=this._createMark(kU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(kU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(kU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(kU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(kU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(kU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(kU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:iO}}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 rR).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:iO}}initTooltip(){this._tooltipHelper=new bU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}kU.type=YL.dot,kU.mark=AU,kU.builtInTheme={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"}}}}};class MU extends YD{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=>fi.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 TU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),wU=(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 CU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),ZO(this._option.dataSet,"linkDotInfo",wU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(CU.mark.group),this._containerMark=this._createMark(CU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(CU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(CU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:iO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new MU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}CU.type=YL.link,CU.mark=TU,CU.builtInTheme={link:{arrow:{style:{size:10}}}};const EU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"}});class BU extends TN{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()?rO:yO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?aO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):Az;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):kz,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=lR(this.angleAxisHelper.dataToPosition([t[rO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=lR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?lR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(BU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return sf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Lg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 OU=()=>{wR.registerAnimation("circularProgress",((t,e)=>({appear:RU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class IU extends bF{constructor(){super(...arguments),this._supportStack=!0}}class DU extends BU{constructor(){super(...arguments),this.type=YL.circularProgress,this.transformerConstructor=IU,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(k(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(k(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(){return this._progressMark=this._createMark(DU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:mF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(DU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?rO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?aO: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",t.AttributeLevel.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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DU.type=YL.circularProgress,DU.mark=PU,DU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DU.transformerConstructor=IU;const FU=()=>{wR.registerSeries(DU.type,DU),jN(),OU(),_D(),lU(),aU()};function zU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const jU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:zU(t)}),HU={type:"fadeIn"};function VU(t,e="grow"){return!1===e?{}:"fadeIn"===e?HU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zU(t)}))(t)}class NU extends YD{enableByType(t){return"dimension"!==t}}const UU=Object.assign(Object.assign({},nF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class WU extends kF{constructor(){super(...arguments),this.type=YL.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;return this._progressMark=this._createMark(WU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return lR(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+n},y1:t=>{var e,i;return lR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return lR(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 e,s;return lR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(WU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return lR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(uF(null===(i=wR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}WU.type=YL.linearProgress,WU.mark=UU,WU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const GU=()=>{EH(),wR.registerAnimation("linearProgress",((t,e)=>({appear:VU(t,e),enter:VU(t),disappear:jU(t)}))),_D(),wR.registerSeries(WU.type,WU)},YU=[0],$U=[20,40],XU=[200,500],KU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},qU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],ZU=`${qR}_WORD_CLOUD_TEXT`,JU=Object.assign(Object.assign({},nF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),QU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class tW extends xF{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=$U}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:XU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:YU,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)?ZU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:KU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Ny(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:YU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!qU.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 e;this._wordMark=this._createMark(tW.mark.word,{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(tW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(uF(wR.getAnimationInKey("wordCloud")(n,s),pF("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 rR).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:iO])}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 TE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new TE).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[tO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:eO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:uf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:Hg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}tW.mark=JU,tW.builtInTheme={wordCloud:QU};function eW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||gD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=iW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},sW=(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=sW(t.children,e,t,n))})),s},nW=(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=nW(t.children,e,t,n)),n=e(t,s,i,n)})),n},rW=(t,e=[],i)=>{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):rW(t.children,e,i)))})),e};function aW(t,e){let i,s;if(hW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function hW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function pW(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 gW(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 fW(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 mW(t){return{_:t,next:null,prev:null}}function vW(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];pW(n,s,r);let a,o,l,h,c,d,u,p=mW(s),g=mW(n),f=mW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=iW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:xW.defaultOpionts.nodeSort;sW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)sW([o],_W(h)),nW([o],yW(this._getPadding,.5,a)),sW([o],bW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);sW([o],_W(xW.defaultOpionts.setRadius)),nW([o],yW(Lt,1,a)),c&&nW([o],yW(this._getPadding,o.radius/t,a)),sW([o],bW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}xW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const SW=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=SW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function AW(t){return t.depth}function kW(t,e){return e-1-t.endDepth}const MW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),TW=(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},wW={left:AW,right:kW,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:AW,end:kW},CW=yt(0,1);class EW{constructor(t){this._ascendingSourceBreadth=(t,e)=>MW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>MW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},EW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):wW[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)};"vertical"===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<=0)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))),"vertical"===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=[];SW(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:Mt(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+=Mt(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=[TW(s[t.source]),TW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*CW(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(MW),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(MW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];BW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),PW);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({},LW.defaultOpionts,t):Object.assign({},LW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=iW(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=he({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)}}}function RW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:BW,slice:RW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?RW:BW)(t,e,i,s,n)}};class DW{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({},DW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?OW(this.options.aspectRatio):null!==(e=IW[this.options.splitType])&&void 0!==e?e:IW.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=iW(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)}))}}function FW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=FW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=zW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function GW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*YW({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},XW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||HW,s=e.lossFunction||jW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:$W(l),arcs:l})}))},KW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:qW,triangle:qW,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 qW(){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 ZW(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 JW=t=>KW[t]?KW[t]():KW.circle(),QW=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function tG(t){return d(t)?t:function(){return t}}class eG{constructor(t){var e,i;switch(this.options=j({},eG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=JW(this.options.shape),this.getText=null!==(e=tG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=tG(this.options.fontWeight),this.getTextFontSize=tG(this.options.fontSize),this.getTextFontStyle=tG(this.options.fontStyle),this.getTextFontFamily=tG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>QW(10,50);break;case"random-light":this.getTextColor=()=>QW(50,90);break;default:this.getTextColor=tG(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 ae(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():Tt(e);return ae(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 sG extends eG{constructor(t){var e;super(j({},sG.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<=sG.defaultOptions.minFontSize&&(this.options.minFontSize=sG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=iG[this.options.spiral])&&void 0!==e?e:iG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=tG(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}=ZW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(aG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}oG(p,this._size)&&(p=lG(p,this._size))}else if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||rG(p,i))&&(!i||!nG(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 nG(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 rG(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,oG=(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 lG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},cG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},dG=(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()},uG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=ZW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=JW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)dG(n,cG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)dG(n,cG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=cG({x:l,y:h},o,-Math.PI/2,5),e=cG({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]);dG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let gG=class t extends iG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?cG(t,o,l.width,l.height,h):"geometric"===t.type&&pG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=JW(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()}};gG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class fG extends iG{constructor(t){super(j({},fG.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)}fG.defaultOptions={enlarge:!1};const vG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},_G=(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?yG(t.fontFamily):"sans-serif",d=t.fontStyle?yG(t.fontStyle):"normal",u=t.fontWeight?yG(t.fontWeight):"normal",p=t.rotate?yG(t.rotate):0,g=yG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?yG(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},vG),t.as):vG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?yG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=xG(SG(t,l),C);w=i=>e(t(i))}let E=nG;"fast"===t.layoutType?E=fG:"grid"===t.layoutType&&(E=gG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},yG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],bG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),xG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=bG(t[0]),n=bG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(bG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},SG=(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 AG(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{CR.registerGrammarTransform("wordcloud",{transform:_G}),uN(),CR.registerAnimation("wordCloud",((t,e)=>({appear:iW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),CR.registerSeries(kG.type,kG)},TG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},wG=(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},CG=`${ZR}_FUNNEL_TRANSFORM_RATIO`,EG=`${ZR}_FUNNEL_REACH_RATIO`,BG=`${ZR}_FUNNEL_HEIGHT_RATIO`,PG=`${ZR}_FUNNEL_VALUE_RATIO`,LG=`${ZR}_FUNNEL_LAST_VALUE_RATIO`,RG=`${ZR}_FUNNEL_NEXT_VALUE_RATIO`,OG=`${ZR}_FUNNEL_LAST_VALUE`,IG=`${ZR}_FUNNEL_CURRENT_VALUE`,DG=`${ZR}_FUNNEL_NEXT_VALUE`,FG=`${ZR}_FUNNEL_TRANSFORM_LEVEL`;class zG extends $D{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[EG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class jG extends aD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class HG extends jG{constructor(){super(...arguments),this.type=HG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}HG.type="polygon";const VG=()=>{CR.registerMark(HG.type,HG),Kk(),Uk(),hw.registerBuiltInAnimate("growPointsOut",aC),CR.registerGraphicComponent("polygon",rf)},NG=Object.assign(Object.assign({},rF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class UG extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class WG extends SF{constructor(){super(...arguments),this.type=$L.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=UG,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;JO(this._dataSet,"funnel",TG),JO(this._dataSet,"funnelTransform",wG);const t=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new eD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:IG,asTransformRatio:CG,asReachRatio:EG,asHeightRatio:BG,asValueRatio:PG,asNextValueRatio:RG,asLastValueRatio:LG,asLastValue:OG,asNextValue:DG,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:FG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},WG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:vF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},WG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(WG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(WG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new zG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Dy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Dy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*WL(EG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),gF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("fadeInOut")(),gF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("funnel")({},o),gF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(pF(null===(a=CR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),gF("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[LG])/2:this._getSecondaryAxisLength(t[PG])/2,n=this._getSecondaryAxisLength(t[PG])/2):(s=this._getSecondaryAxisLength(t[PG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[RG])/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[FG])}_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[iO]===t[iO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{VG(),uN(),kV(),CR.registerSeries(WG.type,WG),CR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vD))),CR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),yD()},YG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},$G=t=>{const e=t.filter((t=>t.context.diffState===EI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},XG=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},KG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),qG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},ZG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),JG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},QG=(t,e={})=>{if(!t)return[];const i=[];return aW(t,i,e),i},tY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new RW(i).layout(t,{width:s,height:n})};class eY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var iY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(iY||(iY={}));const sY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===iY.DrillDown){return Y(LO(t,n,s,"children"))}if(i.type===iY.DrillUp){const e=RO(t,n,s,"children");if(e)return Y(e)}return t};class nY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=oV(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;JO(t,"drillFilter",sY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:iY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:iY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:iY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:iY.DrillUp},model:this}),r}}const rY=Object.assign(Object.assign({},rF),{sunburst:{name:"sunburst",type:"arc"}}),aY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:JD,operations:["max","min","values"]}),t.push({key:QD,operations:["values"]}),t),oY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class lY extends wN{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),JO(this._dataSet,"sunburstLayout",tY),JO(this._dataSet,"flatten",QG),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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(lY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(lY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new eY(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(pF(null===(e=CR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}lY.type=$L.sunburst,lY.mark=rY,lY.builtInTheme={sunburst:oY},G(lY,nY);const hY=()=>{CR.registerSeries(lY.type,lY),HN(),uN(),yD(),CR.registerAnimation("sunburst",((t,e)=>({appear:JG(0,e),enter:KG(t),exit:ZG(t),disappear:ZG(t)})))},cY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new SW(i).layout(t,{width:s,height:n})};class dY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const uY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},pY=Object.assign(Object.assign({},rF),{circlePacking:{name:"circlePacking",type:"arc"}});class gY extends MF{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},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),JO(this._dataSet,"circlePackingLayout",cY),JO(this._dataSet,"flatten",QG),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)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return aY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new dY(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(pF(null===(i=CR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}gY.type=$L.circlePacking,gY.mark=pY,gY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(gY,nY);const fY=()=>{CR.registerSeries(gY.type,gY),HN(),uN(),_D(),CR.registerAnimation("circlePacking",((t,e)=>({appear:uY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},mY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&mY(t,e.children,i)}))},vY=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},_Y=(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 BW(e),r=[];return r.push(n.layout(s,i)),r},yY=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:[]},bY=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 xY extends $D{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 SY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),AY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:SY(t),kY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class MY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const wY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},CY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class EY extends XV{constructor(){super(...arguments),this.type=EY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?CY:wY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}EY.type="linkPath";const BY=Object.assign(Object.assign({},rF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class PY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const LY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class RY extends MF{constructor(){super(...arguments),this.type=$L.sankey,this.transformerConstructor=PY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=HO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=HO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=HO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),LY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=HO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=HO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=HO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=HO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=HO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(HO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=HO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=HO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){JO(this._dataSet,"sankeyLayout",_Y),JO(this._dataSet,"sankeyFormat",vY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;JO(o,"sankeyNodes",yY),JO(o,"flatten",QG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._nodesSeriesData=l,JO(o,"sankeyLinks",bY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(RY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(RY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=FD(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(pF(null===(i=CR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),gF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),gF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:$O.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(HO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new xY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new aR;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 mY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}RY.type=$L.sankey,RY.transformerConstructor=PY,RY.mark=BY,RY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const OY=()=>{BH(),KV(),Vk(),CR.registerGraphicComponent("path",(t=>Kg(t))),CR.registerMark(EY.type,EY),uN(),CR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:AY(t,e)},vD))),CR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:kY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),hw.registerBuiltInAnimate("linkPathGrowOut",TY),hw.registerBuiltInAnimate("linkPathGrowIn",MY),yD(),CR.registerSeries(RY.type,RY)},IY=(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=QG(n);return i=KD([{latestData:r}],e),i};class DY extends $D{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 FY=Object.assign(Object.assign({},rF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),zY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class jY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const HY=(t,e)=>{if(e.getViewBox()){const i=new FW(e).layout(t,e.getViewBox()),s=[];return aW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[QD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class VY extends MF{constructor(){super(...arguments),this.type=$L.treemap,this.transformerConstructor=jY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:QD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:iO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),JO(this._dataSet,"treemap",HY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=IY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){JO(this._dataSet,"hierarchyDimensionStatistics",IY),JO(this._dataSet,"flatten",QG);const i=new wa(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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(VY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(VY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),gF(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 DY(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(UO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(UO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}VY.type=$L.treemap,VY.mark=FY,VY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},VY.transformerConstructor=jY,G(VY,nY),G(VY,hV);const NY=()=>{CR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),CR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),BH(),uN(),CR.registerAnimation("treemap",((t,e)=>({appear:zY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),yD(),CR.registerSeries(VY.type,VY)},UY=Object.assign(Object.assign({},BU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),WY=Object.assign(Object.assign({},rF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),GY={type:"fadeIn"};function YY(t,e){return"fadeIn"===e?GY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class $Y extends xF{constructor(){super(...arguments),this._supportStack=!1}}class XY extends $D{enableByType(t){return"dimension"!==t}}const KY="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",qY={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:KY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:KY,fill:"#ddd"}}};class ZY extends PU{constructor(){super(...arguments),this.type=$L.gaugePointer,this.transformerConstructor=$Y,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(ZY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},ZY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(ZY.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 XY(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ZY.type=$L.gaugePointer,ZY.mark=WY,ZY.builtInTheme={gaugePointer:qY},ZY.transformerConstructor=$Y;const JY=()=>{CR.registerSeries(ZY.type,ZY),iV(),BH(),CR.registerAnimation("gaugePointer",((t,e)=>{const i=YY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),hU(),oU()};class QY extends xF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class t$ extends PU{constructor(){super(...arguments),this.type=$L.gauge,this.transformerConstructor=QY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();JO(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[xO]=t[this._angleField[0]],t[bO]=e>0?i[e-1][xO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(t$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(t$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[bO])?this.angleAxisHelper.dataToPosition([t[bO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[xO]])}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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}t$.type=$L.gauge,t$.mark=UY,t$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},t$.transformerConstructor=QY;class e$ extends aD{constructor(){super(...arguments),this.type=e$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}e$.type="cell";function i$(t){return!1===t?{}:{type:"fadeIn"}}class s$ extends $D{enableByType(t){return"dimension"!==t}}const n$=Object.assign(Object.assign({},rF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class r$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class a$ extends MF{constructor(){super(...arguments),this.type=$L.heatmap,this.transformerConstructor=r$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(a$.mark.cell,{isSeriesMark:!0},{morph:vF(this._spec,a$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(a$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=kF(this);this._cellMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),gF("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 s$(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]}}a$.type=$L.heatmap,a$.mark=n$,a$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},a$.transformerConstructor=r$;const o$=()=>{uN(),CR.registerMark(e$.type,e$),CR.registerGraphicComponent("symbol",kg),Kk(),Zk(),bB(),CR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vD),{appear:i$(e)}))),aj(),ij(),CR.registerSeries(a$.type,a$)},l$=Object.assign(Object.assign({},rF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),h$=`${ZR}_CORRELATION_X`,c$=`${ZR}_CORRELATION_Y`,d$=`${ZR}_CORRELATION_SIZE`,u$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=p$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),g$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},g$=(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,[eO]:null==n?void 0:n[eO],[sO]:null==n?void 0:n[sO]}};class m$ extends XV{constructor(){super(...arguments),this.type=m$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}m$.type="ripple";const v$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class _$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class y$ extends wN{constructor(){super(...arguments),this.type=$L.correlation,this.transformerConstructor=_$,this._viewBox=new He}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;JO(this._dataSet,"correlation",u$);const s=new Ta;QO(s,"dataview",Aa),JO(s,"correlationCenter",f$);const n=new wa(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 eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(y$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:eO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(y$.mark.ripplePoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(y$.mark.centerPoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[h$],y:t=>t[c$],size:t=>t[d$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),gF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}y$.type=$L.correlation,y$.mark=l$,y$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},y$.transformerConstructor=_$;const b$=()=>{ZF(),KV(),Zk(),CR.registerMark(m$.type,m$),CR.registerGraphicComponent("symbol",(t=>kg(t))),CR.registerSeries(y$.type,y$),CR.registerAnimation("correlation",((t,e)=>Object.assign({appear:v$(0,e)},mD)))},x$=Object.assign(Object.assign({},rF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class S$ extends XV{constructor(){super(...arguments),this.type=S$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}S$.type="liquid";const A$=(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 k$ extends $D{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 M$ extends SF{constructor(){super(...arguments),this.type=$L.liquid,this.transformerConstructor=JF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:A$(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=vR(this._spec.outlineMargin),this._paddingSpec=vR(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=Gt(...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(M$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(M$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(M$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(M$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new k$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),gF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),gF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=xM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}M$.type=$L.liquid,M$.mark=x$,M$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},M$.transformerConstructor=JF;const T$=t=>Y(t).join(",");class w$ extends $D{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const C$=Object.assign(Object.assign({},rF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class E$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const B$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?KW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class P$ extends SF{constructor(){super(...arguments),this.type=$L.venn,this.transformerConstructor=E$,this._viewBox=new He}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:iO)}initData(){var t;super.initData(),JO(this._dataSet,"venn",B$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(P$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(P$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new w$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:T$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return T$(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[T$(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(T$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}}P$.type=$L.venn,P$.mark=C$,P$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},P$.transformerConstructor=E$;class L$ extends IH{constructor(){super(...arguments),this.type=$L.mosaic,this.transformerConstructor=OH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(vO),this.setFieldX2(mO)),this.setFieldY(yO),this.setFieldY2(_O)):(t&&(this.setFieldY(vO),this.setFieldY2(mO)),this.setFieldX(yO),this.setFieldX2(_O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}L$.type=$L.mosaic,L$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},L$.transformerConstructor=OH;class R$ extends Ej{_isValidSeries(t){return t===$L.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class O$ extends wj{constructor(){super(...arguments),this.transformerConstructor=R$,this.type="map",this.seriesType=$L.map}}O$.type="map",O$.seriesType=$L.map,O$.transformerConstructor=R$;class I$ extends Ej{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 D$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=cz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,wR({},s,l)),n&&Object.assign(o,wR({},n,o))}}class F$ extends I${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class z$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class j$ extends wj{constructor(){super(...arguments),this.transformerConstructor=z$}}j$.transformerConstructor=z$;class H$ extends j${constructor(){super(...arguments),this.transformerConstructor=z$,this.type="pie",this.seriesType=$L.pie}}H$.type="pie",H$.seriesType=$L.pie,H$.transformerConstructor=z$;class V$ extends F${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Tz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Tz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const N$=(t,e)=>{if(!t)return null;const i=jF(t,(t=>"angle"===t.getOrient()),e),s=jF(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&&jC(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=zL({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=jL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=FF(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&&jC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=zL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jL(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 _=FF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class U$ extends wj{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rose",this.seriesType=$L.rose}_setModelOption(){this._modelOption.getDimensionInfo=N$}}U$.type="rose",U$.seriesType=$L.rose,U$.transformerConstructor=V$,G(U$,Oj);class W$ extends F${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=wR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class G$ extends wj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="radar",this.seriesType=$L.radar}_setModelOption(){this._modelOption.getDimensionInfo=N$}}G$.type="radar",G$.seriesType=$L.radar,G$.transformerConstructor=W$,G(G$,Oj);class Y$ extends Ej{_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=>{L(e,"trimPadding")&&wR(e,MI(this.type,t))})),this._transformAxisSpec(t)}}class $$ extends wj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Wj(t,e,i))&&void 0!==s?s:[],...null!==(n=N$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}$$.type="common",$$.transformerConstructor=Y$,G($$,Oj);class X$ extends Bj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class K$ extends wj{constructor(){super(...arguments),this.transformerConstructor=X$}}K$.transformerConstructor=X$,G(K$,Oj);class q$ extends X${transformSpec(t){super.transformSpec(t),SI(t)}}class Z$ extends K${constructor(){super(...arguments),this.transformerConstructor=q$,this.type="histogram",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}Z$.type="histogram",Z$.seriesType=$L.bar,Z$.transformerConstructor=q$;class J$ extends D${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Q$ extends wj{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="circularProgress",this.seriesType=$L.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=N$}}Q$.type="circularProgress",Q$.seriesType=$L.circularProgress,Q$.transformerConstructor=J$,G(Q$,Oj);class tX extends D${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=$L.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===$L.gauge||t.type===$L.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===$L.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class eX extends wj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="gauge",this.seriesType=$L.gaugePointer}}eX.type="gauge",eX.seriesType=$L.gaugePointer,eX.transformerConstructor=tX;class iX extends Ej{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class sX extends wj{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}sX.transformerConstructor=iX;class nX extends sX{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}nX.type="wordCloud",nX.seriesType=$L.wordCloud,nX.transformerConstructor=iX;class rX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class aX extends wj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="funnel",this.seriesType=$L.funnel}}aX.type="funnel",aX.seriesType=$L.funnel,aX.transformerConstructor=rX;class oX extends Bj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=cz(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=cz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class lX extends wj{constructor(){super(...arguments),this.transformerConstructor=oX,this.type="linearProgress",this.seriesType=$L.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}lX.type="linearProgress",lX.seriesType=$L.linearProgress,lX.transformerConstructor=oX,G(lX,Oj);class hX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),SI(t)}}class cX extends wj{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="rangeColumn",this.seriesType=$L.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}cX.type="rangeColumn",cX.seriesType=$L.rangeColumn,cX.transformerConstructor=hX;class dX extends Ej{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class uX extends wj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="sunburst",this.seriesType=$L.sunburst}}uX.type="sunburst",uX.seriesType=$L.sunburst,uX.transformerConstructor=dX;class pX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gX extends wj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="circlePacking",this.seriesType=$L.circlePacking}}gX.type="circlePacking",gX.seriesType=$L.circlePacking,gX.transformerConstructor=pX;class fX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class mX extends wj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="treemap",this.seriesType=$L.treemap}}mX.type="treemap",mX.seriesType=$L.treemap,mX.transformerConstructor=fX;class vX extends FH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),SI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class _X extends zH{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="waterfall",this.seriesType=$L.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}_X.type="waterfall",_X.seriesType=$L.waterfall,_X.transformerConstructor=vX;class yX extends Bj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),SI(t)}}class bX extends wj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="boxPlot",this.seriesType=$L.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}bX.type="boxPlot",bX.seriesType=$L.boxPlot,bX.transformerConstructor=yX;class xX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class SX extends wj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="sankey",this.seriesType=$L.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=HO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}SX.type="sankey",SX.seriesType=$L.sankey,SX.transformerConstructor=xX;class AX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),SI(t)}}class kX extends wj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rangeArea",this.seriesType=$L.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}kX.type="rangeArea",kX.seriesType=$L.rangeArea,kX.transformerConstructor=AX;class MX extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class TX extends wj{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="heatmap",this.seriesType=$L.heatmap}}TX.type="heatmap",TX.seriesType=$L.heatmap,TX.transformerConstructor=MX;class wX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CX extends wj{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="correlation",this.seriesType=$L.correlation}}CX.type="correlation",CX.seriesType=$L.correlation,CX.transformerConstructor=wX;function EX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=zO(t.style)),P(t.textStyle)||wR(s.textStyle,zO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&zO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&zO(s.background.style),s}const BX=(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},PX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:sO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class LX extends Lz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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=dR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new eD(this._option,e),this._initSelectedData(),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(VL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(wR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}LX.specKey="legends";class RX extends LX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){JO(this._option.dataSet,"discreteLegendFilter",PX),JO(this._option.dataSet,"discreteLegendDataMake",BX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return VL(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(!Ky(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=MO(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:f,regionIndex:m,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=EX(s):b.title={visible:!1},P(n.focusIconStyle)||zO(n.focusIconStyle),n.shape&&(n.shape=IO(n.shape)),n.label&&(n.label=IO(n.label)),n.value&&(n.value=IO(n.value)),n.background&&(n.background=IO(n.background)),uR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),uR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),uR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||zO(r.railStyle),P(r.sliderStyle)||zO(r.sliderStyle)):(P(r.textStyle)||zO(r.textStyle),r.handler&&IO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(wR(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 KP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(NP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(NP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=FD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=FD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}RX.specKey="legends",RX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},RX.type=r.discreteLegend;const OX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},IX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?OO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const DX={color:tL,size:iL},FX={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}},zX=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({},FX),{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"}}}})},jX={horizontal:zX(!0),vertical:zX(!1)},HX=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({},FX),{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"}}}})},VX={horizontal:HX(!0),vertical:HX(!1)},NX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UX=[2,10];class WX extends LX{static getSpecInfo(t){const e=zD(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(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){JO(this._option.dataSet,"continuousLegendFilter",IX),JO(this._option.dataSet,"continuousLegendDataMake",OX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NL(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=MO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Ky(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MO(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()),P(a)&&(a="color"===this._legendType?NX:UX);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=wR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=EX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=zO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=zO(r.style)),P(a.style)||(w.trackStyle=zO(a.style)),w.startText=IO(o),w.endText=IO(l),w.handlerText=IO(h),P(c)||(w.sizeBackground=zO(c)),d.visible&&!P(d.style)&&(wR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return DX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}WX.specKey="legends",WX.builtInTheme={colorLegend:jX,sizeLegend:VX},WX.type=r.continuousLegend;const GX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,YX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),$X=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function XX(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=KX(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=>YX(i,s)(t)&&YX(n,r)(t)&&(u(a)||YX([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: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:YO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.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:YO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.hideTooltip(l.id),c}return"none"}const KX=(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=GX(c,t);let _=GX(d,t);const y=$X(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(YX(c,v));if(!y&&(_=GX(d,i),!$X(_)))return;const n=e.type===$L.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=jC(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(YX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=GX(d,o),!$X(_))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(YX(c,n));if(!y&&(_=GX(d,r),!$X(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===$L.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(YX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=GX(d,i),!$X(_))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},qX=t=>p(t)&&!y(t),ZX=t=>p(t)&&y(t);class JX extends Pz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=wR({},this._theme,r.style),r.offset=wR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Gy(this._option.mode)||!Uy(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=b_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Ny?void 0:Ny.body)}}const QX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class tK extends Lz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=JX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&qX(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&&LD.globalConfig.uniqueTooltip&&l&&LD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:YO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:YO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?iH.canvas:iH.dom,n=CR.getComponentPluginInType(t);n||jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=CR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Wy(s)||Gy(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=XX(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(ZX(t)){if(qX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>IF(t,e[i])))}if(ZX(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}}tK.type=r.tooltip,tK.transformerConstructor=JX,tK.builtInTheme={tooltip:QX},tK.specKey="tooltip";var eK,iK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eK||(eK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iK||(iK={}));const sK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nK extends Lz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{jC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:$O.chart}:{source:YO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Wy(e)||Gy(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(t.ChartEvent.tooltipHide,{source:YO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:YO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:YO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{sK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}nK.specKey="crosshair";const rK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class aK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=TF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){TF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:wF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"cartesian");e&&($j(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=qj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new rT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new aT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:rK},aK.type=r.cartesianCrosshair;class oK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=hz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=FD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new rT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new lT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new hT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new oT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}oK.specKey="crosshair",oK.builtInTheme={crosshair:rK},oK.type=r.polarCrosshair;const lK=(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},hK=(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)},cK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class dK extends Lz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=EF(t),this._isHorizontal="horizontal"===BF(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=>!FC(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(FC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};VL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,FC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;FC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else VL(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:n}=this._option;QO(n,"dataview",Aa),JO(n,"dataFilterComputeDomain",cK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new eD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(FC(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&&FC(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,FC(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=FC(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 aE,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||(JO(this._option.dataSet,"dataFilterWithNewDomain",hK),JO(this._option.dataSet,"lockStatisticsFilter",lK),VL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(FC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&jC(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,jC(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]}clear(){this._throttledHide=null}}G(dK,hV);class uK extends Pz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=wR({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}}}const pK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),gK={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:pK(!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:pK(!0)};class fK extends dK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=uK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new wE;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(!FC(t.type)||e[0]!==$(e))&&(!jC(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 UB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:zO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:zO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:zO(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:zO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:zO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:zO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:zO(g.style)},selectedBackgroundStyle:zO(this._spec.selectedBackground.style),dragMaskStyle:zO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:wR(zO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:wR(zO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(d=m.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}=FD(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()}}fK.type=r.dataZoom,fK.transformerConstructor=uK,fK.builtInTheme={dataZoom:gK},fK.specKey="dataZoom";const mK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class vK extends dK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 cM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=LL(this._start,e)&&LL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=zO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=zO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}vK.type=r.scrollBar,vK.builtInTheme={scrollBar:mK},vK.specKey="scrollBar";const _K=(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},yK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),bK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:yK("l1FontSize","primaryFontColor")},content:{visible:!0,style:yK("l2FontSize","tertiaryFontColor")}};class xK extends Lz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return zD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){JO(this._option.dataSet,"indicatorFilter",_K);const t=new wa(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 eD(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=wR({},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({},FO(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?yR(l,this._computeLayoutRadius()):0,dy:h?yR(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({},FO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}xK.type=r.indicator,xK.builtInTheme={indicator:bK},xK.specKey="indicator";const SK=["sum","average","min","max","variance","standardDeviation","median"];function AK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&AK(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=uR(t.x)?CK(t.x,n)+r.x:EK(l.getXAxisHelper(),[t.x])+r.x,h}function MK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&AK(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=uR(t.y)?CK(t.y,n)+r.y:EK(l.getYAxisHelper(),[t.y])+r.y,h}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&AK(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)),EK(a.angleAxisHelper,[t.angle])}function wK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&AK(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)),EK(a.radiusAxisHelper,[t.radius])}function CK(t,e){return Number(t.substring(0,t.length-1))*e/100}function EK(t,e){const i=t.getScale(0);return FC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function BK(t){return SK.includes(t)}function PK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=kK(t,_,n,u,c,o),r=MK(t,y,n,u,d,o),LK(s,b,S,g.length),LK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=kK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);LK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=MK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);LK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function LK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=TK(t,l,n,r),i=wK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=TK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=wK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function OK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=uR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=uR(i)?Number(i.substring(0,i.length-1))*f/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])&&AK(_,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])&&AK(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:EK(d.getXAxisHelper(),b)+p.x+m,y:EK(d.getYAxisHelper(),x)+p.y+v})})),n}function IK(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])&&AK(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])&&AK(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:EK(l.angleAxisHelper,d),radius:EK(l.radiusAxisHelper,u)})})),s}function DK(t,e,i){let{x:s,y:n}=t;return uR(s)&&(s=CK(s,e)),uR(n)&&(n=CK(n,i)),{x:s,y:n}}function FK(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}=DK(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=>DK(t,n,r)))}function zK(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 jK(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},zO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},VK(zO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=VK(zO(r),i,s)),t}return{visible:!1}}function HK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function VK(t,e,i){return d(t)?t(e,i):t}function NK(t,e){return d(t)?t(e):t}function UK(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 WK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=WK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function YK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=WK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function $K(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function XK(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])&&BK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&BK(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])&&BK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&BK(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=>qK(i,t,e))):i.x=qK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>qK(i,t,e))):i.y=qK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>qK(i,t,e))):i.angle=qK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>qK(i,t,e))):i.radius=qK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=qK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const KK={min:(t,e)=>RL(t[0].latestData,e.field),max:(t,e)=>OL(t[0].latestData,e.field),sum:function(t,e){return IL(t[0].latestData,e.field)},average:function(t,e){return DL(t[0].latestData,e.field)},variance:function(t,e){return FL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(FL(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 qK(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(m(t)){const{aggrType:i,field:s}=t;return KK[i](e,{field:s})}return t}function ZK(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 JK extends Lz{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 zD(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)&&BK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=UL(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){u(this._spec.offsetX)||(this._layoutOffsetX=gR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=gR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerFilter",ZK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function QK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=RL(t,e),r=OL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class tq extends JK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=GK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:VK(zO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{line:HK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return HK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return HK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:VK(zO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:VK(zO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=zK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=GK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerRegression",QK),JO(this._option.dataSet,"markerFilter",ZK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}tq.specKey="markLine";const eq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},sq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eq(!1),endSymbol:eq(!0),label:iq};class nq extends tq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new CP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=GK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=PK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=OK(i,r,d,e.coordinatesOffset):c&&(y=FK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(uR(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:u}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&p(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=Y(n.label),_=Y(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:u,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=GK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}nq.type=r.markLine,nq.coordinateType="cartesian",nq.builtInTheme={markLine:sq};class rq extends tq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=GK(this._spec);return e||i?new PP(t):new CP(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}=GK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=IK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=GK(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}}}rq.type=r.polarMarkLine,rq.coordinateType="polar",rq.builtInTheme={polarMarkLine:sq};class aq extends Lz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=dR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return zD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=gR(this._spec.width,l.width,null,l.width),c=gR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new sL(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}}aq.type=r.title,aq.specKey=r.title,aq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class oq extends JK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=YK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:VK(zO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{area:HK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>HK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return HK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=zK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=YK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}oq.specKey="markArea";const lq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class hq extends oq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new BP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=YK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=OK(s,a,u,i.coordinatesOffset):d&&(f=FK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=YK(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}}}hq.type=r.markArea,hq.coordinateType="cartesian",hq.builtInTheme={markArea:lq};class cq extends oq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=YK(this._spec);return i||e||s?new LP(t):new BP(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}=YK(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=RK(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=IK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=YK(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}}}cq.type=r.polarMarkArea,cq.coordinateType="polar",cq.builtInTheme={polarMarkArea:lq};const dq=t=>zO(Object.assign({},t)),uq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},zO(t.style))}),pq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=dq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=dq(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:{},zO(Object.assign({},y)));var y;const b=uq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=uq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=uq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=uq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},gq=t=>"left"===t||"right"===t,fq=t=>"top"===t||"bottom"===t,mq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class vq extends Lz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},pq(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({},pq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new yL(t):this._playerComponent=new SL(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=gq(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=gq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(pL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(pL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(pL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=gq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=fq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):gq(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))):fq(this._orient)?this._maxSize():t.height}_computeDx(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return fq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}vq.builtInTheme={player:mq},vq.specKey="player",vq.type=r.player;class _q extends Lz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=eR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==EI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}_q.type=r.label;class yq extends dN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}yq.type="text",yq.constructorType="label";const bq=()=>{uN(),CR.registerMark(yq.constructorType,yq)};class xq extends Pz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sq extends _q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=xq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(UO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(UO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),VL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=wR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},PV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[fO])):t=>t.filter((t=>t.data[gO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?LV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Sq.type=r.label,Sq.specKey="label",Sq.transformerConstructor=xq;class Aq extends _q{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[uO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return wR({textStyle:{pickable:!0===this._spec.interactive},position:kq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[fO]:t.data[gO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>LV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function kq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Aq.type=r.totalLabel,Aq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Aq.specKey="totalLabel";class Mq extends JK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=$K(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=jK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=VK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=zO(VK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=VK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=VK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:NK(R.offsetX,this._relativeSeries.getRegion()),offsetY:NK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:VK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:VK(I.style,this._markerData,this._markAttributeContext)},state:{line:HK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:HK(J,this._markerData,this._markAttributeContext),textBackground:HK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:HK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:zO(st.style)}):{visible:!1};return new OP(et)}_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}=zK([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:UK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:UK(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}=$K(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Mq.specKey="markPoint";const Tq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class wq extends Mq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=PK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=OK(n,r,h,s.coordinatesOffset)[0]:l&&(c=FK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=$K(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}}}wq.type=r.markPoint,wq.coordinateType="cartesian",wq.builtInTheme={markPoint:Tq};class Cq extends Mq{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=RK(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:he({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}])]}}}Cq.type=r.polarMarkPoint,Cq.coordinateType="polar",Cq.builtInTheme={polarMarkPoint:Tq};class Eq extends Mq{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}])]}}}Eq.type=r.geoMarkPoint,Eq.coordinateType="geo",Eq.builtInTheme={geoMarkPoint:Tq};const Bq="inBrush",Pq="outOfBrush";class Lq extends Lz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Bq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Pq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new TL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:zO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(bL.brushActive,(s=>{this._initMarkBrushState(i,Pq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(bL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(bL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(bL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},zO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Bq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Bq),i.addState(Pq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Bq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Bq),i.addState(Pq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Bq),s.removeState(Pq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Lq.type=r.brush,Lq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Lq.specKey="brush";class Rq extends Lz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${ZR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=pF({},gF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Rq.type=r.customMark,Rq.specKey="customMark";class Oq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Iq(t))),a=n.filter((t=>!Iq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Iq(t))),h=o.filter((t=>!Iq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Iq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Oq.type="grid";const Dq="vchart-tooltip",Fq=`${Dq}-container`,zq=`${Dq}-title`,jq=`${Dq}-content-box`,Hq={offsetX:10,offsetY:10},Vq="99999999999999";function Nq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Uq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Wq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Nq(t):"",Gq=(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},Yq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},$q=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Yq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class Xq extends az{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=ND(null==T?void 0:T.position,b,e),C=null!==(r=ND(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:JR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:QR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Uq(e,F),V=Uq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch($q(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Gq(t,_),W.top=Gq(i,_),W.right=Gq(e,_),W.bottom=Gq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Gq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=$q(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",qq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Kq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Kq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},Zq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?gR(e,t.fontSize):0},Jq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Kq(o)),{panelStyle:a,panelPadding:o}};function Qq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class tZ extends Xq{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(tZ.type),this.type=iH.dom,this._tooltipContainer=null==Ny?void 0:Ny.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Ny&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Jq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Kq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=qq(h),x=qq(d),S=qq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Kq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Kq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Kq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(Zq(p),Zq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(zq))),l=a.find((t=>t.className.includes(jq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(zq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Qq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Dq}-column`),e.classList.add(`${Dq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(jq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Qq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Qq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Dq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Wq(e.key),e.keyStyle&&qq(e.keyStyle,l)):"value"===i?(o.innerHTML=Wq(e.value),e.valueStyle&&qq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Nq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Nq(c):m,y=p,b=t=>new Ag({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=dh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Nq(u):"currentColor",`\n \n \n \n `;const w=T?dh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Qq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(jq))),h=[...o.children].find((t=>t.className.includes(zq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(zq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=gR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Qq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},cf||(cf=lf.CreateGraphic("richtext",{})),cf.setAttributes(a),cf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function sZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nZ=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 rZ extends Xq{constructor(){super(rZ.type),this.type=iH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=vR(d.padding),x=sZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=sZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=sZ(m,i),k={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},M={panel:nZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=wR({},S,sZ(b,void 0,{})),{width:s,height:n,text:r}=iZ(h,i);T.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(m)){const t=wR({},A,sZ(x,void 0,{})),{width:e,height:s,text:n}=iZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=wR({},x,sZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=iZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}rZ.type=iH.canvas;const aZ=/\{([^}]+)\}/,oZ=/\{([^}]+)\}/g,lZ=/:/;class hZ extends az{constructor(){super(hZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[hZ.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)),CR.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=aZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(oZ,((t,i)=>{if(!lZ.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(bi.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}}hZ.pluginType="chart",hZ.specKey="formatter",hZ.type="formatterPlugin";LD.useRegisters([()=>{oH(),hH(),dH(),zj(),Fj(),Sj(),pj(),KF(),ZF(),xD(),_D(),aj(),ij(),CR.registerSeries(Aj.type,Aj),CR.registerChart(uH.type,uH)},()=>{oH(),hH(),dH(),Fj(),Sj(),pj(),KF(),fH(),ZF(),_H(),aj(),ij(),CR.registerSeries(bH.type,bH),zj(),CR.registerChart(SH.type,SH)},()=>{oH(),hH(),dH(),Fj(),DH(),zj(),CR.registerChart(zH.type,zH)},()=>{oH(),hH(),zj(),Fj(),XH(),CR.registerChart(qH.type,qH)},()=>{hH(),YN(),CR.registerChart(H$.type,H$)},()=>{oH(),hH(),zj(),Fj(),dU(),CR.registerChart(U$.type,U$)},()=>{oH(),hH(),dH(),zj(),Fj(),bU(),CR.registerChart(G$.type,G$)},()=>{oH(),hH(),dH(),zj(),Fj(),DH(),CR.registerChart(Z$.type,Z$)},()=>{hH(),uV(),iV(),CR.registerSeries(gV.type,gV),CR.registerImplement("registerMap",sI),CR.registerImplement("unregisterMap",nI),yD(),CR.registerChart(O$.type,O$)},()=>{hH(),JY(),CR.registerSeries(t$.type,t$),HN(),IU(),oU(),zU(),CR.registerChart(eX.type,eX)},()=>{hH(),MG(),CR.registerChart(nX.type,nX)},()=>{hH(),GG(),CR.registerChart(aX.type,aX)},()=>{oH(),hH(),dH(),zj(),Fj(),UV(),CR.registerChart(_X.type,_X)},()=>{oH(),hH(),zj(),Fj(),cN(),CR.registerChart(bX.type,bX)},()=>{oH(),hH(),zj(),Fj(),zU(),CR.registerChart(Q$.type,Q$)},()=>{oH(),hH(),zj(),Fj(),YU(),CR.registerChart(lX.type,lX)},()=>{oH(),hH(),zj(),Fj(),xN(),CR.registerChart(cX.type,cX)},()=>{oH(),hH(),dH(),zj(),Fj(),fH(),aj(),ij(),CR.registerSeries(TN.type,TN),CR.registerChart(kX.type,kX)},()=>{hH(),hY(),CR.registerChart(uX.type,uX)},()=>{hH(),fY(),CR.registerChart(gX.type,gX)},()=>{hH(),NY(),CR.registerChart(mX.type,mX)},()=>{hH(),Bh.load(gM),OY(),CR.registerChart(SX.type,SX)},()=>{hH(),o$(),CR.registerChart(TX.type,TX)},()=>{hH(),b$(),CR.registerChart(CX.type,CX)},()=>{oH(),hH(),dH(),zj(),CR.registerChart($$.type,$$),Fj()},ij,aj,()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(oj.type,oj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(lj.type,lj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(hj.type,hj)},hU,oU,()=>{CR.registerComponent(RX.type,RX)},()=>{CR.registerComponent(WX.type,WX)},()=>{CR.registerComponent(tK.type,tK)},()=>{CR.registerComponent(aK.type,aK)},()=>{CR.registerComponent(oK.type,oK)},()=>{CR.registerComponent(fK.type,fK)},()=>{CR.registerComponent(vK.type,vK)},()=>{CR.registerComponent(xK.type,xK)},uV,()=>{CR.registerComponent(nq.type,nq),wP()},()=>{CR.registerComponent(hq.type,hq),EP()},()=>{CR.registerComponent(wq.type,wq),RP()},()=>{CR.registerComponent(rq.type,rq),PP._animate=lP,wP()},()=>{CR.registerComponent(cq.type,cq),LP._animate=cP,EP()},()=>{CR.registerComponent(Cq.type,Cq),RP()},()=>{CR.registerComponent(Eq.type,Eq),RP()},()=>{CR.registerComponent(aq.type,aq)},()=>{CR.registerComponent(vq.type,vq)},()=>{CR.registerGraphicComponent(Sq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Sq.type,Sq,!0,1/0)},()=>{CR.registerGraphicComponent(Aq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Aq.type,Aq,!0)},()=>{CR.registerComponent(Lq.type,Lq)},()=>{CR.registerComponent(Rq.type,Rq)},()=>{Bh.load(sT)},()=>{CR.registerLayout(Oq.type,Oq)},()=>{var t;t=rZ,CR.registerComponentPlugin(t.type,t)},()=>{var t;t=hZ,CR.registerChartPlugin(t.type,t)},wD,BD]),LD.useRegisters([()=>{NS(Bh)}]),t.DEFAULT_CHART_HEIGHT=QR,t.DEFAULT_CHART_WIDTH=JR,t.DEFAULT_CLOSE_STROKE_JOIN=ID,t.DEFAULT_DATA_INDEX=eO,t.DEFAULT_DATA_KEY=iO,t.DEFAULT_DATA_SERIES_FIELD=sO,t.DEFAULT_KEY=SO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=OD,t.DEFAULT_MEASURE_CANVAS_ID=tO,t.DEFAULT_SERIES_STYLE_NAME=nO,t.DEFAULT_SMOOTH_INTERPOLATE=RD,t.Factory=CR,t.MOSAIC_CAT_END_PERCENT=yO,t.MOSAIC_CAT_START_PERCENT=_O,t.MOSAIC_VALUE_END_PERCENT=vO,t.MOSAIC_VALUE_START_PERCENT=mO,t.ManualTicker=class extends aw{constructor(t){super(t),this.lastFrameTime=0,this.status=wo.RUNNING}setupTickHandler(){const t=new ow;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,!0}},t.PREFIX=ZR,t.SEGMENT_FIELD_END=xO,t.SEGMENT_FIELD_START=bO,t.STACK_FIELD_END=oO,t.STACK_FIELD_END_OffsetSilhouette=dO,t.STACK_FIELD_END_PERCENT=hO,t.STACK_FIELD_KEY=rO,t.STACK_FIELD_START=aO,t.STACK_FIELD_START_OffsetSilhouette=cO,t.STACK_FIELD_START_PERCENT=lO,t.STACK_FIELD_TOTAL=uO,t.STACK_FIELD_TOTAL_BOTTOM=fO,t.STACK_FIELD_TOTAL_PERCENT=pO,t.STACK_FIELD_TOTAL_TOP=gO,t.StreamLight=class extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=vo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new zl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=vo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=nl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=nl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?hG(t,o,l.width,l.height,h):"geometric"===t.type&&uG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=ZW(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()}};pG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class gG extends eG{constructor(t){super(j({},gG.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)}gG.defaultOptions={enlarge:!1};const mG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},vG=(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?_G(t.fontFamily):"sans-serif",d=t.fontStyle?_G(t.fontStyle):"normal",u=t.fontWeight?_G(t.fontWeight):"normal",p=t.rotate?_G(t.rotate):0,g=_G(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?_G(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},mG),t.as):mG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?_G(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=bG(xG(t,l),C);w=i=>e(t(i))}let E=sG;"fast"===t.layoutType?E=gG:"grid"===t.layoutType&&(E=pG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},_G=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],yG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),bG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=yG(t[0]),n=yG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(yG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},xG=(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 SG(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{wR.registerGrammarTransform("wordcloud",{transform:vG}),dN(),wR.registerAnimation("wordCloud",((t,e)=>({appear:eW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),wR.registerSeries(AG.type,AG)},MG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},TG=(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},wG=`${qR}_FUNNEL_TRANSFORM_RATIO`,CG=`${qR}_FUNNEL_REACH_RATIO`,EG=`${qR}_FUNNEL_HEIGHT_RATIO`,BG=`${qR}_FUNNEL_VALUE_RATIO`,PG=`${qR}_FUNNEL_LAST_VALUE_RATIO`,LG=`${qR}_FUNNEL_NEXT_VALUE_RATIO`,RG=`${qR}_FUNNEL_LAST_VALUE`,OG=`${qR}_FUNNEL_CURRENT_VALUE`,IG=`${qR}_FUNNEL_NEXT_VALUE`,DG=`${qR}_FUNNEL_TRANSFORM_LEVEL`;class FG extends YD{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[CG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class zG extends rD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class jG extends zG{constructor(){super(...arguments),this.type=jG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}jG.type="polygon";const HG=()=>{wR.registerMark(jG.type,jG),Xk(),Nk(),lw.registerBuiltInAnimate("growPointsOut",rC),wR.registerGraphicComponent("polygon",af)},VG=Object.assign(Object.assign({},nF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class NG extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class UG extends xF{constructor(){super(...arguments),this.type=YL.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=NG,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;ZO(this._dataSet,"funnel",MG),ZO(this._dataSet,"funnelTransform",TG);const t=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new tD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:OG,asTransformRatio:wG,asReachRatio:CG,asHeightRatio:EG,asValueRatio:BG,asNextValueRatio:LG,asLastValueRatio:PG,asLastValue:RG,asNextValue:IG,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:DG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},UG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:mF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},UG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(UG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(UG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new FG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Iy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*UL(CG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),pF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("fadeInOut")(),pF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("funnel")({},o),pF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uF(null===(a=wR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pF("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[PG])/2:this._getSecondaryAxisLength(t[BG])/2,n=this._getSecondaryAxisLength(t[BG])/2):(s=this._getSecondaryAxisLength(t[BG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LG])/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[DG])}_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[eO]===t[eO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{HG(),dN(),AV(),wR.registerSeries(UG.type,UG),wR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},mD))),wR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),_D()},GG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},YG=t=>{const e=t.filter((t=>t.context.diffState===CI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},$G=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},XG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),KG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},qG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),ZG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},JG=(t,e={})=>{if(!t)return[];const i=[];return rW(t,i,e),i},QG=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LW(i).layout(t,{width:s,height:n})};class tY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var eY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(eY||(eY={}));const iY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===eY.DrillDown){return Y(PO(t,n,s,"children"))}if(i.type===eY.DrillUp){const e=LO(t,n,s,"children");if(e)return Y(e)}return t};class sY{_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;ZO(t,"drillFilter",iY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:eY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:eY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:eY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:eY.DrillUp},model:this}),r}}const nY=Object.assign(Object.assign({},nF),{sunburst:{name:"sunburst",type:"arc"}}),rY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ZD,operations:["max","min","values"]}),t.push({key:JD,operations:["values"]}),t),aY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class oY extends TN{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),ZO(this._dataSet,"sunburstLayout",QG),ZO(this._dataSet,"flatten",JG),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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(oY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(oY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new tY(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(uF(null===(e=wR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}oY.type=YL.sunburst,oY.mark=nY,oY.builtInTheme={sunburst:aY},G(oY,sY);const lY=()=>{wR.registerSeries(oY.type,oY),jN(),dN(),_D(),wR.registerAnimation("sunburst",((t,e)=>({appear:ZG(0,e),enter:XG(t),exit:qG(t),disappear:qG(t)})))},hY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new xW(i).layout(t,{width:s,height:n})};class cY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const dY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},uY=Object.assign(Object.assign({},nF),{circlePacking:{name:"circlePacking",type:"arc"}});class pY extends kF{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},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),ZO(this._dataSet,"circlePackingLayout",hY),ZO(this._dataSet,"flatten",JG),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)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return rY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new cY(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(uF(null===(i=wR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}pY.type=YL.circlePacking,pY.mark=uY,pY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(pY,sY);const gY=()=>{wR.registerSeries(pY.type,pY),jN(),dN(),vD(),wR.registerAnimation("circlePacking",((t,e)=>({appear:dY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},fY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&fY(t,e.children,i)}))},mY=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},vY=(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 EW(e),r=[];return r.push(n.layout(s,i)),r},_Y=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:[]},yY=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 bY extends YD{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 xY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),SY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:xY(t),AY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class kY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class MY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const TY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},wY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class CY extends $V{constructor(){super(...arguments),this.type=CY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?wY:TY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}CY.type="linkPath";const EY=Object.assign(Object.assign({},nF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class BY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const PY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class LY extends kF{constructor(){super(...arguments),this.type=YL.sankey,this.transformerConstructor=BY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=jO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=jO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=jO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),PY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=jO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=jO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=jO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=jO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=jO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(jO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=jO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=jO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){ZO(this._dataSet,"sankeyLayout",vY),ZO(this._dataSet,"sankeyFormat",mY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;ZO(o,"sankeyNodes",_Y),ZO(o,"flatten",JG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._nodesSeriesData=l,ZO(o,"sankeyLinks",yY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(LY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(LY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=DD(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(uF(null===(i=wR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),pF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),pF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:YO.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(jO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new bY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new rR;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 fY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}LY.type=YL.sankey,LY.transformerConstructor=BY,LY.mark=EY,LY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const RY=()=>{EH(),XV(),Hk(),wR.registerGraphicComponent("path",(t=>qg(t))),wR.registerMark(CY.type,CY),dN(),wR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:SY(t,e)},mD))),wR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:AY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lw.registerBuiltInAnimate("linkPathGrowOut",MY),lw.registerBuiltInAnimate("linkPathGrowIn",kY),_D(),wR.registerSeries(LY.type,LY)},OY=(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=JG(n);return i=XD([{latestData:r}],e),i};class IY extends YD{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 DY=Object.assign(Object.assign({},nF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class zY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const jY=(t,e)=>{if(e.getViewBox()){const i=new DW(e).layout(t,e.getViewBox()),s=[];return rW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[JD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class HY extends kF{constructor(){super(...arguments),this.type=YL.treemap,this.transformerConstructor=zY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:JD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:eO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),ZO(this._dataSet,"treemap",jY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=OY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){ZO(this._dataSet,"hierarchyDimensionStatistics",OY),ZO(this._dataSet,"flatten",JG);const i=new wa(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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(HY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(HY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pF(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 IY(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(NO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(NO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=YL.treemap,HY.mark=DY,HY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},HY.transformerConstructor=zY,G(HY,sY),G(HY,lV);const VY=()=>{wR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),wR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),EH(),dN(),wR.registerAnimation("treemap",((t,e)=>({appear:FY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),_D(),wR.registerSeries(HY.type,HY)},NY=Object.assign(Object.assign({},EU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),UY=Object.assign(Object.assign({},nF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),WY={type:"fadeIn"};function GY(t,e){return"fadeIn"===e?WY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class YY extends bF{constructor(){super(...arguments),this._supportStack=!1}}class $Y extends YD{enableByType(t){return"dimension"!==t}}const XY="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",KY={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:XY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:XY,fill:"#ddd"}}};class qY extends BU{constructor(){super(...arguments),this.type=YL.gaugePointer,this.transformerConstructor=YY,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(qY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},qY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(qY.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 $Y(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}qY.type=YL.gaugePointer,qY.mark=UY,qY.builtInTheme={gaugePointer:KY},qY.transformerConstructor=YY;const ZY=()=>{wR.registerSeries(qY.type,qY),eV(),EH(),wR.registerAnimation("gaugePointer",((t,e)=>{const i=GY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),lU(),aU()};class JY extends bF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class QY extends BU{constructor(){super(...arguments),this.type=YL.gauge,this.transformerConstructor=JY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();ZO(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[bO]=t[this._angleField[0]],t[yO]=e>0?i[e-1][bO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(QY.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(QY.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[yO])?this.angleAxisHelper.dataToPosition([t[yO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[bO]])}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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}QY.type=YL.gauge,QY.mark=NY,QY.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},QY.transformerConstructor=JY;class t$ extends rD{constructor(){super(...arguments),this.type=t$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Mg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}t$.type="cell";function e$(t){return!1===t?{}:{type:"fadeIn"}}class i$ extends YD{enableByType(t){return"dimension"!==t}}const s$=Object.assign(Object.assign({},nF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class n$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class r$ extends kF{constructor(){super(...arguments),this.type=YL.heatmap,this.transformerConstructor=n$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(r$.mark.cell,{isSeriesMark:!0},{morph:mF(this._spec,r$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(r$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=AF(this);this._cellMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pF("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 i$(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]}}r$.type=YL.heatmap,r$.mark=s$,r$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},r$.transformerConstructor=n$;const a$=()=>{dN(),wR.registerMark(t$.type,t$),wR.registerGraphicComponent("symbol",Mg),Xk(),qk(),yB(),wR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},mD),{appear:e$(e)}))),rj(),ej(),wR.registerSeries(r$.type,r$)},o$=Object.assign(Object.assign({},nF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),l$=`${qR}_CORRELATION_X`,h$=`${qR}_CORRELATION_Y`,c$=`${qR}_CORRELATION_SIZE`,d$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=u$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),p$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},p$=(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,[tO]:null==n?void 0:n[tO],[iO]:null==n?void 0:n[iO]}};class f$ extends $V{constructor(){super(...arguments),this.type=f$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}f$.type="ripple";const m$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class v$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class _$ extends TN{constructor(){super(...arguments),this.type=YL.correlation,this.transformerConstructor=v$,this._viewBox=new He}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;ZO(this._dataSet,"correlation",d$);const s=new Ta;JO(s,"dataview",Aa),ZO(s,"correlationCenter",g$);const n=new wa(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 tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(_$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:tO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(_$.mark.ripplePoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(_$.mark.centerPoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[l$],y:t=>t[h$],size:t=>t[c$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}_$.type=YL.correlation,_$.mark=o$,_$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},_$.transformerConstructor=v$;const y$=()=>{qF(),XV(),qk(),wR.registerMark(f$.type,f$),wR.registerGraphicComponent("symbol",(t=>Mg(t))),wR.registerSeries(_$.type,_$),wR.registerAnimation("correlation",((t,e)=>Object.assign({appear:m$(0,e)},fD)))},b$=Object.assign(Object.assign({},nF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class x$ extends $V{constructor(){super(...arguments),this.type=x$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}x$.type="liquid";const S$=(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 A$ extends YD{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 k$ extends xF{constructor(){super(...arguments),this.type=YL.liquid,this.transformerConstructor=ZF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Lg({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=Mg({x:s,y:n,size:r,symbolType:S$(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=mR(this._spec.outlineMargin),this._paddingSpec=mR(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=Gt(...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(k$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(k$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(k$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(k$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new A$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),pF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),pF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=bM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}k$.type=YL.liquid,k$.mark=b$,k$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},k$.transformerConstructor=ZF;const M$=t=>Y(t).join(",");class T$ extends YD{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const w$=Object.assign(Object.assign({},nF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class C$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const E$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?XW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class B$ extends xF{constructor(){super(...arguments),this.type=YL.venn,this.transformerConstructor=C$,this._viewBox=new He}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:eO)}initData(){var t;super.initData(),ZO(this._dataSet,"venn",E$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(B$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(B$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new T$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:M$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return M$(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[M$(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(M$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}}B$.type=YL.venn,B$.mark=w$,B$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},B$.transformerConstructor=C$;class P$ extends OH{constructor(){super(...arguments),this.type=YL.mosaic,this.transformerConstructor=RH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(mO),this.setFieldX2(fO)),this.setFieldY(_O),this.setFieldY2(vO)):(t&&(this.setFieldY(mO),this.setFieldY2(fO)),this.setFieldX(_O),this.setFieldX2(vO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}P$.type=YL.mosaic,P$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},P$.transformerConstructor=RH;class L$ extends Cj{_isValidSeries(t){return t===YL.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class R$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="map",this.seriesType=YL.map}}R$.type="map",R$.seriesType=YL.map,R$.transformerConstructor=L$;class O$ extends Cj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 I$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=hz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,TR({},s,l)),n&&Object.assign(o,TR({},n,o))}}class D$ extends O${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class F$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class z$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=F$}}z$.transformerConstructor=F$;class j$ extends z${constructor(){super(...arguments),this.transformerConstructor=F$,this.type="pie",this.seriesType=YL.pie}}j$.type="pie",j$.seriesType=YL.pie,j$.transformerConstructor=F$;class H$ extends D${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Mz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Mz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const V$=(t,e)=>{if(!t)return null;const i=zF(t,(t=>"angle"===t.getOrient()),e),s=zF(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&&zC(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=FL({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=zL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=DF(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&&zC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=zL(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 _=DF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class N$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="rose",this.seriesType=YL.rose}_setModelOption(){this._modelOption.getDimensionInfo=V$}}N$.type="rose",N$.seriesType=YL.rose,N$.transformerConstructor=H$,G(N$,Rj);class U$ extends D${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=TR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class W$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="radar",this.seriesType=YL.radar}_setModelOption(){this._modelOption.getDimensionInfo=V$}}W$.type="radar",W$.seriesType=YL.radar,W$.transformerConstructor=U$,G(W$,Rj);class G$ extends Cj{_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=>{L(e,"trimPadding")&&TR(e,kI(this.type,t))})),this._transformAxisSpec(t)}}class Y$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Uj(t,e,i))&&void 0!==s?s:[],...null!==(n=V$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}Y$.type="common",Y$.transformerConstructor=G$,G(Y$,Rj);class $$ extends Ej{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class X$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=$$}}X$.transformerConstructor=$$,G(X$,Rj);class K$ extends $${transformSpec(t){super.transformSpec(t),xI(t)}}class q$ extends X${constructor(){super(...arguments),this.transformerConstructor=K$,this.type="histogram",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}q$.type="histogram",q$.seriesType=YL.bar,q$.transformerConstructor=K$;class Z$ extends I${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class J$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="circularProgress",this.seriesType=YL.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=V$}}J$.type="circularProgress",J$.seriesType=YL.circularProgress,J$.transformerConstructor=Z$,G(J$,Rj);class Q$ extends I${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=YL.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===YL.gauge||t.type===YL.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===YL.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class tX extends Tj{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="gauge",this.seriesType=YL.gaugePointer}}tX.type="gauge",tX.seriesType=YL.gaugePointer,tX.transformerConstructor=Q$;class eX extends Cj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class iX extends Tj{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}iX.transformerConstructor=eX;class sX extends iX{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}sX.type="wordCloud",sX.seriesType=YL.wordCloud,sX.transformerConstructor=eX;class nX extends Cj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class rX extends Tj{constructor(){super(...arguments),this.transformerConstructor=nX,this.type="funnel",this.seriesType=YL.funnel}}rX.type="funnel",rX.seriesType=YL.funnel,rX.transformerConstructor=nX;class aX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=hz(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=hz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class oX extends Tj{constructor(){super(...arguments),this.transformerConstructor=aX,this.type="linearProgress",this.seriesType=YL.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}oX.type="linearProgress",oX.seriesType=YL.linearProgress,oX.transformerConstructor=aX,G(oX,Rj);class lX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),xI(t)}}class hX extends Tj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rangeColumn",this.seriesType=YL.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}hX.type="rangeColumn",hX.seriesType=YL.rangeColumn,hX.transformerConstructor=lX;class cX extends Cj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dX extends Tj{constructor(){super(...arguments),this.transformerConstructor=cX,this.type="sunburst",this.seriesType=YL.sunburst}}dX.type="sunburst",dX.seriesType=YL.sunburst,dX.transformerConstructor=cX;class uX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class pX extends Tj{constructor(){super(...arguments),this.transformerConstructor=uX,this.type="circlePacking",this.seriesType=YL.circlePacking}}pX.type="circlePacking",pX.seriesType=YL.circlePacking,pX.transformerConstructor=uX;class gX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fX extends Tj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="treemap",this.seriesType=YL.treemap}}fX.type="treemap",fX.seriesType=YL.treemap,fX.transformerConstructor=gX;class mX extends DH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),xI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class vX extends FH{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="waterfall",this.seriesType=YL.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}vX.type="waterfall",vX.seriesType=YL.waterfall,vX.transformerConstructor=mX;class _X extends Ej{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),xI(t)}}class yX extends Tj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="boxPlot",this.seriesType=YL.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}yX.type="boxPlot",yX.seriesType=YL.boxPlot,yX.transformerConstructor=_X;class bX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xX extends Tj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="sankey",this.seriesType=YL.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=jO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}xX.type="sankey",xX.seriesType=YL.sankey,xX.transformerConstructor=bX;class SX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),xI(t)}}class AX extends Tj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeArea",this.seriesType=YL.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}AX.type="rangeArea",AX.seriesType=YL.rangeArea,AX.transformerConstructor=SX;class kX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class MX extends Tj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="heatmap",this.seriesType=YL.heatmap}}MX.type="heatmap",MX.seriesType=YL.heatmap,MX.transformerConstructor=kX;class TX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Tj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="correlation",this.seriesType=YL.correlation}}wX.type="correlation",wX.seriesType=YL.correlation,wX.transformerConstructor=TX;function CX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=FO(t.style)),P(t.textStyle)||TR(s.textStyle,FO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&FO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&FO(s.background.style),s}const EX=(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},BX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:iO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class PX extends Pz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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=cR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new tD(this._option,e),this._initSelectedData(),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(HL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(TR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}PX.specKey="legends";class LX extends PX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZO(this._option.dataSet,"discreteLegendFilter",BX),ZO(this._option.dataSet,"discreteLegendDataMake",EX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HL(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(!Xy(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=kO(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:f,regionIndex:m,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=CX(s):b.title={visible:!1},P(n.focusIconStyle)||FO(n.focusIconStyle),n.shape&&(n.shape=OO(n.shape)),n.label&&(n.label=OO(n.label)),n.value&&(n.value=OO(n.value)),n.background&&(n.background=OO(n.background)),dR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),dR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),dR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||FO(r.railStyle),P(r.sliderStyle)||FO(r.sliderStyle)):(P(r.textStyle)||FO(r.textStyle),r.handler&&OO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(TR(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 XP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(VP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(VP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(VP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=DD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=DD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}LX.specKey="legends",LX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},LX.type=r.discreteLegend;const RX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},OX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?RO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const IX={color:QP,size:eL},DX={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}},FX=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({},DX),{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"}}}})},zX={horizontal:FX(!0),vertical:FX(!1)},jX=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({},DX),{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"}}}})},HX={horizontal:jX(!0),vertical:jX(!1)},VX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],NX=[2,10];class UX extends PX{static getSpecInfo(t){const e=FD(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(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){ZO(this._option.dataSet,"continuousLegendFilter",OX),ZO(this._option.dataSet,"continuousLegendDataMake",RX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>VL(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=kO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=kO(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()),P(a)&&(a="color"===this._legendType?VX:NX);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=TR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=CX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=FO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=FO(r.style)),P(a.style)||(w.trackStyle=FO(a.style)),w.startText=OO(o),w.endText=OO(l),w.handlerText=OO(h),P(c)||(w.sizeBackground=FO(c)),d.visible&&!P(d.style)&&(TR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return IX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}UX.specKey="legends",UX.builtInTheme={colorLegend:zX,sizeLegend:HX},UX.type=r.continuousLegend;const WX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,GX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),YX=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function $X(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=XX(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=>GX(i,s)(t)&&GX(n,r)(t)&&(u(a)||GX([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: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:GO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.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:GO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.hideTooltip(l.id),c}return"none"}const XX=(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=WX(c,t);let _=WX(d,t);const y=YX(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(GX(c,v));if(!y&&(_=WX(d,i),!YX(_)))return;const n=e.type===YL.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=zC(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(GX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=WX(d,o),!YX(_))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(GX(c,n));if(!y&&(_=WX(d,r),!YX(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===YL.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(GX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=WX(d,i),!YX(_))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},KX=t=>p(t)&&!y(t),qX=t=>p(t)&&y(t);class ZX extends Bz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=TR({},this._theme,r.style),r.offset=TR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Wy(this._option.mode)||!Ny(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=b_.getElementById(t.parentElement)):Ny(this._option.mode)&&(t.parentElement=null==Vy?void 0:Vy.body)}}const JX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class QX extends Pz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=ZX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Ny(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&KX(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&&PD.globalConfig.uniqueTooltip&&l&&PD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:GO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:GO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?eH.canvas:eH.dom,n=wR.getComponentPluginInType(t);n||zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=wR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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)||Wy(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=$X(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(qX(t)){if(KX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>OF(t,e[i])))}if(qX(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}}QX.type=r.tooltip,QX.transformerConstructor=ZX,QX.builtInTheme={tooltip:JX},QX.specKey="tooltip";var tK,eK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(tK||(tK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eK||(eK={}));const iK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class sK extends Pz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{zC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:YO.chart}:{source:GO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Uy(e)||Wy(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(t.ChartEvent.tooltipHide,{source:GO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:GO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:GO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{iK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}sK.specKey="crosshair";const nK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class rK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=MF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){MF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:TF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"cartesian");e&&(Yj(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=Kj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new nT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new rT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}rK.specKey="crosshair",rK.builtInTheme={crosshair:nK},rK.type=r.cartesianCrosshair;class aK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=lz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=DD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new nT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new oT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new aT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:nK},aK.type=r.polarCrosshair;const oK=(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},lK=(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)},hK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class cK extends Pz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=CF(t),this._isHorizontal="horizontal"===EF(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=>!DC(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(DC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};HL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,DC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;DC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else HL(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:n}=this._option;JO(n,"dataview",Aa),ZO(n,"dataFilterComputeDomain",hK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new tD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(DC(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&&DC(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,DC(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=DC(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 rE,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||(ZO(this._option.dataSet,"dataFilterWithNewDomain",lK),ZO(this._option.dataSet,"lockStatisticsFilter",oK),HL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(DC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&zC(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,zC(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]}clear(){this._throttledHide=null}}G(cK,lV);class dK extends Bz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=TR({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}}}const uK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),pK={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:uK(!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:uK(!0)};class gK extends cK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=dK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new TE;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(!DC(t.type)||e[0]!==$(e))&&(!zC(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 NB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:FO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:FO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:FO(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:FO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:FO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:FO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:FO(g.style)},selectedBackgroundStyle:FO(this._spec.selectedBackground.style),dragMaskStyle:FO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:TR(FO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:TR(FO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(d=m.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}=DD(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()}}gK.type=r.dataZoom,gK.transformerConstructor=dK,gK.builtInTheme={dataZoom:pK},gK.specKey="dataZoom";const fK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class mK extends cK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 hM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=PL(this._start,e)&&PL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=FO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=FO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}mK.type=r.scrollBar,mK.builtInTheme={scrollBar:fK},mK.specKey="scrollBar";const vK=(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},_K=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),yK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:_K("l1FontSize","primaryFontColor")},content:{visible:!0,style:_K("l2FontSize","tertiaryFontColor")}};class bK extends Pz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return FD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZO(this._option.dataSet,"indicatorFilter",vK);const t=new wa(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 tD(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=TR({},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({},DO(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?_R(l,this._computeLayoutRadius()):0,dy:h?_R(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({},DO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bK.type=r.indicator,bK.builtInTheme={indicator:yK},bK.specKey="indicator";const xK=["sum","average","min","max","variance","standardDeviation","median"];function SK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function AK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SK(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=dR(t.x)?wK(t.x,n)+r.x:CK(l.getXAxisHelper(),[t.x])+r.x,h}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SK(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=dR(t.y)?wK(t.y,n)+r.y:CK(l.getYAxisHelper(),[t.y])+r.y,h}function MK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SK(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)),CK(a.angleAxisHelper,[t.angle])}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SK(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)),CK(a.radiusAxisHelper,[t.radius])}function wK(t,e){return Number(t.substring(0,t.length-1))*e/100}function CK(t,e){const i=t.getScale(0);return DC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function EK(t){return xK.includes(t)}function BK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=AK(t,_,n,u,c,o),r=kK(t,y,n,u,d,o),PK(s,b,S,g.length),PK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=AK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);PK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=kK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);PK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function PK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MK(t,l,n,r),i=TK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function RK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=dR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=dR(i)?Number(i.substring(0,i.length-1))*f/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])&&SK(_,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])&&SK(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:CK(d.getXAxisHelper(),b)+p.x+m,y:CK(d.getYAxisHelper(),x)+p.y+v})})),n}function OK(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])&&SK(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])&&SK(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:CK(l.angleAxisHelper,d),radius:CK(l.radiusAxisHelper,u)})})),s}function IK(t,e,i){let{x:s,y:n}=t;return dR(s)&&(s=wK(s,e)),dR(n)&&(n=wK(n,i)),{x:s,y:n}}function DK(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}=IK(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=>IK(t,n,r)))}function FK(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 zK(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},FO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},HK(FO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=HK(FO(r),i,s)),t}return{visible:!1}}function jK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function HK(t,e,i){return d(t)?t(e,i):t}function VK(t,e){return d(t)?t(e):t}function NK(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 UK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function WK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=UK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=UK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function YK(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function $K(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])&&EK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&EK(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])&&EK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&EK(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=>KK(i,t,e))):i.x=KK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>KK(i,t,e))):i.y=KK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>KK(i,t,e))):i.angle=KK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>KK(i,t,e))):i.radius=KK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=KK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const XK={min:(t,e)=>LL(t[0].latestData,e.field),max:(t,e)=>RL(t[0].latestData,e.field),sum:function(t,e){return OL(t[0].latestData,e.field)},average:function(t,e){return IL(t[0].latestData,e.field)},variance:function(t,e){return DL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DL(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 KK(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(m(t)){const{aggrType:i,field:s}=t;return XK[i](e,{field:s})}return t}function qK(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 ZK extends Pz{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 FD(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)&&EK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=NL(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){u(this._spec.offsetX)||(this._layoutOffsetX=pR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=pR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerFilter",qK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function JK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=LL(t,e),r=RL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class QK extends ZK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=WK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:HK(FO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{line:jK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return jK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return jK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:HK(FO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:HK(FO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=FK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=WK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerRegression",JK),ZO(this._option.dataSet,"markerFilter",qK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}QK.specKey="markLine";const tq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),eq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},iq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:tq(!1),endSymbol:tq(!0),label:eq};class sq extends QK{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new wP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=WK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=BK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=RK(i,r,d,e.coordinatesOffset):c&&(y=DK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(dR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=WK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}sq.type=r.markLine,sq.coordinateType="cartesian",sq.builtInTheme={markLine:iq};class nq extends QK{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=WK(this._spec);return e||i?new BP(t):new wP(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}=WK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=LK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=OK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=WK(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}}}nq.type=r.polarMarkLine,nq.coordinateType="polar",nq.builtInTheme={polarMarkLine:iq};class rq extends Pz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=cR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return FD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=pR(this._spec.width,l.width,null,l.width),c=pR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iL(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}}rq.type=r.title,rq.specKey=r.title,rq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class aq extends ZK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:HK(FO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{area:jK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>jK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return jK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=FK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}aq.specKey="markArea";const oq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class lq extends aq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=GK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=RK(s,a,u,i.coordinatesOffset):d&&(f=DK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GK(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}}}lq.type=r.markArea,lq.coordinateType="cartesian",lq.builtInTheme={markArea:oq};class hq extends aq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GK(this._spec);return i||e||s?new PP(t):new EP(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}=GK(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=LK(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=OK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GK(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}}}hq.type=r.polarMarkArea,hq.coordinateType="polar",hq.builtInTheme={polarMarkArea:oq};const cq=t=>FO(Object.assign({},t)),dq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},FO(t.style))}),uq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=cq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=cq(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:{},FO(Object.assign({},y)));var y;const b=dq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=dq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=dq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=dq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},pq=t=>"left"===t||"right"===t,gq=t=>"top"===t||"bottom"===t,fq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class mq extends Pz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},uq(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({},uq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _L(t):this._playerComponent=new xL(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=pq(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=pq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(uL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=pq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=gq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):pq(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))):gq(this._orient)?this._maxSize():t.height}_computeDx(t){return pq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}mq.builtInTheme={player:fq},mq.specKey="player",mq.type=r.player;class vq extends Pz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=tR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==CI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}vq.type=r.label;class _q extends cN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}_q.type="text",_q.constructorType="label";const yq=()=>{dN(),wR.registerMark(_q.constructorType,_q)};class bq extends Bz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class xq extends vq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=bq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(NO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(NO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=TR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},BV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[gO])):t=>t.filter((t=>t.data[pO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?PV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}xq.type=r.label,xq.specKey="label",xq.transformerConstructor=bq;class Sq extends vq{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[dO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return TR({textStyle:{pickable:!0===this._spec.interactive},position:Aq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[gO]:t.data[pO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>PV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Aq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Sq.type=r.totalLabel,Sq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Sq.specKey="totalLabel";class kq extends ZK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=YK(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=zK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=HK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=FO(HK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=HK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=HK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:VK(R.offsetX,this._relativeSeries.getRegion()),offsetY:VK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:HK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:HK(I.style,this._markerData,this._markAttributeContext)},state:{line:jK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:jK(J,this._markerData,this._markAttributeContext),textBackground:jK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:jK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:FO(st.style)}):{visible:!1};return new RP(et)}_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}=FK([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:NK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NK(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}=YK(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}kq.specKey="markPoint";const Mq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Tq extends kq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=BK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=RK(n,r,h,s.coordinatesOffset)[0]:l&&(c=DK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=YK(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}}}Tq.type=r.markPoint,Tq.coordinateType="cartesian",Tq.builtInTheme={markPoint:Mq};class wq extends kq{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=LK(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:he({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}])]}}}wq.type=r.polarMarkPoint,wq.coordinateType="polar",wq.builtInTheme={polarMarkPoint:Mq};class Cq extends kq{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}])]}}}Cq.type=r.geoMarkPoint,Cq.coordinateType="geo",Cq.builtInTheme={geoMarkPoint:Mq};const Eq="inBrush",Bq="outOfBrush";class Pq extends Pz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Eq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Bq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new ML(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:FO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(yL.brushActive,(s=>{this._initMarkBrushState(i,Bq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(yL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(yL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(yL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},FO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Eq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Eq),i.addState(Bq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Eq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Eq),i.addState(Bq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Eq),s.removeState(Bq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Pq.type=r.brush,Pq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Pq.specKey="brush";class Lq extends Pz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${qR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=uF({},pF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Lq.type=r.customMark,Lq.specKey="customMark";class Rq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Oq(t))),a=n.filter((t=>!Oq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Oq(t))),h=o.filter((t=>!Oq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Oq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Rq.type="grid";const Iq="vchart-tooltip",Dq=`${Iq}-container`,Fq=`${Iq}-title`,zq=`${Iq}-content-box`,jq={offsetX:10,offsetY:10},Hq="99999999999999";function Vq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Nq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Uq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Vq(t):"",Wq=(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},Gq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Yq=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Gq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $q extends rz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=VD(null==T?void 0:T.position,b,e),C=null!==(r=VD(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:ZR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:JR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Ny(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Nq(e,F),V=Nq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(Yq(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Wq(t,_),W.top=Wq(i,_),W.right=Wq(e,_),W.bottom=Wq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Wq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=Yq(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Kq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Xq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Xq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},qq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?pR(e,t.fontSize):0},Zq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Xq(o)),{panelStyle:a,panelPadding:o}};function Jq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class Qq extends $q{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(Qq.type),this.type=eH.dom,this._tooltipContainer=null==Vy?void 0:Vy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Vy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Zq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Xq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Kq(h),x=Kq(d),S=Kq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Xq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Xq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Xq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(qq(p),qq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Fq))),l=a.find((t=>t.className.includes(zq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Fq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Jq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Iq}-column`),e.classList.add(`${Iq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(zq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Jq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Jq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Iq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Uq(e.key),e.keyStyle&&Kq(e.keyStyle,l)):"value"===i?(o.innerHTML=Uq(e.value),e.valueStyle&&Kq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Vq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Vq(c):m,y=p,b=t=>new kg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=ph.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Vq(u):"currentColor",`\n \n \n \n `;const w=T?ph.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Jq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(zq))),h=[...o.children].find((t=>t.className.includes(Fq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(Fq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=pR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Jq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},df||(df=hf.CreateGraphic("richtext",{})),df.setAttributes(a),df.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function iZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:tZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sZ=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 nZ extends $q{constructor(){super(nZ.type),this.type=eH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new BL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=mR(d.padding),x=iZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=iZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=iZ(m,i),k={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},M={panel:sZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=TR({},S,iZ(b,void 0,{})),{width:s,height:n,text:r}=eZ(h,i);T.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(m)){const t=TR({},A,iZ(x,void 0,{})),{width:e,height:s,text:n}=eZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=TR({},x,iZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=eZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}nZ.type=eH.canvas;const rZ=/\{([^}]+)\}/,aZ=/\{([^}]+)\}/g,oZ=/:/;class lZ extends rz{constructor(){super(lZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[lZ.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)),wR.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=rZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(aZ,((t,i)=>{if(!oZ.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(bi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}lZ.pluginType="chart",lZ.specKey="formatter",lZ.type="formatterPlugin";PD.useRegisters([()=>{aH(),lH(),cH(),Fj(),Dj(),xj(),uj(),XF(),qF(),bD(),vD(),rj(),ej(),wR.registerSeries(Sj.type,Sj),wR.registerChart(dH.type,dH)},()=>{aH(),lH(),cH(),Dj(),xj(),uj(),XF(),gH(),qF(),vH(),rj(),ej(),wR.registerSeries(yH.type,yH),Fj(),wR.registerChart(xH.type,xH)},()=>{aH(),lH(),cH(),Dj(),IH(),Fj(),wR.registerChart(FH.type,FH)},()=>{aH(),lH(),Fj(),Dj(),$H(),wR.registerChart(KH.type,KH)},()=>{lH(),GN(),wR.registerChart(j$.type,j$)},()=>{aH(),lH(),Fj(),Dj(),cU(),wR.registerChart(N$.type,N$)},()=>{aH(),lH(),cH(),Fj(),Dj(),yU(),wR.registerChart(W$.type,W$)},()=>{aH(),lH(),cH(),Fj(),Dj(),IH(),wR.registerChart(q$.type,q$)},()=>{lH(),dV(),eV(),wR.registerSeries(pV.type,pV),wR.registerImplement("registerMap",iI),wR.registerImplement("unregisterMap",sI),_D(),wR.registerChart(R$.type,R$)},()=>{lH(),ZY(),wR.registerSeries(QY.type,QY),jN(),OU(),aU(),FU(),wR.registerChart(tX.type,tX)},()=>{lH(),kG(),wR.registerChart(sX.type,sX)},()=>{lH(),WG(),wR.registerChart(rX.type,rX)},()=>{aH(),lH(),cH(),Fj(),Dj(),NV(),wR.registerChart(vX.type,vX)},()=>{aH(),lH(),Fj(),Dj(),hN(),wR.registerChart(yX.type,yX)},()=>{aH(),lH(),Fj(),Dj(),FU(),wR.registerChart(J$.type,J$)},()=>{aH(),lH(),Fj(),Dj(),GU(),wR.registerChart(oX.type,oX)},()=>{aH(),lH(),Fj(),Dj(),bN(),wR.registerChart(hX.type,hX)},()=>{aH(),lH(),cH(),Fj(),Dj(),gH(),rj(),ej(),wR.registerSeries(MN.type,MN),wR.registerChart(AX.type,AX)},()=>{lH(),lY(),wR.registerChart(dX.type,dX)},()=>{lH(),gY(),wR.registerChart(pX.type,pX)},()=>{lH(),VY(),wR.registerChart(fX.type,fX)},()=>{lH(),vo.load(pM),RY(),wR.registerChart(xX.type,xX)},()=>{lH(),a$(),wR.registerChart(MX.type,MX)},()=>{lH(),y$(),wR.registerChart(wX.type,wX)},()=>{aH(),lH(),cH(),Fj(),wR.registerChart(Y$.type,Y$),Dj()},ej,rj,()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(aj.type,aj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(oj.type,oj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(lj.type,lj)},lU,aU,()=>{wR.registerComponent(LX.type,LX)},()=>{wR.registerComponent(UX.type,UX)},()=>{wR.registerComponent(QX.type,QX)},()=>{wR.registerComponent(rK.type,rK)},()=>{wR.registerComponent(aK.type,aK)},()=>{wR.registerComponent(gK.type,gK)},()=>{wR.registerComponent(mK.type,mK)},()=>{wR.registerComponent(bK.type,bK)},dV,()=>{wR.registerComponent(sq.type,sq),TP()},()=>{wR.registerComponent(lq.type,lq),CP()},()=>{wR.registerComponent(Tq.type,Tq),LP()},()=>{wR.registerComponent(nq.type,nq),BP._animate=oP,TP()},()=>{wR.registerComponent(hq.type,hq),PP._animate=hP,CP()},()=>{wR.registerComponent(wq.type,wq),LP()},()=>{wR.registerComponent(Cq.type,Cq),LP()},()=>{wR.registerComponent(rq.type,rq)},()=>{wR.registerComponent(mq.type,mq)},()=>{wR.registerGraphicComponent(xq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(xq.type,xq,!0,1/0)},()=>{wR.registerGraphicComponent(Sq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(Sq.type,Sq,!0)},()=>{wR.registerComponent(Pq.type,Pq)},()=>{wR.registerComponent(Lq.type,Lq)},()=>{vo.load(iT)},()=>{wR.registerLayout(Rq.type,Rq)},()=>{var t;t=nZ,wR.registerComponentPlugin(t.type,t)},()=>{var t;t=lZ,wR.registerChartPlugin(t.type,t)},TD,ED]),PD.useRegisters([()=>{VS(vo)}]),t.DEFAULT_CHART_HEIGHT=JR,t.DEFAULT_CHART_WIDTH=ZR,t.DEFAULT_CLOSE_STROKE_JOIN=OD,t.DEFAULT_DATA_INDEX=tO,t.DEFAULT_DATA_KEY=eO,t.DEFAULT_DATA_SERIES_FIELD=iO,t.DEFAULT_KEY=xO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=RD,t.DEFAULT_MEASURE_CANVAS_ID=QR,t.DEFAULT_SERIES_STYLE_NAME=sO,t.DEFAULT_SMOOTH_INTERPOLATE=LD,t.Factory=wR,t.MOSAIC_CAT_END_PERCENT=_O,t.MOSAIC_CAT_START_PERCENT=vO,t.MOSAIC_VALUE_END_PERCENT=mO,t.MOSAIC_VALUE_START_PERCENT=fO,t.ManualTicker=class extends rw{constructor(t){super(t),this.lastFrameTime=0,this.status=Eo.RUNNING}setupTickHandler(){const t=new aw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,!0}},t.PREFIX=qR,t.SEGMENT_FIELD_END=bO,t.SEGMENT_FIELD_START=yO,t.STACK_FIELD_END=aO,t.STACK_FIELD_END_OffsetSilhouette=cO,t.STACK_FIELD_END_PERCENT=lO,t.STACK_FIELD_KEY=nO,t.STACK_FIELD_START=rO,t.STACK_FIELD_START_OffsetSilhouette=hO,t.STACK_FIELD_START_PERCENT=oO,t.STACK_FIELD_TOTAL=dO,t.STACK_FIELD_TOTAL_BOTTOM=gO,t.STACK_FIELD_TOTAL_PERCENT=uO,t.STACK_FIELD_TOTAL_TOP=pO,t.StreamLight=class extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=yo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Hl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=yo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=al(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=al(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;et;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function P(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var E=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(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];!u(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,s=!1,n=!1){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(y(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=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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(!N(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(!N(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;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 tt(t){return Number(t)}const et="undefined"!=typeof console;function it(t,e,i){const s=[e].concat([].slice.call(i));et&&console[t].apply(console,s)}var st;!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"}(st||(st={}));class nt{static getInstance(t,e){return nt._instance&&x(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=st.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=st.Info}canLogDebug(){return this._level>=st.Debug}canLogError(){return this._level>=st.Error}canLogWarn(){return this._level>=st.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=st.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):it(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=st.Warn&&it(this._method||"warn","WARN",t),this}info(...t){return this._level>=st.Info&&it(this._method||"log","INFO",t),this}debug(...t){return this._level>=st.Debug&&it(this._method||"log","DEBUG",t),this}}function rt(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}nt._instance=null;const at=(t,e)=>ot(0,t.length,(i=>e(t[i]))),ot=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},lt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),function(t,e,i=tt){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)},ht=1e-10,ct=1e-10;function dt(t,e,i=ct,s=ht){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ut(t,e,i,s){return t>e&&!dt(t,e,i,s)}function pt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ft=function(t,e,i){return ti?i:t};var mt=(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 vt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let _t=!1;try{_t="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){_t=!1}function yt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&_t;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 g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function bt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),yt(t,e,{leading:s,trailing:n,maxWait:e})}function xt(t,e){return i=>t*(1-i)+e*i}function St(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function At(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}_t=!1;const Mt=4294967296;const wt=t=>e=>E(e,t),Tt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||wt)(i)},Ct=(t,e={})=>{if(_(t)){const i=t.map((t=>Tt(t,e)));return t=>i.map((e=>e(t)))}return Tt(t,e)},Bt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Et=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!d(n)&&(n=+n)>=n&&!d(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Lt=1e-12,Dt=Math.PI,Ft=Dt/2,zt=2*Dt,jt=2*Math.PI,Ht=Math.abs,Vt=Math.atan2,Nt=Math.cos,Wt=Math.max,Ut=Math.min,Gt=Math.sin,Yt=Math.sqrt,Xt=Math.pow;function $t(t){return t>=1?Ft:t<=-1?-Ft:Math.asin(t)}function Kt(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 qt(t,e){return t[0]*e[1]-t[1]*e[0]}function Zt(t,e){let i=0;for(let s=0;s0?i:0}function te(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))}function ee(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))}class ie{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ie(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 se{static distancePP(t,e){return Yt(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Yt(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return Yt(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new ie((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ae=(t=0)=>{if(t<0)for(;t<-zt;)t+=zt;else if(t>0)for(;t>zt;)t-=zt;return t};function oe(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 le(t,e={x:0,y:0},i=0,s=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 he(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ce(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function de(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=ce(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 ue(t){return(t=ce(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 pe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ge(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 me(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}=_e(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 ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const _e=(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 ye(t,e,i){if(!t||!e)return ve.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=_e(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 Se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ne(t.angle):t.angle,s=Ae(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Ae(t),Ae(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ne(t.angle):t.angle;let u=i?ne(90-t.angle):t.angle+Ft;const p=i?ne(e.angle):e.angle;let g=i?ne(90-e.angle):e.angle+Ft;u>jt&&(u-=jt),g>jt&&(g-=jt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Se(n,i)+Se(n,s))/2>Se(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Te=1e-8;function Ce(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ee(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Oe(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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(v(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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const Le=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),De=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Fe(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 je extends ze{}class He extends ze{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new He(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ve{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ve,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 Ve;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ve(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=re(r.rotateDeg),r}}class Ne{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 We(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 Ue(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 Ge=/^#([0-9a-f]{3,8})$/,Ye={transparent:4294967040},Xe={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 $e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ke(t){return x(t)?new ti(t>>16,t>>8&255,255&t,1):_(t)?new ti(t[0],t[1],t[2]):new ti(255,255,255)}function qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ze(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Je=(t,e)=>{const i=Ge.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ti((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ke(t):8===e?new ti(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Qe{static Brighter(t,e=1){return 1===e?t:new Qe(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Qe(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Qe?t:new Qe(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Ye[t]))return function(t){return x(t)?new ti(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ti(t[0],t[1],t[2],t[3]):new ti(255,255,255,1)}(Ye[t]);if(u(Xe[t]))return Ke(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Je(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 ti(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ti(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Qe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ti(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=Ue(this.color.r,this.color.g,this.color.b),r=We(d(t)?n.h:ft(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ti(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Je(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Qe(this.color.toString())}copyGammaToLinear(t,e=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,e=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=qe(t.color.r),this.color.g=qe(t.color.g),this.color.b=qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ti{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${$e(this.r)+$e(this.g)+$e(this.b)+(1===this.opacity?"":$e(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}=Ue(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ei(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 ti(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:Ue});function si(t){if(k(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(p(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 ni(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ri(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 ai(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}const oi=1e-10;function li(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+oi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=ui(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=se.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=hi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-oi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function hi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ci(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return hi(t,t-(i*i-e*e+t*t)/(2*i))+hi(e,s)}function di(t,e){const i=se.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function ui(t){const e={x:0,y:0};for(let i=0;ithis.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 fi;function mi(t,e){const i=gi(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 vi{constructor(t={}){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 _i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yi(t){let e;if(e=_i.exec(t))return new vi({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]});nt.getInstance().error("invalid format: "+t)}const bi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class xi{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 xi.instance||(xi.instance=new xi),xi.instance}newFormat(t){const e=yi(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"):Si[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=Si[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:_,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)?m: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?bi[8+fi/3]:"")+k+(t&&"("===n?")":""),f)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=yi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=gi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=bi[8+n/3];return function(t){return s(r*t)+a}}}const Si={"%":(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)=>mi(100*t,e),r:mi,s:function(t,e){const i=gi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(fi=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")+gi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ti(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ti(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Zt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Zi=Math.sqrt,Ji=Math.tan;function Qi(t){return t>1?0:t<-1?Di:Math.acos(t)}function ts(t){return t>1?Fi:t<-1?-Fi:Math.asin(t)}function es(){}function is(t,e){t&&ns.hasOwnProperty(t.type)&&ns[t.type](t,e)}var ss={Feature:function(t,e){is(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sDi?t+Math.round(-t/ji)*ji:t,e]}function vs(t,e,i){return(t%=ji)?e||i?fs(ys(t),bs(e,i)):ys(t):e||i?bs(e,i):ms}function _s(t){return function(e,i){return[(e+=t)>Di?e-ji:e<-Di?e+ji:e,i]}}function ys(t){var e=_s(t);return e.invert=_s(-t),e}function bs(t,e){var i=Gi(t),s=Ki(t),n=Gi(e),r=Ki(e);function a(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*i+o*s;return[Ui(l*n-c*r,o*i-h*s),ts(c*n+l*r)]}return a.invert=function(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*n-l*r;return[Ui(l*n+h*r,o*i+c*s),ts(c*i-o*s)]},a}function xs(t,e){(e=hs(e))[0]-=t,gs(e);var i=Qi(-e[1]);return((-e[2]<0?-i:i)+ji-Li)%ji}function Ss(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:es,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ni(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=Ki(s),r=[Ki(i),-Gi(i),0],a=0,o=0;Bs.reset(),1===n?s=Fi+Li:-1===n&&(s=-Fi-Li);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Di,T=f*x;if(Bs.add(Ui(T*A*Ki(M),m*S+T*Gi(M))),a+=w?k+A*ji:k,w^p>=i^y>=i){var C=ds(hs(u),hs(_));gs(C);var B=ds(r,C);gs(B);var P=(w^k>=0?-1:1)*ts(B[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Li||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(Is))}return u}}function Is(t){return t.length>1}function Ls(t,e){return((t=t.x)[0]<0?t[1]-Fi-Li:Fi-t[1])-((e=e.x)[0]<0?e[1]-Fi-Li:Fi-e[1])}1===(Ts=Es).length&&(Cs=Ts,Ts=function(t,e){return Es(Cs(t),e)});var Ds=Os((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?Di:-Di,l=Ni(r-i);Ni(l-Di)0?Fi:-Fi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Di&&(Ni(i-n)Li?Wi((Ki(e)*(r=Gi(s))*Ki(i)-Ki(s)*(n=Gi(e))*Ki(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*Fi,s.point(-Di,n),s.point(0,n),s.point(Di,n),s.point(Di,0),s.point(Di,-n),s.point(0,-n),s.point(-Di,-n),s.point(-Di,0),s.point(-Di,n);else if(Ni(t[0]-e[0])>Li){var r=t[0]0,n=Ni(e)>Li;function r(t,i){return Gi(t)*Gi(i)>e}function a(t,i,s){var n=[1,0,0],r=ds(hs(t),hs(i)),a=cs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ds(n,r),u=ps(n,h);us(u,ps(r,c));var p=d,g=cs(u,p),f=cs(p,p),m=g*g-f*(cs(u,u)-1);if(!(m<0)){var v=Zi(m),_=ps(p,(-g-v)/f);if(us(_,u),_=ls(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ni(_[0]-b)Di^(b<=_[0]&&_[0]<=x)){var w=ps(p,(-g+v)/f);return us(w,u),[_,ls(w)]}}}function o(e,i){var n=s?t:Di-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Di:-Di),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Gi(e),o=Ki(e),l=s*i;null==n?(n=e+s*ji,r=e-l/2):(n=xs(a,n),r=xs(a,r),(s>0?nr)&&(n+=s*ji));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 Ni(s[0]-t)0?0:3:Ni(s[0]-i)0?2:1:Ni(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,f,m,v,_,y=a,b=Ss(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ms(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&&m)y.point(r,a);else{var l=[g=Math.max(js,Math.min(zs,g)),f=Math.max(js,Math.min(zs,f))],b=[r=Math.max(js,Math.min(zs,r)),a=Math.max(js,Math.min(zs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Vs(t){return t}var Ns,Ws,Us,Gs,Ys=Ei(),Xs=Ei(),$s={point:es,lineStart:es,lineEnd:es,polygonStart:function(){$s.lineStart=Ks,$s.lineEnd=Js},polygonEnd:function(){$s.lineStart=$s.lineEnd=$s.point=es,Ys.add(Ni(Xs)),Xs.reset()},result:function(){var t=Ys/2;return Ys.reset(),t}};function Ks(){$s.point=qs}function qs(t,e){$s.point=Zs,Ns=Us=t,Ws=Gs=e}function Zs(t,e){Xs.add(Gs*t-Us*e),Us=t,Gs=e}function Js(){Zs(Ns,Ws)}var Qs=$s,tn=1/0,en=tn,sn=-tn,nn=sn;var rn,an,on,ln,hn={point:function(t,e){tsn&&(sn=t);enn&&(nn=e)},lineStart:es,lineEnd:es,polygonStart:es,polygonEnd:es,result:function(){var t=[[tn,en],[sn,nn]];return sn=nn=-(en=tn=1/0),t}},cn=0,dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn={point:bn,lineStart:xn,lineEnd:An,polygonStart:function(){yn.lineStart=Mn,yn.lineEnd=wn},polygonEnd:function(){yn.point=bn,yn.lineStart=xn,yn.lineEnd=An},result:function(){var t=_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:un?[cn/un,dn/un]:[NaN,NaN];return cn=dn=un=pn=gn=fn=mn=vn=_n=0,t}};function bn(t,e){cn+=t,dn+=e,++un}function xn(){yn.point=Sn}function Sn(t,e){yn.point=kn,bn(on=t,ln=e)}function kn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,bn(on=t,ln=e)}function An(){yn.point=bn}function Mn(){yn.point=Tn}function wn(){Cn(rn,an)}function Tn(t,e){yn.point=Cn,bn(rn=on=t,an=ln=e)}function Cn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,mn+=(n=ln*t-on*e)*(on+t),vn+=n*(ln+e),_n+=3*n,bn(on=t,ln=e)}var Bn=yn;function Pn(t){this._context=t}Pn.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,ji)}},result:es};var En,Rn,On,In,Ln,Dn=Ei(),Fn={point:es,lineStart:function(){Fn.point=zn},lineEnd:function(){En&&jn(Rn,On),Fn.point=es},polygonStart:function(){En=!0},polygonEnd:function(){En=null},result:function(){var t=+Dn;return Dn.reset(),t}};function zn(t,e){Fn.point=jn,Rn=In=t,On=Ln=e}function jn(t,e){In-=t,Ln-=e,Dn.add(Zi(In*In+Ln*Ln)),In=t,Ln=e}var Hn=Fn;function Vn(){this._string=[]}function Nn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),os(t,i(s))),s.result()}return r.area=function(t){return os(t,i(Qs)),Qs.result()},r.measure=function(t){return os(t,i(Hn)),Hn.result()},r.bounds=function(t){return os(t,i(hn)),hn.result()},r.centroid=function(t){return os(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Vs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Vn):new Pn(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 Un(t){return function(e){var i=new Gn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Gn(){}function Yn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),os(i,t.stream(hn)),e(hn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return Yn(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 $n(t,e,i){return Xn(t,[[0,0],e],i)}function Kn(t,e,i){return Yn(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 qn(t,e,i){return Yn(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)}Vn.prototype={_radius:4.5,_circle:Nn(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=Nn(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}},Gn.prototype={constructor:Gn,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 Zn=16,Jn=Gi(30*Vi);function Qn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Zi(b*b+x*x+S*S),A=ts(S/=k),M=Ni(Ni(S)-1)e||Ni((v*B+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Vi:0,B()):[m*Hi,v*Hi,_*Hi]},T.angle=function(t){return arguments.length?(y=t%360*Vi,B()):y*Hi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=Qn(o,w=t*t),P()):Zi(w)},T.fitExtent=function(t,e){return Xn(T,t,e)},T.fitSize=function(t,e){return $n(T,t,e)},T.fitWidth=function(t,e){return Kn(T,t,e)},T.fitHeight=function(t,e){return qn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function rr(t){var e=0,i=Di/3,s=nr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Vi,i=t[1]*Vi):[e*Hi,i*Hi]},n}function ar(t,e){var i=Ki(t),s=(i+Ki(e))/2;if(Ni(s)2?t[2]*Vi:0),e.invert=function(e){return(e=t.invert(e[0]*Vi,e[1]*Vi))[0]*=Hi,e[1]*=Hi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===pr?[[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 fr(t){return Ji((Fi+t)/2)}function mr(t,e){var i=Gi(t),s=t===e?Ki(t):Xi(i/Gi(e))/Xi(fr(e)/fr(t)),n=i*$i(fr(t),s)/s;if(!s)return pr;function r(t,e){n>0?e<-Fi+Li&&(e=-Fi+Li):e>Fi-Li&&(e=Fi-Li);var i=n/$i(fr(e),s);return[i*Ki(s*t),n-i*Gi(s*t)]}return r.invert=function(t,e){var i=n-e,r=qi(s)*Zi(t*t+i*i),a=Ui(t,Ni(i))*qi(i);return i*s<0&&(a-=Di*qi(t)*qi(i)),[a/s,2*Wi($i(n/r,1/s))-Fi]},r}function vr(t,e){return[t,e]}function _r(t,e){var i=Gi(t),s=t===e?Ki(t):(i-Gi(e))/(e-t),n=i/s+t;if(Ni(s)Li&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Tr.invert=cr(ts),Cr.invert=cr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi(Yi(t))-Fi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Lr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Lr(t.slice(0,s),e),o=Lr(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},Dr=Lr;!function(t){var e=Dr;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;r{const i=zr(Vr,e),{tolerance:s}=i;return Fr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Ur=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Kr(e,6):Kr(e,4))+"-"+Kr(t.getUTCMonth()+1,2)+"-"+Kr(t.getUTCDate(),2)+(r?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"."+Kr(r,3)+"Z":n?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"Z":s||i?"T"+Kr(i,2)+":"+Kr(s,2)+"Z":"")}function Zr(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 Yr;if(h)return h=!1,Gr;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(;a0}function la(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=ea(t));var r=[];switch(t.type){case"GeometryCollection":return ha(t,(function(t){da(t,s)})),t;case"FeatureCollection":return la(t,(function(t){la(da(t,s),(function(t){r.push(t)}))})),ai(r)}return da(t,s)}function da(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ha(t,(function(t){da(t,e)})),t;case"LineString":return ua(aa(t),e),t;case"Polygon":return pa(aa(t),e),t;case"MultiLineString":return aa(t).forEach((function(t){ua(t,e)})),t;case"MultiPolygon":return aa(t).forEach((function(t){pa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ua(t,e){oa(t)===e&&t.reverse()}function pa(t,e){oa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ga(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},_a=(t,e={},i)=>{i.type=Wr.GEO;const s=zr(ma,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(va(t))})):e.push(va(t))})),e})(t);let l=t.features;return o&&(l=ca(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=fa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=fa.bounds(t);t.bbox=e}})),t.features=l,t},ya={},ba=(t,e,i)=>{i.type=Wr.GEO;const s=zr(ma,ya,e),{object:n}=s;if(!v(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 Er(a,t)}))}:Er(a,o));var a,o;return _a(r,s,i)},xa=(t,e,i)=>{const s=!h(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 Sa=0;function ka(t="dataset"){return Sa>1e8&&(Sa=0),t+"_"+Sa++}class Aa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:ka("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.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()}}class Ma{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ma||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ur),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ta={albers:lr,albersusa:function(){var t,e,i,s,n,r,a=lr(),o=or().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=or().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)}},Ca=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ca.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class Ea{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",La="inversify:tagged",Da="inversify:paramtypes";class Fa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var za=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 ja(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};za.hasOwnMetadata(t,e)&&(r=za.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,za.defineMetadata(t,r,e)}(La,t,i.toString(),s)}function Ha(t){return(e,i,s)=>{ja(e,0,s,t)}}function Va(t){return e=>(i,s,n)=>Ha(new Fa(t,e))(i,s,n)}const Na=Va(Oa),Wa=Va(Ia);function Ua(){return function(t){return za.defineMetadata(Da,null,t),t}}function Ga(t){return Ha(new Fa(Ra,t))}const Ya="Singleton",Xa="Transient",$a="ConstantValue",Ka="DynamicValue",qa="Factory",Za="Function",Ja="Instance",Qa="Invalid";class to{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Qa,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new to(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ya&&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 eo{getConstructorMetadata(t){return{compilerGeneratedMetadata:za.getMetadata(Da,t),userGeneratedMetadata:za.getMetadata(La,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const io=(so=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===so&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const ao=Symbol("ContributionProvider");class oo{constructor(t,e){this.serviceIdentifier=t,this.container=e,ho.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function lo(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).inSingletonScope().whenTargetNamed(e)}class ho{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ho.store=new Map;class co{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 uo extends co{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const po=Symbol.for("EnvContribution"),go=Symbol.for("VGlobal");const fo=new class{};let mo=0;class vo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=fo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++mo,t),this.tryRunAnimationFrameNextFrame(),mo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class _o{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var yo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xo=function(t,e){return function(i,s){e(i,s,t)}},So=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 ko=class extends _o{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new uo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new vo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return So(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Ao,Mo,wo,To;ko=yo([Ua(),xo(0,Na(ao)),xo(0,Ga(po)),bo("design:paramtypes",[Object])],ko),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Ao||(Ao={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Mo||(Mo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(To||(To={}));const Co=zt-1e-8;class Bo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Co)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%=zt)<0&&(s+=zt),(n%=zt)<0&&(n+=zt),nn;++o,a-=Ft)g(a);else for(a=s-s%Ft+Ft,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Eo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ro={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 Io,Lo,Do,Fo,zo,jo;var Ho,Vo,No,Wo,Uo,Go;function Yo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;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 Xo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ne(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=zt:C>0&&0===r&&(C-=zt);const B=Math.ceil(Math.abs(C/(Ft+.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 Ko(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=il(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function nl(t,e){const{p0:i,p1:s}=t,n=se.pointAtPP(i,s,e);return[new rl(i,n),new rl(n,s)]}class rl extends qo{constructor(t,e){super(),this.type=Uo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return se.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Vt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?se.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Wo.ROW?Ht(this.p0.x-this.p1.x):t===Wo.COLUMN?Ht(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class al{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new sl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new rl(new ie(this._lastX,this._lastY),new ie(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Wo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ht(t.p0.y-s.y)}if(t===Wo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ht(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class ol extends al{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 ll(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function hl(t,e,i){const s=null!=e?e:Ht(i[i.length-1].x-i[0].x)>Ht(i[i.length-1].y-i[0].y)?Wo.ROW:Wo.COLUMN;return"monotoneY"===t?new ol(t,s):new al(t,s)}class cl{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 dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=hl("linear",i,t);return function(t,e){ll(t,e,1)}(new cl(n,s),t),n}function ul(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 pl{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&&ul(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:ul(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 gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("basis",i,t);return function(t,e){ll(t,e,2)}(new pl(n,s),t),n}function fl(t){return t<0?-1:1}function ml(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(fl(r)+fl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function vl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function _l(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 yl{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:_l(this,this._t0,vl(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,_l(this,vl(this,e=ml(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:_l(this,this._t0,e=ml(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 bl extends yl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function xl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("monotoneX",i,t);return function(t,e){ll(t,e,2)}(new yl(n,s),t),n}function Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("monotoneY",i,t);return function(t,e){ll(t,e,2)}(new bl(n,s),t),n}let kl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Al extends kl{lineEnd(){this.context.closePath()}}function Ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new al("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new kl(r,e,n),t),r}function wl(t,e){return ll(t,e,1)}class Tl extends cl{lineEnd(){this.context.closePath()}}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=hl("linear",i,t);return function(t,e){ll(t,e,1)}(new Tl(n,s),t),n}function Bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Lt){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>Lt){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 Pl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return dl(i,n);const o=hl(t,r,i);return ll(new e(o,s,a),i,2),o}}const El=Pl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Bl(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 Rl=Pl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Ol extends qo{constructor(t,e,i){super(),this.type=Uo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return el(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Zo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Wo.ROW?Ht(this.p0.x-this.p2.x):t===Wo.COLUMN?Ht(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Ut(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Vt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=el(i,s,n,e),a=se.pointAtPP(i,s,e),o=se.pointAtPP(s,n,e);return[new Ol(i,a,r),new Ol(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Il{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new rl(new ie(this._lastX,this._lastY),new ie(t,e))}quadraticCurveTo(t,e,i,s){const n=new Ol(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new sl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ll(t,e,i){var s,n;switch(e){case"linear":default:return dl(t,i);case"basis":return gl(t,i);case"monotoneX":return xl(t,i);case"monotoneY":return Sl(t,i);case"step":return Ml(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new al("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new Al(r,e,n),t),r}(t,.5,i);case"stepBefore":return Ml(t,0,i);case"stepAfter":return Ml(t,1,i);case"catmullRom":return El(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Rl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Cl(t,i)}}class Dl extends Po{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Bo(this.bounds)}get curves(){return this.tryBuildCurves()}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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Il(this);Ko(this.commandList,t,0,0,1,1)}return this._curves}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=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`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;tjo){let t,e=Do;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ko(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Wo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.y-e.p1.y)}if(this.direction===Wo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{nt.getInstance().warn("空函数")}}),th=Object.assign(Object.assign({},Yl),{points:[],cornerRadius:0,closePath:!0}),eh=Object.assign(Object.assign({},Yl),{width:100,height:100,spikes:5,thickness:.5}),ih=Object.assign(Object.assign({},Yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const sh=Object.assign(Object.assign({},Yl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Yl),Wl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Yl),Wl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Yl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{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}),lh=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&&_(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 hh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(hh.IsGradientStr(t))try{const e=lh(t)[0];if(e){if("linear"===e.type)return hh.ParseLinear(e);if("radial"===e.type)return hh.ParseRadial(e);if("conic"===e.type)return hh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2,n=parseFloat(e.value)/180*Dt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+jt,stops:hh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:hh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2;let n="angular"===e.type?parseFloat(e.value)/180*Dt:0;for(;n<0;)n+=jt;for(;n>=jt;)n-=jt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const uh={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"}},ph=!0,gh=!1,fh=/\w|\(|\)|-/,mh=/[.?!,;:/,。?!、;:]/,vh=/\S/,_h=(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})};function yh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=fo.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=bh(t,a)),a}function bh(t,e,i=!1){let s=e;for(;fh.test(t[s-1])&&fh.test(t[s])||mh.test(t[s]);)if(s--,s<=0)return i?xh(t,e):e;return s}function xh(t,e){let i=e;for(;fh.test(t[i+1])&&fh.test(t[i])||mh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Sh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=fo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var kh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ah=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=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=bh(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){nt.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,a=!1){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=bh(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}};Ah=kh([Ua()],Ah);var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=Symbol.for("TextMeasureContribution");let Th=class extends Ah{};Th=Mh([Ua()],Th);const Ch=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new eo}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new to(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ro(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case $a:case Za: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===Ya&&(t.cache=e,t.activated=!0)}},Bh=Symbol.for("CanvasFactory"),Ph=Symbol.for("Context2dFactory");function Eh(t){return Ch.getNamed(Bh,fo.global.env)(t)}const Rh=1e-4,Oh=Math.sqrt(3),Ih=1/3;function Lh(t){return t>-$h&&t<$h}function Dh(t){return t>$h||t<-$h}const Fh=[0,0],zh=[0,0],jh=[0,0];function Hh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Vh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Nh(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 Wh(t){return(t%=jt)<0&&(t+=jt),t}function Uh(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+=jt);let d=Math.atan2(l,o);return d<0&&(d+=jt),d>=s&&d<=n||d+jt>=s&&d+jt<=n}function Xh(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 qh=[-1,-1,-1],Zh=[-1,-1];function Jh(){const t=Zh[0];Zh[0]=Zh[1],Zh[1]=t}function Qh(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,Ih):Math.pow(i,Ih),s=s<0?-Math.pow(-s,Ih):Math.pow(s,Ih);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+Oh*Math.sin(e)))/(3*a),h=(-o+i*(s-Oh*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,qh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Jh(),p=Nh(e,s,r,o,Zh[0]),u>1&&(g=Nh(e,s,r,o,Zh[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,qh);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=Vh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);qh[0]=-l,qh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=jt-1e-4){s=0,n=jt;const e=r?1:-1;return a>=qh[0]+t&&a<=qh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=jt,n+=jt);let c=0;for(let e=0;e<2;e++){const i=qh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=jt+t),(t>=s&&t<=n||t+jt>=s&&t+jt<=n)&&(t>Dt/2&&t<1.5*Dt&&(e=-e),c+=e)}}return c}function ic(t){return Math.round(t/Dt*1e8)/1e8%2*Dt}function sc(t,e){let i=ic(t[0]);i<0&&(i+=jt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=jt?n=i+jt:e&&i-n>=jt?n=i-jt:!e&&i>n?n=i+(jt-ic(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;nc[0]=S,nc[1]=k,sc(nc,Boolean(a[6])),S=nc[0],k=nc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case Oo.M:u=m,p=v,c=u,d=p;break;case Oo.L:if(i){if(Xh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Oo.C:if(i){if(Gh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=Qh(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Oo.Q:if(i){if(Uh(c,d,m,v,_,y,e,s,n))return!0}else h+=tc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Oo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Yh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ec(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case Oo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Xh(u,p,o,p,e,s,n)||Xh(o,p,o,l,e,s,n)||Xh(o,l,u,l,e,s,n)||Xh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Oo.Z:if(i){if(Xh(c,d,u,p,e,s,n))return!0}else h+=Pe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)<$h}(d,p)||(h+=Pe(c,d,u,p,s,n)||0),0!==h}const ac=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Eh(Object.assign({nativeCanvas:fo.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Eh(Object.assign({nativeCanvas:fo.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};var oc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const hc=Symbol.for("VWindow"),cc=Symbol.for("WindowHandlerContribution");let dc=class extends _o{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(){super(),this.hooks={onChange:new uo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ch.getNamed(cc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=fo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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&&dt(this.width,t.width())&&dt(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)}};dc=oc([Ua(),lc("design:paramtypes",[])],dc);var uc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gc=function(t,e){return function(i,s){e(i,s,t)}};let fc=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=fo.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=ac.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Wl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Wl.fontFamily,fontSize:Wl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Ch.get(hc),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 mc;fc=uc([Ua(),gc(0,Na(ao)),gc(0,Ga(wh)),pc("design:paramtypes",[Object])],fc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(mc||(mc={}));const vc=new Ve;let _c=class{constructor(){this.matrix=new Ve}init(t){return this.mode=mc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=mc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(vc.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(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(vc.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(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}scale(t,e,i){return this.mode===mc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===mc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return vc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}translate(t,e){return this.mode===mc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===mc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};_c=uc([Ua(),pc("design:paramtypes",[])],_c);const yc={arc:Xl,area:$l,circle:Kl,line:Jl,path:Ql,symbol:sh,text:nh,rect:ih,polygon:th,star:eh,richtext:rh,richtextIcon:oh,image:ah,group:ql,glyph:Zl},bc=Object.keys(yc);function xc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Sc={arc:Object.assign({},yc.arc),area:Object.assign({},yc.area),circle:Object.assign({},yc.circle),line:Object.assign({},yc.line),path:Object.assign({},yc.path),symbol:Object.assign({},yc.symbol),text:Object.assign({},yc.text),rect:Object.assign({},yc.rect),polygon:Object.assign({},yc.polygon),star:Object.assign({},yc.star),richtext:Object.assign({},yc.richtext),richtextIcon:Object.assign({},yc.richtextIcon),image:Object.assign({},yc.image),group:Object.assign({},yc.group),glyph:Object.assign({},yc.glyph)};class kc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},bc.forEach((t=>{this._defaultTheme[t]=Object.create(Sc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;bc.forEach((s=>{const n=Object.create(Sc[s]);t&&t[s]&&xc(n,t[s]),i[s]&&xc(n,i[s]),e[s]&&xc(n,e[s]),this.combinedTheme[s]=n})),e.common&&bc.forEach((t=>{xc(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 Ac=new kc;function Mc(t,e){return t.glyphHost?Mc(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)):Ac.getTheme()}return null}(t)||t.attachedThemeGraphic&&Mc(t.attachedThemeGraphic)||Ac.getTheme()}var wc=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 o{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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return wc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Pc))return void nt.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(Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ic(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 Pc))return void nt.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=Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Oc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ic(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(Ic(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,Ic(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 Pc))return void nt.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"):Ic(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 Ec))return void nt.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=Oc.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 Pc,this.rootWheelEvent=new Ec,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class jc{static GetImage(t,e){var i;const s=jc.cache.get(t);s?"fail"===s.loadState?fo.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):jc.loadImage(t,e)}static GetSvg(t,e){var i;let s=jc.cache.get(t);s?"fail"===s.loadState?fo.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"},jc.cache.set(t,s),s.dataPromise=fo.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=jc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},jc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=fo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=fo.global.loadBlob(t):"json"===e&&(i.dataPromise=fo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!jc.isLoading&&jc.toLoadAueue.length){jc.isLoading=!0;const t=jc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(jc.cache.set(i,n),n.dataPromise=fo.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((()=>{jc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jc.loading()})).catch((t=>{console.error(t),jc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jc.loading()}))}}),0)}static loadImage(t,e){const i=Hc(t,jc.toLoadAueue);if(-1!==i)return jc.toLoadAueue[i].marks.push(e),void jc.loading();jc.toLoadAueue.push({url:t,marks:[e]}),jc.loading()}static improveImageLoading(t){const e=Hc(t,jc.toLoadAueue);if(-1!==e){const t=jc.toLoadAueue.splice(e,1);jc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Hc(t,e){for(let i=0;it?_(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,Gc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Yc=[1,2,3,0,1,2,3,0];function Xc(t,e,i,s){for(;t>=jt;)t-=jt;for(;t<0;)t+=jt;for(;t>e;)e+=jt;Gc[0].x=i,Gc[1].y=i,Gc[2].x=-i,Gc[3].y=-i;const n=Math.ceil(t/Ft)%4,r=Math.ceil(e/Ft)%4;if(s.add(Nt(t)*i,Gt(t)*i),s.add(Nt(e)*i,Gt(e)*i),n!==r||e-t>Dt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Zc.TimeOut=1e3/60;const Jc=new Zc,Qc=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class td{bounds(t,e){if(x(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 x(t)?t:Math.min(t[0],t[1])}}function ed(t,e,i,s,n){return n?t.arc(i,s,e,0,zt,!1,n):t.arc(i,s,e,0,zt),!1}var id=new class extends td{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 ed(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ed(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 sd=new class extends td{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 nd(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 rd=new class extends td{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 nd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return nd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return nd(t,this.parseSize(e)/2+n,i,s,r)}};function ad(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var od=new class extends td{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ad(t,this.parseSize(e)/2+n,i,s)}};function ld(t,e,i,s,n=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 hd extends td{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 ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2,i,s,n)}}var cd=new hd;var dd=new class extends hd{constructor(){super(...arguments),this.type="triangle"}};const ud=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),pd=Math.sin(zt/10)*ud,gd=-Math.cos(zt/10)*ud;function fd(t,e,i,s){const n=pd*e,r=gd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=zt*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 md=new class extends td{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2+n,i,s)}};const vd=Yt(3);function _d(t,e,i,s){const n=e,r=n/vd,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 yd=new class extends td{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 _d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return _d(t,this.parseSize(e)/2+n,i,s)}};function bd(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 xd=new class extends td{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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+n,i,s)}};function Sd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var kd=new class extends td{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const Ad=-.5,Md=Yt(3)/2,wd=1/Yt(12);function Td(t,e,i,s){const n=e/2,r=e*wd,a=n,o=e*wd+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(Ad*n-Md*r+i,Md*n+Ad*r+s),t.lineTo(Ad*a-Md*o+i,Md*a+Ad*o+s),t.lineTo(Ad*l-Md*h+i,Md*l+Ad*h+s),t.lineTo(Ad*n+Md*r+i,Ad*r-Md*n+s),t.lineTo(Ad*a+Md*o+i,Ad*o-Md*a+s),t.lineTo(Ad*l+Md*h+i,Ad*h-Md*l+s),t.closePath(),!1}var Cd=new class extends td{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 Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};function Bd(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 Pd=new class extends td{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 Bd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2,i,s,n)}};function Ed(t,e,i,s,n=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 Rd=new class extends td{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends td{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};const Ld=Yt(3);function Dd(t,e,i,s){const n=e*Ld;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Fd=new class extends td{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2/Ld,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2/Ld+n,i,s)}};function zd(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 jd=new class extends td{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 zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/4+n,i,s)}};function Hd(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 Vd=new class extends td{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Wd=new class extends td{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Gd=new class extends td{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Yd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Xd=new class extends td{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Yd(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 $d(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Kd=new class extends td{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return $d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return $d(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 qd(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 Zd=new class extends td{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 qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Qd(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var tu=new class extends td{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 x(e)?Qd(t,e,i,s):Jd(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?Qd(t,e+2*n,i,s):Jd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const eu=new je;class iu{constructor(t,e,i=!1){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(),Ko(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ko(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 x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{eu.x1=i.bounds.x1*t,eu.y1=i.bounds.y1*t,eu.x2=i.bounds.x2*t,eu.y2=i.bounds.y2*t,e.union(eu)}))}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 su={};[id,sd,rd,od,Fd,dd,md,yd,xd,kd,Cd,Pd,Rd,cd,Id,jd,Vd,Wd,Gd,tu,Xd,Kd,Zd].forEach((t=>{su[t.type]=t}));const nu={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ru{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 au(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function ou(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=ou(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=au(t,"--\x3e",r+4,"Comment is not closed.");else{const a=ou(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 ru(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 ru(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 cu(t,e){return du(t)}function du(t,e){const i={};for(let e=0;ebu.set(t,!0)));const xu=new Map;function Su(t){if(bu.has(t))return!0;if(xu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>xu.set(t,!0)));const ku=_u(),Au=_u(),Mu=_u(),wu=_u(),Tu=_u(),Cu=_u(),Bu=_u(),Pu=_u(),Eu=_u(),Ru=_u();_u();const Ou=_u();_u();const Iu=_u();_u();const Lu=_u(),Du=_u(),Fu=Symbol.for("GraphicService"),zu=Symbol.for("GraphicCreator"),ju={"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"},Hu=Object.keys(ju),Vu={duration:200,easing:"cubicOut"};function Nu(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 Wu(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 Uu(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 Gu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Yu(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 Xu{constructor(){this.pools=[]}static identity(t){return Nu(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 Xu.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},Zu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ju=new Ve(1,0,0,1,0,0),Qu={x:0,y:0};let tp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this.path=new Dl,this._clearMatrix=new Ve(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $u.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},Qu),function(t,e,i){return rc(t,0,!1,e,i)}(this.path.commandList,Qu.x,Qu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Qu);const i=ch(this,this.lineWidth,this.dpr);return function(t,e,i,s){return rc(t,e,!0,i,s)}(this.path.commandList,i,Qu.x,Qu.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Ju,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>$u.free(t))),this.stack.length=0}};tp=qu([Ua(),Zu("design:paramtypes",[Object,Number])],tp);const ep={WIDTH:500,HEIGHT:500,DPR:1};class ip{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}set nativeCanvas(t){this._nativeCanvas=t}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=ep.WIDTH,height:n=ep.HEIGHT,dpr:r=ep.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var sp;ip.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sp||(sp={}));class np{static Get(t,e=sp.Color1,i=[0,0,0,1]){if(e===sp.Color1){const e=np.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Qe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];np.store1[t]=e,np.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=np.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Qe.parseColorString(t);return n&&(np.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],np.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===sp.Color1){if(np.store1[t])return;np.store1[t]=i,np.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(np.store255[t])return;np.store255[t]=i,np.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function rp(t,e=!1){return Array.isArray(t)&&x(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 ap(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return op(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):op(t,e,i,s,n)}function op(t,e,i,s,n){if(!t||!e)return t&&rp(t)||e&&rp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=np.Get(t,sp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=np.Get(e,sp.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:rp(a)})))});return o?ap(r,l,i,s,n):ap(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:dp(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:dp(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:dp(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),rp(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)}function lp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}np.store255={},np.store1={};const hp=[0,0,0,0],cp=[0,0,0,0];function dp(t,e,i){return np.Get(t,sp.Color255,hp),np.Get(e,sp.Color255,cp),`rgba(${Math.round(hp[0]+(cp[0]-hp[0])*i)},${Math.round(hp[1]+(cp[1]-hp[1])*i)},${Math.round(hp[2]+(cp[2]-hp[2])*i)},${hp[3]+(cp[3]-hp[3])*i})`}class up{static GetCanvas(){try{return up.canvas||(up.canvas=fo.global.createCanvas({})),up.canvas}catch(t){return null}}static GetCtx(){if(!up.ctx){const t=up.GetCanvas();up.ctx=t.getContext("2d")}return up.ctx}}class pp extends Ne{static getInstance(){return pp._instance||(pp._instance=new pp),pp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=up.GetCanvas(),s=up.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new pp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class gp{static GetSize(t){for(let e=0;e=t)return gp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=gp.GenKey(t,e,i,s,n),l=gp.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=gp.GenKey(t,e,i,s,n);gp.cache[l]?gp.cache[l].push({width:a,height:o,pattern:r}):gp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}gp.cache={},gp.ImageSize=[20,40,80,160,320,640,1280,2560];const fp=new je,mp=new Ve;new je;const vp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],_p=["x","y"],yp=["scaleX","scaleY"],bp=["angle"],xp=new ie,Sp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class kp extends Tc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=su[t];if(e)return e;if(e=kp.userSymbolMap[t],e)return e;if(!0===((i=t=nu[t]||t).startsWith("{const e=(new Dl).fromString(t.d),i={};Hu.forEach((e=>{t[e]&&(i[ju[e]]=t[e])})),n.push({path:e,attribute:i}),fp.union(e.bounds)}));const r=fp.width(),a=fp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new iu(t,n,!0);return kp.userSymbolMap[t]=l,l}var i;const s=(new Dl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new iu(t,s);return kp.userSymbolMap[t]=o,o}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=Uc(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 Bo(t);return Ko(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ve),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Ho.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Ho.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ho.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ho.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ho.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&Ho.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ho.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Vo.GLOBAL){const i=new ie(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Vu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:No.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:No.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:No.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Ho.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Ho.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ho.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ho.UPDATE_SHAPE_AND_BOUNDS)===Ho.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ho.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ho.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ho.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ho.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ho.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ho.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ho.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ho.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=jl.x,y:e=jl.y,scaleX:i=jl.scaleX,scaleY:s=jl.scaleY,angle:n=jl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Nt(a),f=Gt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),fo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(jl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=mp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:No.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:fo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Dl).fromString(t):this.pathProxy=new Dl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),fo.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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||fo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new tp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Ap;kp.userSymbolMap={},kp.mixin(Dc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Ap||(Ap={}));let Mp=class t extends kp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Cu,this._childUpdateTag=Ho.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 kc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new kc)}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 ie(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&Ho.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=jl.x,y:e=jl.y,dx:i=jl.dx,dy:s=jl.dy,scaleX:n=jl.scaleX,scaleY:r=jl.scaleY,angle:a=jl.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 Mc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return fo.graphicService.updateTempAABBBounds(i),fo.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&=Ho.CLEAR_BOUNDS,this._childUpdateTag&=Ho.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Ho.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Ho.UPDATE_BOUNDS||(this._childUpdateTag|=Ho.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Ho.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=fo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function wp(t){return new Mp(t)}Mp.NOWORK_ANIMATE_ATTR=Sp;class Tp extends Mp{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 kc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{fo.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=>{fo.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 Cp=Symbol.for("TransformUtil"),Bp=Symbol.for("GraphicUtil"),Pp=Symbol.for("LayerService"),Ep=Symbol.for("StaticLayerHandlerContribution"),Rp=Symbol.for("DynamicLayerHandlerContribution"),Op=Symbol.for("VirtualLayerHandlerContribution");var Ip,Lp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fp=Ip=class{static GenerateLayerId(){return`${Ip.idprefix}_${Ip.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=fo.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?Ch.get(Ep):"dynamic"===t?Ch.get(Rp):Ch.get(Op),e}createLayer(t,e={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 Tp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ip.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)}};Fp.idprefix="visactor_layer",Fp.prefix_count=0,Fp=Ip=Lp([Ua(),Dp("design:paramtypes",[])],Fp);var zp=new Ea((t=>{t(go).to(ko).inSingletonScope(),t(hc).to(dc),t(Bp).to(fc).inSingletonScope(),t(Cp).to(_c).inSingletonScope(),t(Pp).to(Fp).inSingletonScope()}));function jp(t,e){return!(!t&&!e)}function Hp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Vp(t,e,i){return i&&t*e>0}function Np(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Wp(t,e){return t*e>0}function Up(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Gp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-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-m,B=M-v,P=w-m,E=T-v;return C*C+B*B>P*P+E*E&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Yp(t,e,i,s,n){const r=Ht(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 k=n*Nt(c),A=n*Gt(c),M=s*Nt(u),w=s*Gt(u);let T,C,B,P;if((b>Lt||y>Lt)&&(T=n*Nt(d),C=n*Gt(d),B=s*Nt(p),P=s*Gt(p),r1?0:E<-1?Dt:Math.acos(E))/2),l=Yt(t[0]*t[0]+t[1]*t[1]);S=Ut(b,(s-l)/(o-1)),x=Ut(y,(n-l)/(o+1))}}var E;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:P,xore:T,yore:C,xire:M,yire:w,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 Xp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ht(l-o),c=l>o;let d=!1;if(n=jt-Lt)e.moveTo(i+n*Nt(o),s+n*Gt(o)),e.arc(i,s,n,o,l,!c),r>Lt&&(e.moveTo(i+r*Nt(l),s+r*Gt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:P,innerCornerRadiusEnd:E,maxInnerCornerRadius:R}=Yp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Lt){const t=Ut(v,m),r=Ut(_,m),o=Gp(g,f,u,p,n,t,Number(c)),l=Gp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,n,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Nt(Vt(l.y01,l.x01)),s+l.cy+r*Gt(Vt(l.y01,l.x01))):e.moveTo(i+b,s+n*Gt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Nt(M),s+n*Gt(M));if(!(r>Lt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Lt){const t=Ut(P,w),n=Ut(E,w),o=Gp(S,k,b,x,r,-n,Number(c)),l=Gp(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),w0&&e.arc(i+o.cx,s+o.cy,n,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,r,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Nt(Vt(l.y01,l.x01)),s+l.cy+t*Gt(Vt(l.y01,l.x01))):e.moveTo(i+g,s+f)}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,B,c):e.moveTo(i+r*Nt(B),s+r*Gt(B))}return a?a[3]&&e.lineTo(i+n*Nt(o),s+n*Gt(o)):e.closePath(),d}const $p=Symbol.for("ArcRenderContribution"),Kp=Symbol.for("AreaRenderContribution"),qp=Symbol.for("CircleRenderContribution"),Zp=Symbol.for("GroupRenderContribution"),Jp=Symbol.for("ImageRenderContribution"),Qp=Symbol.for("PathRenderContribution"),tg=Symbol.for("PolygonRenderContribution"),eg=Symbol.for("RectRenderContribution"),ig=Symbol.for("SymbolRenderContribution"),sg=Symbol.for("TextRenderContribution"),ng=Symbol.for("InteractiveSubRenderContribution");function rg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function ag(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}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)},hg=function(t,e){return function(i,s){e(i,s,t)}};function cg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Nu(t),Wu(t,t,[n+o,r+l,a+h]),Wu(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),Wu(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]),f){const i=Ku.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]}Wu(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),Wu(i,i,[-s[0],-s[1],0]),Gu(t,t,i)}}let dg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new uo(["graphic"]),onSetStage:new uo(["graphic","stage"]),onRemove:new uo(["graphic"]),onRelease:new uo(["graphic"]),onAddIncremental:new uo(["graphic","group","stage"]),onClearIncremental:new uo(["graphic","group","stage"]),beforeUpdateAABBBounds:new uo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new je,this.tempAABBBounds2=new je}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Bo(t);return Ko(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=ag(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=rg(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){mu(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;mu(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&&Fe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};dg=og([Ua(),hg(0,Na(zu)),lg("design:paramtypes",[Object])],dg);const ug=(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},pg=["radius","startAngle","endAngle",...vp];class gg extends kp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=wu}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 Mc(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}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.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>jt-Lt?i.set(-r,-r,r,r):Xc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Dl,s.arc(0,0,r,a,o),s}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=Sp;class mg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Ao.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Du,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 Mc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new _g({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=fo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){mu(n,o/Math.abs(r+a),!0,l),i.union(n)}return fo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||fo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Fe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=fo.graphicUtil.textMeasure,S=new mg(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:k}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:y=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),k=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const A=fo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:k},w=new mg(r,M,A),T=_(t)?t.map((t=>t.toString())):[t.toString()],C=[],B=[0,0];let P=1/0;if(y>0&&(P=Math.max(Math.floor(y/k),1)),b&&(P=Math.min(P,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const t=rg(v,r),e=this.cache.verticalList.length*m,i=ag(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===yu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const b=rg(v,r),x=this.cache.verticalList.length*m,S=ag(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Qc(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=vg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=vg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new _g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _g.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return _g.baselineMapAlign}getAlignMapBaseline(){return _g.alignMapBaseline}}function yg(t){return new _g(t)}_g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Sp),_g.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_g.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const bg=["symbolType","size",...vp];let xg=class t extends kp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Lu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Mc(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}=fo.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;mu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return fo.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,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Dl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Dl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Sp);const kg=["segments","points","curveType","curveTension",...vp];let Ag=class t extends kp{constructor(t={}){super(t),this.type="line",this.numberType=Pu}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=Kc(i,s,e))}getGraphicTheme(){return Mc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),fo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return fo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Dl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Mg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Sp);const wg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Tg=["width","x1","y1","height","cornerRadius",...vp];class Cg extends kp{constructor(t){super(t),this.type="rect",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Mc(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}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=wg(e);return t=new Dl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cg.NOWORK_ANIMATE_ATTR}}function Bg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Sp;class Pg extends kp{constructor(t){super(t),this.type="glyph",this.numberType=Tu,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,e=!1,i){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 Mc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Pg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Eg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Sp;class Rg{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=uh[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}}}function Og(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ig{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Qc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Sh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Sh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=yh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Og(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=yh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=yh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Lg=["width","height","image",...vp];class Dg extends kp{constructor(t){super(t),this.type="image",this.numberType=Bu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Mc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Lg)}needUpdateTag(t){return super.needUpdateTag(t,Lg)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Sp);class zg extends Dg{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=Uc(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=Uc(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=ah.width,height:e=ah.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 jg{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 zg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=uh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ig){const e=vh.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 zg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Sh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof zg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof zg)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||gh;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,_h(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||ph;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?dh(t,s,{AABBBounds:i}):s,_h(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof zg)break;const{width:n}=Sh(t,s.character,s.ascentDescentMode),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 zg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{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=uh[this.direction]}store(t){if(t instanceof zg){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 jg(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,e=!1){t instanceof zg?"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||this.newLine)&&("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=yh(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 Ig(i,t.newLine,t.character,t.ascentDescentMode),new Ig(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Vg=!1;try{Vg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Vg=!1}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...vp];class Wg extends kp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Iu,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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Mc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Wg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Wg.splitText(t.text).length>1)))}static splitText(t){if(Vg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Wg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),fo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||fo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}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;e0&&!Wg.AllSingleCharacter(_)&&(_=Wg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Rg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Hg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Wg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Sp);const Gg=["path","customPath",...vp];class Yg extends kp{constructor(t){super(t),this.type="path",this.numberType=Eu}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 Dl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dl?this.cache:t.path)}getGraphicTheme(){return Mc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=fo.graphicService.updateTempAABBBounds(i);ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return fo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Dl).fromString(t.path):t.customPath&&(this.cache=new Dl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){return(new Dl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Sp);const $g=["segments","points","curveType","curveTension",...vp];class Kg extends kp{constructor(t){super(t),this.type="area",this.numberType=Mu}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 Mc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),fo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return fo.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=Kc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Dl;const 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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Sp);const Zg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...vp];class Jg extends kp{constructor(t){super(t),this.type="arc",this.numberType=ku}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(x(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=ae(e),i=e+r,s&&Ht(r)Lt&&o>Lt)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=Yt(a*a+o*o)}=this.attribute,h=Ht(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Lt&&l>Lt){const i=e>t?1:-1;let s=$t(Number(l)/o*Gt(g)),n=$t(Number(l)/a*Gt(g));return(f-=2*s)>Lt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Lt?(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 Mc(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}=fo.graphicService.updateTempAABBBounds(i);ug(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return fo.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<=Lt?i.set(0,0,0,0):Math.abs(o-l)>jt-Lt?i.set(-s,-s,s,s):(Xc(l,o,s,i),Xc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ht(o-a),d=o>a;if(h=jt-Lt)n.moveTo(0+h*Nt(a),0+h*Gt(a)),n.arc(0,0,h,a,o,!d),l>Lt&&(n.moveTo(0+l*Nt(o),0+l*Gt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Nt(a),e=h*Gt(a),i=l*Nt(o),s=l*Gt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Sp);const tf=["points","cornerRadius",...vp];class ef extends kp{constructor(t){super(t),this.type="polygon",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Mc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),fo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return fo.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=Kc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Dl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Sp;class nf extends Mp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function rf(t){return new nf(t)}const af=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 of,lf;function hf(t){return of||(of=af.CreateGraphic("text",{})),of.initAttributes(t),of.AABBBounds}var cf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uf=function(t,e){return function(i,s){e(i,s,t)}};class pf{constructor(){this.time=Go.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Mc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=ac.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),ac.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const gf=new pf;let ff=class{constructor(t){this.subRenderContribitions=t,this.time=Go.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)}))}};ff=cf([Ua(),uf(0,Na(ao)),uf(0,Ga(ng)),df("design:paramtypes",[Object])],ff);const mf=new class{constructor(){this.time=Go.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const vf=new class{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class _f{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=ac.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])),ac.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,jt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=ac.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Sg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:ch(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(),Xp(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"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},xf=yf,Sf=gf;const kf=new class{constructor(){this.time=Go.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{radius:m=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:ch(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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"),f&&M(p,"innerBorder")}},Af=yf,Mf=gf;const wf=new class extends pf{constructor(){super(...arguments),this.time=Go.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Tf=Dt/2;function Cf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Ht(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ht(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ht(t[0]),i=Ht(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ht(l[0]),l[1]=Ht(l[1]),l[2]=Ht(l[2]),l[3]=Ht(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Tf,Dt,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Dt,Dt+Tf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Bf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pf{constructor(){this.time=Go.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,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:ch(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(),Cf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),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&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Ef=class{constructor(){this.time=Go.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)}};Ef=Bf([Ua()],Ef);let Rf=class{constructor(){this.time=Go.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,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x: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 Cf(e,i,s,b,x,v,"bevel"!==y,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Rf=Bf([Ua()],Rf);const Of=new Pf,If=yf,Lf=gf;const Df=new class extends Pf{constructor(){super(...arguments),this.time=Go.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)}},Ff=gf;const zf=new class{constructor(){this.time=Go.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:_=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:ch(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()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},jf=new class{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Hf=yf,Vf=gf;const Nf={x:0,y:0,z:0,lastModelMatrix:null};class Wf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(mf),this.builtinContributions.push(vf),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===Go.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Go.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Mc(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,_=Vp(d,u,h),y=Wp(d,g),b=jp(h),x=Hp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Ko(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Vp(o,l,n),p=Wp(o,c),g=jp(n,r),f=Hp(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,s=!1){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;Nf.x=n,Nf.y=r,Nf.z=a,Nf.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=Ku.allocate(),n=Ku.allocate();cg(n,t,e),Gu(s,d||s,n),Nf.x=0,Nf.y=0,Nf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Nf.x+=s.x,Nf.y+=s.y,Nf.z=a,i.setTransformForCurrent()}else if(p)Nf.x=0,Nf.y=0,Nf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Nf.x+=s.x,Nf.y+=s.y,this.transformWithoutTranslate(i,Nf.x,Nf.y,Nf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Nf.x=0,Nf.y=0,Nf.z=0;return Nf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ku,this.builtinContributions=[bf,Sf,xf],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(nLt){const t=Ut(b,y),r=Ut(x,y),a=Gp(v,_,f,m,n,t,Number(u)),o=Gp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Vt(o.y11,o.x11),Vt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Lt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Lt){const t=Ut(P,T),n=Ut(E,T),a=Gp(M,w,k,A,r,-n,Number(u)),o=Gp(f,m,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,Vt(a.y01,a.x01),Vt(a.y11,a.x11),!u);const t=Vt(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*Nt(B),s+r*Gt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Mc(t,null==r?void 0:r.theme).arc;const{fill:c=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:_,doStroke:y}=f,{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=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ht(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Nc[s]=t,i&&(i=!(null!==(e=Nc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Nc[e]=!!t[e],i&&(i=!!Nc[e]);else Nc[0]=!1,Nc[1]=!1,Nc[2]=!1,Nc[3]=!1;return{isFullStroke:i,stroke:Nc}})(d);if((_||B)&&(e.beginPath(),Xp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Xp(t,e,i,s,A,M,P),C||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())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ht(h-r)>=jt-Lt){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,m,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+=jt;for(;i>jt;)i-=jt;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),ap(o.color,l.color,h,!1)}(0,0,h,n);a||Vp&&(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,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Xf=Uf([Ua(),Yf(0,Na(ao)),Yf(0,Ga($p)),Gf("design:paramtypes",[Object])],Xf);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)},qf=function(t,e){return function(i,s){e(i,s,t)}};let Zf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[kf,Mf,Af],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Jf(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]=il(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 Qf(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 tm(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=Qf(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),Jf(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Wo.ROW:"y"===s?u=Wo.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 im=class extends Wf{constructor(){super(...arguments),this.numberType=Pu}draw(t,e,i,s){const n=Mc(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;if(!e)return;t.beginPath();tm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Ut(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function sm(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),Jf(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),Jf(t,l,1,s),o=!1):o=!0}t.closePath()}im=em([Ua()],im);const nm=new class extends _f{constructor(){super(...arguments),this.time=Go.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:qc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:qc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:qc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:qc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},rm=gf;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)}};let hm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[nm,rm],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=Mc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function P(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,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=Ll(P(t.points,x),B,{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=Ll(P(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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=P(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ll(e,B,{curveTension:b}),n=Ll(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Ut(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Mc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Wo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ht(y.x-b.x),k=Ht(y.y-b.y);x=null==y.x1?Wo.ROW:null==y.y1?Wo.COLUMN:Number.isFinite(S+k)?S>k?Wo.ROW:Wo.COLUMN:Wo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Wo.ROW:Wo.COLUMN,Number.isFinite(c)||(o=Wo.COLUMN),Number.isFinite(d)||(o=Wo.ROW);const u=i*(o===Wo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),tm(t,i[0]?e.top:e.bottom,l,x===Wo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};hm=am([Ua(),lm(0,Na(ao)),lm(0,Ga(Kp)),om("design:paramtypes",[Object])],hm);const cm=yf,dm=gf;var um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gm=function(t,e){return function(i,s){e(i,s,t)}};let fm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[dm,cm],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:Mc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ko(t.pathShape.commandList,e,i,s,1,1,f);else{Ko((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,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=Mc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};fm=um([Ua(),gm(0,Na(ao)),gm(0,Ga(Qp)),pm("design:paramtypes",[Object])],fm);var mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vm=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 ym=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Ou,this.builtinContributions=[Of,Lf,If],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Mc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Np(g,f,w,T,h),B=Up(g,v,w,T,M),P=jp(h,c),E=Hp(d,m);if(!t.valid||!y)return;if(!P&&!E)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Cf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:P,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,P,E,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,P,E,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};ym=mm([Ua(),_m(0,Na(ao)),_m(0,Ga(eg)),vm("design:paramtypes",[Object])],ym);var bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sm=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[zf,Vf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Mc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};km=bm([Ua(),Sm(0,Na(ao)),Sm(0,Ga(ig)),xm("design:paramtypes",[Object])],km);const Am=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new je)}allocate(t,e,i,s){if(!this.pools.length)return(new je).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 je(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Mm=new class extends pf{constructor(){super(...arguments),this.time=Go.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=p(T)&&T.background,E=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(g=T.dx)&&void 0!==g?g: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!==(_=T.height)&&void 0!==_?_:e.height();if(B=Am.allocate(i,s,i+n,s+r),T=T.background,!E){const t=B.width(),e=B.height();B.set((null!==(y=T.x)&&void 0!==y?y: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 B=t.AABBBounds,E||(B=hf(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(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Cf(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Am.free(B),C()}};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},Tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Mm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Mc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=Qc(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=$u.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),$u.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(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,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Mc(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:rg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Pm(t,e,i,s){if(e&&e.length){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},Dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,s){e(i,s,t)}};let zm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(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))?Pm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Pm(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,_=v/m;const y=Em(d,u),b=Em(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Rm(h,_,y,d,u),k=Rm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Em(A,M),T=Rm(h,Em(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let P=B-C;P<0&&(C=B,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,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=Mc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};zm=Lm([Ua(),Fm(0,Na(ao)),Fm(0,Ga(tg)),Dm("design:paramtypes",[Object])],zm);var jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Cu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Mc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Np(p,m,g,f,c),C=Up(p,v,g,f),B=jp(c,u),P=Hp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!P)return;if(!(T||C||a||o||u))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,g,f)):(e.beginPath(),Cf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf));const E={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Go.beforeFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o,E)})),h&&e.clip();const R=()=>{E.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{E.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Go.afterFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=fo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Mc(t,null==s?void 0:s.theme).group,i=Ku.allocate(),n=Ku.allocate();cg(n,t,e),Gu(i,p||i,n),a.modelMatrix=i,Ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Nm=jm([Ua(),Vm(0,Na(ao)),Vm(0,Ga(Zp)),Hm("design:paramtypes",[Object])],Nm);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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,s){e(i,s,t)}};const Ym=["","repeat-x","repeat-y","repeat"];let Xm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[Df,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Cf(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Ym[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void jc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Mc(t).image;this._draw(t,a,!1,i)}};Xm=Wm([Ua(),Gm(0,Na(ao)),Gm(0,Ga(Jp)),Um("design:paramtypes",[Object])],Xm);const $m=Symbol.for("IncrementalDrawContribution"),Km=Symbol.for("ArcRender"),qm=Symbol.for("AreaRender"),Zm=Symbol.for("CircleRender"),Jm=Symbol.for("GraphicRender"),Qm=Symbol.for("GroupRender"),tv=Symbol.for("LineRender"),ev=Symbol.for("PathRender"),iv=Symbol.for("PolygonRender"),sv=Symbol.for("RectRender"),nv=Symbol.for("SymbolRender"),rv=Symbol.for("TextRender"),av=Symbol.for("RichTextRender"),ov=Symbol.for("GlyphRender"),lv=Symbol.for("ImageRender"),hv=Symbol.for("DrawContribution"),cv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Au,!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+=jt;for(;o<0;)o+=jt;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 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},uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const pv=Symbol.for("DrawItemInterceptor"),gv=new je,fv=new je;class mv{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){gv.copy(s.dirtyBounds),fv.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,$u.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(gv),s.backupDirtyBounds.copy(fv)),!0}}class vv{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 _v=class{constructor(){this.order=1,this.interceptors=[new mv,new bv,new yv,new vv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kv=function(t,e){return function(i,s){e(i,s,t)}};const Av=Symbol.for("RenderService");let Mv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Mv=xv([Ua(),kv(0,Na(hv)),Sv("design:paramtypes",[Object])],Mv);var wv=new Ea((t=>{t(Av).to(Mv)}));const Tv=Symbol.for("PickerService"),Cv=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Ev([Ua()],Rv);let Ov=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=Mc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=$u.allocateByObj(a),u=new ie(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}};Ov=Ev([Ua()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ie(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}};Iv=Ev([Ua()],Iv);let Lv=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=cv(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()}};Lv=Ev([Ua()],Lv);var Dv=new Ea(((t,e,i)=>{i(Tv)||(t(Cv).toSelf(),t(Tv).toService(Cv)),t(Lv).toSelf().inSingletonScope(),t(Bv).toService(Lv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),lo(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),lo(t,Pv)})),Fv=new Ea((t=>{t(Fu).to(dg),t(zu).toConstantValue(af)}));const zv=Symbol.for("AutoEnablePlugins"),jv=Symbol.for("PluginService");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},Vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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&&Ch.isBound(zv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Hv([Ua(),Nv(0,Na(ao)),Nv(0,Ga(zv)),Vv("design:paramtypes",[Object])],Wv);var Uv=new Ea((t=>{t(jv).to(Wv),function(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).whenTargetNamed(e)}(t,zv)})),Gv=new Ea((t=>{lo(t,po)})),Yv=new Ea((t=>{t(wh).to(Th).inSingletonScope(),lo(t,wh)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kv=class{constructor(){this.type="static",this.offscreen=!1,this.global=fo.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=Eh({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()}};Kv=Xv([Ua(),$v("design:paramtypes",[])],Kv);var qv=new Ea((t=>{t(Kv).toSelf(),t(Ep).toService(Kv)}));var Zv=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 Jv(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 Qv(t,e,i,s=!1,n=!1){let 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}=Jv(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;t{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}=Jv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,s){e(i,s,t)}};let r_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Qv(e,Yl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ze,this.backupDirtyBounds=new ze,this.global=fo.global,this.layerService=fo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=me(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,$u.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=e_(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&&!be(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Am.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=$u.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Am.free(n),$u.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||Ch.get($m);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 o_=class extends im{constructor(){super(...arguments),this.numberType=Pu}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=Mc(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=Vp(u,p,c),_=Wp(u,g),y=jp(c),b=Hp(d,f);if(!t.valid||!m)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())}};o_=a_([Ua()],o_);var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 h_=class extends hm{constructor(){super(...arguments),this.numberType=Mu}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=Mc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Vp(u,d,c),f=jp(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())}};h_=l_([Ua()],h_);var c_,d_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},u_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p_=function(t,e){return function(i,s){e(i,s,t)}},g_=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"}(c_||(c_={}));let f_=class extends r_{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=c_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return g_(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 g_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return g_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>g_(this,void 0,void 0,(function*(){if(2!==t.count)yield t_(t,Yl.zIndex,((i,s)=>{if(this.status===c_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return g_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return g_(this,void 0,void 0,(function*(){this.rendering&&(this.status=c_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=c_.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 g_(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:()=>g_(this,void 0,void 0,(function*(){yield t_(t,Yl.zIndex,(t=>g_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};f_=d_([Ua(),p_(0,Wa(Jm)),p_(1,Na(o_)),p_(2,Na(h_)),p_(3,Na(ao)),p_(3,Ga(pv)),u_("design:paramtypes",[Array,Object,Object,Object])],f_);var m_=new Ea((t=>{t(pf).toSelf().inSingletonScope(),t(_f).toSelf().inSingletonScope(),t(hv).to(r_),t($m).to(f_),t(Qm).to(Nm).inSingletonScope(),t(Jm).toService(Qm),lo(t,Zp),t(ff).toSelf().inSingletonScope(),lo(t,ng),lo(t,Jm),t(_v).toSelf().inSingletonScope(),t(pv).toService(_v),lo(t,pv)}));function v_(){v_.__loaded||(v_.__loaded=!0,Ch.load(zp),Ch.load(Fv),Ch.load(wv),Ch.load(Dv),Ch.load(Uv),function(t){t.load(Gv),t.load(Yv),t.load(qv)}(Ch),function(t){t.load(m_)}(Ch))}v_.__loaded=!1,v_();const __=Ch.get(go);fo.global=__;const y_=Ch.get(Bp);fo.graphicUtil=y_;const b_=Ch.get(Cp);fo.transformUtil=b_;const x_=Ch.get(Fu);fo.graphicService=x_;const S_=Ch.get(Av);fo.renderService=S_;const k_=Ch.get(Pp);fo.layerService=k_;class A_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class M_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=fo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=fo.global.getRequestAnimationFrame();this.rafId=t((()=>{fo.global.devicePixelRatio!==this.dpr&&(this.dpr=fo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=fo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,fo.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 T_=new je;class C_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(T_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(T_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=fo.global&&fo.global.env;return t?"browser"===t:B_}let E_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};E_._pluginClasses={};const R_="white";class O_ extends Mp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new kc,this.hooks={beforeRender:new uo(["stage"]),afterRender:new uo(["stage"]),afterClearScreen:new uo(["stage"]),afterClearRect:new uo(["stage"])},this.global=fo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=Ch.get(hc),this.renderService=Ch.get(Av),this.pluginService=Ch.get(jv),this.layerService=Ch.get(Pp),this.graphicService=Ch.get(Fu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new zc(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(t=!1){t&&(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,_=(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=E_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,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=E_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=E_.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 A_))}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 M_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ze;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new C_,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=E_.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=E_.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=E_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ie(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Ch.get(hc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Ch.get(Tv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},L_=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 D_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new je}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}}loadFont(t,e,i){return L_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};D_=I_([Ua()],D_);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},z_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let j_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new je,this.modelMatrix=new Ve(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};j_=F_([Ua(),z_("design:paramtypes",[])],j_);var H_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},N_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=fo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 je).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 Ve(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ie(e.x,e.y),a=Mc(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 ie(e.x,e.y);l.transformPoint(a,a);const o=Mc(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&&Ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),$u.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function U_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function G_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Z_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),iy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},sy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new ze;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return iy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return iy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);sy(n[0],s,i),sy(n[1],e-s,i)}};let ny=!1;const ry=new Ea((t=>{ny||(ny=!0,t(Xf).toSelf().inSingletonScope(),t(Km).to(Xf).inSingletonScope(),t(Jm).toService(Km),t($p).toService(ff),lo(t,$p))}));let ay=!1;const oy=new Ea((t=>{ay||(ay=!0,t(ym).toSelf().inSingletonScope(),t(sv).to(ym).inSingletonScope(),t(Jm).toService(sv),t(Rf).toSelf(),t(Ef).toSelf(),t(eg).toService(Rf),t(eg).toService(Ef),t(eg).toService(ff),lo(t,eg))}));let ly=!1;const hy=new Ea((t=>{ly||(ly=!0,t(im).toSelf().inSingletonScope(),t(o_).toSelf().inSingletonScope(),t(tv).to(im).inSingletonScope(),t(Jm).toService(tv))}));let cy=!1;const dy=new Ea((t=>{cy||(cy=!0,t(hm).toSelf().inSingletonScope(),t(qm).to(hm).inSingletonScope(),t(Jm).toService(qm),t(Kp).toService(ff),lo(t,Kp),t(h_).toSelf().inSingletonScope())}));let uy=!1;const py=new Ea((t=>{uy||(uy=!0,t(km).toSelf().inSingletonScope(),t(nv).to(km).inSingletonScope(),t(Jm).toService(nv),t(ig).toService(ff),lo(t,ig))}));let gy=!1;const fy=new Ea((t=>{gy||(gy=!0,t(Zf).toSelf().inSingletonScope(),t(Zm).to(Zf).inSingletonScope(),t(Jm).toService(Zm),t(qp).toService(ff),lo(t,qp))}));let my=!1;const vy=new Ea((t=>{my||(my=!0,t(rv).to(Bm).inSingletonScope(),t(Jm).toService(rv),t(sg).toService(ff),lo(t,sg))}));let _y=!1;const yy=new Ea((t=>{_y||(_y=!0,t(fm).toSelf().inSingletonScope(),t(ev).to(fm).inSingletonScope(),t(Jm).toService(ev),t(Qp).toService(ff),lo(t,Qp))}));let by=!1;const xy=new Ea((t=>{by||(by=!0,t(iv).to(zm).inSingletonScope(),t(Jm).toService(iv),t(tg).toService(ff),lo(t,tg))}));var Sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Tu}reInit(){}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=Mc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Sy([Ua()],ky);let Ay=!1;const My=new Ea((t=>{Ay||(Ay=!0,t(ov).to(ky).inSingletonScope(),t(Jm).toService(ov))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cy=class extends Wf{constructor(){super(),this.numberType=Iu,this.builtinContributions=[Mm],this.init()}drawShape(t,e,i,s,n){const r=Mc(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=Vp(o,l,!0),d=Vp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Mc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Cf(e,i-t,s-n,v,_,f,!0)),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=Mc(t).richtext;this._draw(t,s,!1,i)}};Cy=wy([Ua(),Ty("design:paramtypes",[])],Cy);let By=!1;const Py=new Ea((t=>{By||(By=!0,t(av).to(Cy).inSingletonScope(),t(Jm).toService(av))}));let Ey=!1;const Ry=new Ea((t=>{Ey||(Ey=!0,t(lv).to(Xm).inSingletonScope(),t(Jm).toService(lv),t(Jp).toService(ff),lo(t,Jp))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&snt.getInstance().info(`[VChart log]: ${t}`,...e),Dy=(t,e)=>(c(zy.warnHandler)&&zy.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),Fy=(t,e,i)=>{if(!c(zy.errorHandler))throw new Error(t);zy.errorHandler.call(null,t,e)},zy={silent:!1,warnHandler:!1,errorHandler:!1},jy=P_(),Hy=jy&&globalThis?globalThis.document:void 0;function Vy(t){return("desktop-browser"===t||"mobile-browser"===t)&&jy}function Ny(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Uy=0;function Gy(){return Uy>=9999999&&(Uy=0),Uy++}function Yy(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const $y=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Ky extends Mp{constructor(t,e){super(t),this._skipRenderAttributes=$y,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},kb=(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 Ab extends o{constructor(t,e={}){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.startTime=Oc.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=Oc.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||Sb(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=kb(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=Oc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Sb(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("pointerleave",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("pointerleave",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=Oc.now()-i>this.config.press.time&&kb(s[0],t){fo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tb=[0,0,0];let Cb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Hl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Wl),{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this._clearMatrix=new Ve(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 $u.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&&($u.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=jt;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(f,-2*y),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&&gp.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&&(Yu(Tb,[t,e,i],this.modelMatrix),t=Tb[0],e=Tb[1],i=Tb[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&&(Yu(Tb,[t,e,i],this.modelMatrix),t=Tb[0],e=Tb[1],i=Tb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Yu(Tb,[e,i,s],this.modelMatrix),e=Tb[0],i=Tb[1],s=Tb[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,e=fo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=fo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Wl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Wl.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&&(Yu(Tb,[e,i,s],this.modelMatrix),e=Tb[0],i=Tb[1],s=Tb[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=dh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ch(this,a,this.dpr),r.strokeStyle=dh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>$u.free(t))),this.stack.length=0}};Cb.env="browser",Cb=Mb([Ua(),wb("design:paramtypes",[Object,Number])],Cb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Eb=class extends ip{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=fo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Cb(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 Rb(t,e){return new Ea((i=>{i(Bh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Ph).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Eb.env="browser",Eb=Bb([Ua(),Pb("design:paramtypes",[Object])],Eb);const Ob=Rb(Eb,Cb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Db=function(t,e){return function(i,s){e(i,s,t)}};let Fb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=ac.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 jb=class{constructor(){this.type="group",this.numberType=Cu}contains(t,e,i){return!1}};jb=zb([Ua()],jb);const Hb=new Ea(((t,e,i,s)=>{Hb.__vloaded||(Hb.__vloaded=!0,t(bb).to(jb).inSingletonScope(),t(xb).toService(bb),lo(t,xb))}));Hb.__vloaded=!1;var Vb=Hb;const Nb=new Ea(((t,e,i,s)=>{i(Fb)||t(Fb).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(Fb):t(Tv).toService(Fb)}));var Wb,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},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yb=Wb=class extends j_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=fo.global,this.viewBox=new je,this.modelMatrix=new Ve(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Eb(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 Eb({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)}};Yb.env="browser",Yb.idprefix="visactor_window",Yb.prefix_count=0,Yb=Wb=Ub([Ua(),Gb("design:paramtypes",[])],Yb);const Xb=new Ea((t=>{t(Yb).toSelf(),t(cc).toDynamicValue((t=>t.container.get(Yb))).whenTargetNamed(Yb.env)}));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},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qb=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 Zb{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 Jb(t,e=!1){const i=document.createElement("img");if(fo.global.isImageAnonymous&&(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 Qb=class extends D_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Zb(t)}return new je}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Jb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Jb(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:Pa.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(...t){}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}}loadFont(t,e,i){return qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Qb=$b([Ua(),Kb("design:paramtypes",[])],Qb);const tx=new Ea((t=>{tx.isBrowserBound||(tx.isBrowserBound=!0,t(Qb).toSelf().inSingletonScope(),t(po).toService(Qb))}));function ex(t,e=!0){ex.__loaded||(ex.__loaded=!0,t.load(tx),t.load(Ob),t.load(Xb),e&&function(t){t.load(Vb),t.load(Nb)}(t))}tx.isBrowserBound=!1,ex.__loaded=!1;var ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nx=function(t,e){return function(i,s){e(i,s,t)}};let rx=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 tp(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}};rx=ix([Ua(),nx(0,Na(ao)),nx(0,Ga(qy)),nx(1,Na(ao)),nx(1,Ga(Bv)),nx(2,Na(ao)),nx(2,Ga(Pv)),sx("design:paramtypes",[Object,Object,Object])],rx);const ax=new Ea((t=>{ax.__vloaded||(ax.__vloaded=!0,lo(t,qy))}));ax.__vloaded=!1;var ox=ax;class lx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ch(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}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},cx=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 ux=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};ux=hx([Ua(),dx(0,Na(Km)),cx("design:paramtypes",[Object])],ux);let px=!1;const gx=new Ea(((t,e,i,s)=>{px||(px=!0,t(Zy).to(ux).inSingletonScope(),t(qy).toService(Zy))}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Mu}};_x=fx([Ua(),vx(0,Na(qm)),mx("design:paramtypes",[Object])],_x);let yx=!1;const bx=new Ea(((t,e,i,s)=>{yx||(yx=!0,t(Jy).to(_x).inSingletonScope(),t(qy).toService(Jy))}));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},Sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Ax=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};Ax=xx([Ua(),kx(0,Na(Zm)),Sx("design:paramtypes",[Object])],Ax);let Mx=!1;const wx=new Ea(((t,e,i,s)=>{Mx||(Mx=!0,t(Qy).to(Ax).inSingletonScope(),t(qy).toService(Qy))}));class Tx{constructor(){this.type="glyph",this.numberType=Tu}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 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},Bx=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 Ex=class extends Tx{constructor(t){super(),this.canvasRenderer=t}};Ex=Cx([Ua(),Px(0,Na(ov)),Bx("design:paramtypes",[Object])],Ex);let Rx=!1;const Ox=new Ea(((t,e,i,s)=>{Rx||(Rx=!0,t(ob).to(Ex).inSingletonScope(),t(Ex).toService(ob))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lx=class{constructor(){this.type="image",this.numberType=Bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Lx=Ix([Ua()],Lx);let Dx=!1;const Fx=new Ea(((t,e,i,s)=>{Dx||(Dx=!0,t(tb).to(Lx).inSingletonScope(),t(Lx).toService(tb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};Vx=zx([Ua(),Hx(0,Na(tv)),jx("design:paramtypes",[Object])],Vx);let Nx=!1;const Wx=new Ea(((t,e,i,s)=>{Nx||(Nx=!0,t(eb).to(Vx).inSingletonScope(),t(qy).toService(eb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gx=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 Xx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};Xx=Ux([Ua(),Yx(0,Na(iv)),Gx("design:paramtypes",[Object])],Xx);let $x=!1;const Kx=new Ea(((t,e,i,s)=>{$x||($x=!0,t(ab).to(Xx).inSingletonScope(),t(qy).toService(ab))}));var qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jx=function(t,e){return function(i,s){e(i,s,t)}};let Qx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Eu}};Qx=qx([Ua(),Jx(0,Na(ev)),Zx("design:paramtypes",[Object])],Qx);let tS=!1;const eS=new Ea(((t,e,i,s)=>{tS||(tS=!0,t(ib).to(Qx).inSingletonScope(),t(qy).toService(ib))})),iS=new je;class sS{constructor(){this.type="rect",this.numberType=Ou}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||x(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:ch(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;iS.setValue(i.x1,i.y1,i.x2,i.y2),iS.expand(-r/2),h=!iS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends sS{constructor(t){super(),this.canvasRenderer=t}};oS=nS([Ua(),aS(0,Na(sv)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new Ea(((t,e,i,s)=>{lS||(lS=!0,t(sb).to(oS).inSingletonScope(),t(qy).toService(sb))}));let cS=!1;const dS=new Ea(((t,e,i,s)=>{cS||(cS=!0,t(tb).to(Lx).inSingletonScope(),t(Lx).toService(tb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Lu}};fS=uS([Ua(),gS(0,Na(nv)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Ea(((t,e,i,s)=>{mS||(mS=!0,t(nb).to(fS).inSingletonScope(),t(qy).toService(nb))}));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};let yS=class{constructor(){this.type="text",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yS=_S([Ua()],yS);let bS=!1;const xS=new Ea(((t,e,i,s)=>{bS||(bS=!0,t(rb).to(yS).inSingletonScope(),t(qy).toService(rb))})),SS=new Ea(((t,e,i,s)=>{i(rx)||t(rx).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(rx):t(Tv).toService(rx)}));class kS{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 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},MS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let wS=class extends Cb{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};wS.env="node",wS=AS([Ua(),MS("design:paramtypes",[Object,Number])],wS);var TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BS=class extends ip{constructor(t){super(t)}init(){this._context=new wS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};BS.env="node",BS=TS([Ua(),CS("design:paramtypes",[Object])],BS);const PS=Rb(BS,wS);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},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends j_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new BS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new BS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};IS.env="node",IS=ES([Ua(),OS(0,Na(go)),RS("design:paramtypes",[Object])],IS);const LS=new Ea((t=>{t(IS).toSelf(),t(cc).toDynamicValue((t=>t.container.get(IS))).whenTargetNamed(IS.env)}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 FS=class extends D_{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 Jc.call(t)}}getCancelAnimationFrame(){return t=>{Jc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};FS=DS([Ua()],FS);const zS=new Ea((t=>{zS.isNodeBound||(zS.isNodeBound=!0,t(FS).toSelf().inSingletonScope(),t(po).toService(FS))}));function jS(t,e=!0){jS.__loaded||(jS.__loaded=!0,t.load(zS),t.load(PS),t.load(LS))}zS.isNodeBound=!1,jS.__loaded=!1;var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 VS=class extends Cb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ch(this,l,this.dpr),r.strokeStyle=dh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=fo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,fo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Oe(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Oe(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};VS.env="harmony",VS=HS([Ua()],VS);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},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends ip{constructor(t){super(t)}init(){this._context=new VS(this,this._dpr)}resize(t,e){}release(...t){}};US.env="harmony",US=NS([Ua(),WS("design:paramtypes",[Object])],US);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},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XS=function(t,e){return function(i,s){e(i,s,t)}};class $S{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 KS=class extends j_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new $S}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{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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new US(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}this.canvas=new US({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};KS.env="harmony",KS=GS([Ua(),XS(0,Na(go)),YS("design:paramtypes",[Object])],KS);const qS=new Ea((t=>{t(KS).toSelf(),t(cc).toDynamicValue((t=>t.container.get(KS))).whenTargetNamed(KS.env)})),ZS=Rb(US,VS);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},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tk=class extends D_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new Zc(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new kS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};tk=JS([Ua(),QS("design:paramtypes",[])],tk);const ek=new Ea((t=>{ek.isHarmonyBound||(ek.isHarmonyBound=!0,t(tk).toSelf().inSingletonScope(),t(po).toService(tk))}));function ik(t,e=!0){ik.__loaded||(ik.__loaded=!0,t.load(ek),t.load(ZS),t.load(qS),e&&function(t){t.load(ox),t.load(SS),t.load(gx),t.load(bx),t.load(wx),t.load(Ox),t.load(Fx),t.load(Wx),t.load(Kx),t.load(eS),t.load(hS),t.load(dS),t.load(vS),t.load(xS)}(t))}ek.isHarmonyBound=!1,ik.__loaded=!1;var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};ak=sk([Ua(),rk(0,Na(Km)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Ea(((t,e,i,s)=>{ok||(ok=!0,t(lb).to(ak).inSingletonScope(),t(xb).toService(lb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends sS{constructor(t){super(),this.canvasRenderer=t}};uk=hk([Ua(),dk(0,Na(sv)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Ea(((t,e,i,s)=>{pk||(pk=!0,t(gb).to(uk).inSingletonScope(),t(xb).toService(gb))}));class fk extends Wf{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:ch(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends fk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};yk=mk([Ua(),_k(0,Na(tv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Ea(((t,e,i,s)=>{bk||(bk=!0,t(ub).to(yk).inSingletonScope(),t(xb).toService(ub))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Mu}};Mk=Sk([Ua(),Ak(0,Na(qm)),kk("design:paramtypes",[Object])],Mk);let wk=!1;const Tk=new Ea(((t,e,i,s)=>{wk||(wk=!0,t(hb).to(Mk).inSingletonScope(),t(xb).toService(hb))}));class Ck extends Wf{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&&Ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},Pk=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 Rk=class extends Ck{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Lu}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:ch(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Rk=Bk([Ua(),Ek(0,Na(nv)),Pk("design:paramtypes",[Object])],Rk);let Ok=!1;const Ik=new Ea(((t,e,i,s)=>{Ok||(Ok=!0,t(fb).to(Rk).inSingletonScope(),t(xb).toService(fb))}));var Lk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};zk=Lk([Ua(),Fk(0,Na(Zm)),Dk("design:paramtypes",[Object])],zk);let jk=!1;const Hk=new Ea(((t,e,i,s)=>{jk||(jk=!0,t(cb).to(zk).inSingletonScope(),t(xb).toService(cb))}));var Vk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wk=function(t,e){return function(i,s){e(i,s,t)}};let Uk=class extends Ck{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Du}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=ag(a,u,n),v=rg(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&&Ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Uk=Vk([Ua(),Wk(0,Na(rv)),Nk("design:paramtypes",[Object])],Uk);let Gk=!1;const Yk=new Ea(((t,e,i,s)=>{Gk||(Gk=!0,t(mb).to(Uk).inSingletonScope(),t(xb).toService(mb))}));var Xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Kk=function(t,e){return function(i,s){e(i,s,t)}};let qk=class extends fk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Eu}};qk=Xk([Ua(),Kk(0,Na(ev)),$k("design:paramtypes",[Object])],qk);let Zk=!1;const Jk=new Ea(((t,e,i,s)=>{Zk||(Zk=!0,t(pb).to(qk).inSingletonScope(),t(xb).toService(pb))}));var Qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eA=function(t,e){return function(i,s){e(i,s,t)}};let iA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};iA=Qk([Ua(),eA(0,Na(iv)),tA("design:paramtypes",[Object])],iA);let sA=!1;const nA=new Ea(((t,e,i,s)=>{sA||(sA=!0,t(vb).to(iA).inSingletonScope(),t(xb).toService(vb))}));var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends Tx{constructor(t){super(),this.canvasRenderer=t}};lA=rA([Ua(),oA(0,Na(ov)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new Ea(((t,e,i,s)=>{hA||(hA=!0,t(yb).to(lA).inSingletonScope(),t(xb).toService(yb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Iu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};gA=dA([Ua(),pA(0,Na(av)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new Ea(((t,e,i,s)=>{fA||(fA=!0,t(_b).to(gA).inSingletonScope(),t(xb).toService(_b))}));var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Bu}};bA=vA([Ua(),yA(0,Na(lv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Ea(((t,e,i,s)=>{xA||(xA=!0,t(db).to(bA).inSingletonScope(),t(xb).toService(db))})),kA=P_();function AA(){AA.__loaded||(AA.__loaded=!0,af.RegisterGraphicCreator("arc",Qg),Ch.load(ry),Ch.load(kA?lk:gx))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,af.RegisterGraphicCreator("area",qg),Ch.load(dy),Ch.load(kA?Tk:bx))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,af.RegisterGraphicCreator("circle",fg),Ch.load(fy),Ch.load(kA?Hk:wx))}CA.__loaded=!1;const BA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,af.RegisterGraphicCreator("glyph",Eg),Ch.load(My),Ch.load(kA?cA:Ox))}PA.__loaded=!1;const EA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,af.RegisterGraphicCreator("group",wp))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,af.RegisterGraphicCreator("image",Fg),Ch.load(Ry),Ch.load(kA?SA:Fx))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,af.RegisterGraphicCreator("line",Mg),Ch.load(hy),Ch.load(kA?xk:Wx))}DA.__loaded=!1;const FA=DA;function zA(){zA.__loaded||(zA.__loaded=!0,af.RegisterGraphicCreator("path",Xg),Ch.load(yy),Ch.load(kA?Jk:eS))}zA.__loaded=!1;const jA=zA;function HA(){HA.__loaded||(HA.__loaded=!0,af.RegisterGraphicCreator("polygon",sf),Ch.load(xy),Ch.load(kA?nA:Kx))}HA.__loaded=!1;const VA=HA;function NA(){NA.__loaded||(NA.__loaded=!0,af.RegisterGraphicCreator("rect",Bg),Ch.load(oy),Ch.load(kA?gk:hS))}NA.__loaded=!1;const WA=NA;function UA(){UA.__loaded||(UA.__loaded=!0,af.RegisterGraphicCreator("richtext",Ug),Ch.load(Py),Ch.load(kA?mA:dS))}UA.__loaded=!1;const GA=UA;function YA(){YA.__loaded||(YA.__loaded=!0,af.RegisterGraphicCreator("shadowRoot",rf))}YA.__loaded=!1;const XA=YA;function $A(){$A.__loaded||($A.__loaded=!0,af.RegisterGraphicCreator("symbol",Sg),Ch.load(py),Ch.load(kA?Ik:vS))}$A.__loaded=!1;const KA=$A;function qA(){qA.__loaded||(qA.__loaded=!0,af.RegisterGraphicCreator("text",yg),Ch.load(vy),Ch.load(kA?Yk:xS))}qA.__loaded=!1;const ZA=qA;function JA(){OA(),WA()}const QA=-.5*Math.PI,tM=1.5*Math.PI,eM="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 iM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(iM||(iM={}));const sM={[iM.selectedReverse]:{},[iM.selected]:{},[iM.hover]:{},[iM.hoverReverse]:{}},nM={container:"",width:30,height:30,style:{}},rM="scrollDrag";function aM(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const oM={debounce:yt,throttle:bt};JA();let lM=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=aM(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:oM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=mt(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(rM,{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",oM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(mt(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:si(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]=si(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]=mt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?mt([a+i*n,a+s*n],a,n-l):mt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=aM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};lM.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};var hM,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};let dM=hM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new ze).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ht(t.deltaX)>Ht(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new je,e.addEventListener("wheel",this.scroll),this.params=hM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(rM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new lM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(dM)||(t(dM).toSelf(),t(zv).toService(dM))}));function pM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&pM(t,e)}))}const gM=t=>!d(t)&&!1!==t.visible;function fM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function mM(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 _M=["#ffffff","#000000"];function yM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Qe(t).toHex(),o=new Qe(e).toHex();return bM(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(..._M);for(const n of a)if(t!==n&&bM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function bM(t,e,i,s,n){if("lightness"===n){const i=Qe.getColorBrightness(new Qe(e));return Qe.getColorBrightness(new Qe(t))<.5?i>=.5:i<.5}return s?xM(t,e)>s:"largeText"===i?xM(t,e)>3:xM(t,e)>4.5}function xM(t,e){const i=SM(t),s=SM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function SM(t){const e=ei(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 kM(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 MM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const TM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:eM,fontSize:14},s),getTextBounds:i?void 0:hf,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function CM(t,e,i={}){if(!t)return{width:0,height:0};const s=hf({text:t,fontFamily:e.fontFamily||i.fontFamily||eM,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 BM(t,e="type"){var i,s;return p(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 PM(t){var e,i;return u(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 EM(t,e="type"){const i=BM(t,e);return"rich"===i?af.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),af.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 LM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function DM(){OA(),WA(),KA(),GA(),ZA()}var FM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=FM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Dl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},zM.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))}}zM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const jM={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}},HM={poptip:z({},jM)};var VM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Ut(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Ut(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Dt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Dt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Dt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}$M.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var KM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 qM=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,$M.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new $M(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,HM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};qM=KM([Ua()],qM);var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 JM{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 QM=class extends JM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};QM=ZM([Ua()],QM);let tw=class extends JM{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)}};tw=ZM([Ua()],tw);const ew=new Ea(((t,e,i,s)=>{i(qM)||(t(qM).toSelf().inSingletonScope(),t(ng).toService(qM)),i(QM)||(t(QM).toSelf(),t(zv).toService(QM)),i(tw)||(t(tw).toSelf(),t(zv).toService(tw))}));class iw extends Ky{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}OA(),FA();class sw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sw.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})}}sw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},OA(),WA();class nw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nw.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})}}nw.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},OA(),MA();class rw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rw.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=se.distancePP(t,e);this.setAttribute("radius",i)}}rw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},OA(),MA();class aw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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=QA,endAngle:s=tM}=this.attribute,n=s-i,r=re(he(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}aw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},OA(),jA();class ow extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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=oe(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=se.distancePP(t,e);this.setAttribute("radius",i)}}function lw(){OA(),FA(),VA(),KA()}function hw(){OA(),FA(),MA(),KA()}ow.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},lw();class cw extends Ky{getStartAngle(){return ce(this._startAngle)}getEndAngle(){return ce(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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(k(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=af.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),P(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=af.line;G(i)[0].cornerRadius&&(t=af.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=af.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}cw.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}}},hw();class dw extends cw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=af.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var uw,pw;!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"}(uw||(uw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(pw||(pw={}));const gw={[pw.selectedReverse]:{},[pw.selected]:{},[pw.hover]:{},[pw.hoverReverse]:{}},fw={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}}},mw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const vw=Math.sin(Math.PI/10);function _w(t,e=vw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function yw(t,e=vw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function bw(t){const e={};return pM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function xw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Sw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return AM(r,(s?-1:1)*(n?-1:1)*t/MM(r))}function kw(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 Mw(t,e,i){var s;if(yw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Le(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Le(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>De(n,r)}function ww(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(iM.hover,!0),pM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(iM.hoverReverse,!0)})),s):i},Cw=(t,e,i)=>i?(pM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(iM.hoverReverse),t.removeState(iM.hover))})),null):i,Bw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(iM.selected)?(pM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(iM.selectedReverse),t.removeState(iM.selected))})),null):s.name&&!P(s.states)?(s.addState(iM.selected,!0),pM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(iM.selectedReverse,!0)})),s):i};class Pw extends Ky{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Ew={type:"default",duration:300,easing:"linear"};class Rw extends Pw{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Tw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Cw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Bw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=af.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._prepare(),this._prevInnerView=this._innerView&&bw(this._innerView),this.removeAllChild(!0),this._innerView=af.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Ew)}_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=af.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=uw.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=af.group({x:0,y:0,pickable:!1});t.name=uw.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=af.group({x:0,y:0,pickable:!1});i.name=uw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=af.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=uw.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=sM;else{const t=this.data[s],e=z({},sM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=af.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=uw.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=sM;else{const i=z({},sM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=af.group({x:0,y:0,pickable:!1});return r.name=`${uw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=EM(this._getLabelAttribute(t,e,n,i));if(a.name=uw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=sM;else{const s=z({},sM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new zM(Object.assign({},e));i.name=uw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return xw(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&&c(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;Ht(s[0])>Ht(s[1])?o=Dt/2*(l.x>e.x?1:-1):h=Dt/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+E(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+E(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:_}=this.attribute.label;_=c(_)?z({},fw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d: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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},pM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Ow={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&&Mw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Iw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Lw(t,e,i,s,n=!1){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=c(n)?n:Ow[n]||Ow.parity;if(s.length>=3&&ww(s,r)){do{s=a(s,r)}while(s.length>=3&&ww(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Mw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Lw(l,s,n,(t=>Mw(t,l,r))),Lw(h,s,o,(t=>Mw(t,h,r)||!(!n||t===l)&&Mw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Fw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Hw(t,e.attribute.angle)),{angle:jw(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({},Vw(t,e.attribute.angle)),{angle:jw(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=ke({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 jw(t=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 Hw(t,e=0){let 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=jw(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 Vw(t,e=0){let 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=jw(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 Nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=yw(h),m=_w(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);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(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(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 Ww(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Uw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=MM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return AM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Gw{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-Gw.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Gw.bounceIn(2*t):.5*Gw.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*jt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/jt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*jt/e)*.5+1}}static registerFunc(t,e){Gw[t]=e}}function Yw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Gw.quadIn=Gw.getPowIn(2),Gw.quadOut=Gw.getPowOut(2),Gw.quadInOut=Gw.getPowInOut(2),Gw.cubicIn=Gw.getPowIn(3),Gw.cubicOut=Gw.getPowOut(3),Gw.cubicInOut=Gw.getPowInOut(3),Gw.quartIn=Gw.getPowIn(4),Gw.quartOut=Gw.getPowOut(4),Gw.quartInOut=Gw.getPowInOut(4),Gw.quintIn=Gw.getPowIn(5),Gw.quintOut=Gw.getPowOut(5),Gw.quintInOut=Gw.getPowInOut(5),Gw.backIn=Gw.getBackIn(1.7),Gw.backOut=Gw.getBackOut(1.7),Gw.backInOut=Gw.getBackInOut(1.7),Gw.elasticIn=Gw.getElasticIn(1,.3),Gw.elasticOut=Gw.getElasticOut(1,.3),Gw.elasticInOut=Gw.getElasticInOut(1,.3*1.5),Gw.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Gw.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Gw.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Gw[`flicker${t}`]=e=>Yw(e,t);for(let t=2;t<10;t++)Gw[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Xw(t,e,i){return t+(e-t)*i}const $w=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Xw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Xw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Xw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Xw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Xw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Xw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Xw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Xw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Xw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=ap(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?lp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=ap(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?lp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Xw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Xw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Xw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Xw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Xw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Xw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Xw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Xw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Xw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Kc(e,i,s),r.addUpdateBoundTag()}}};function Kw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Gw[s])&&void 0!==n?n:Gw.linear:Gw.linear,"wait"===t&&(this.onUpdate=qw),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=np.Get(i,sp.Color255),r=np.Get(s,sp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push($w["fill"===e?"fillPure":"strokePure"])}else $w[e]?t.push($w[e]):t.push(Kw)}else $w[e]?t.push($w[e]):t.push(Kw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Jw extends Zw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Qw extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===To.END?this.removeAnimate(t,!0):t.status!==To.RUNNING&&t.status!==To.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const tT=new Qw;tT.isGlobal=!0;class eT{constructor(t=Pa.GenAutoIncrementId(),e=tT,i){this.id=t,this.status=To.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Zw(wo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Jw(wo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new Zw(wo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===To.RUNNING&&(this.status=To.PAUSED)}resume(){this.status===To.PAUSED&&(this.status=To.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==To.END&&this.onEnd(),this.status=To.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=To.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===To.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=To.END);this.status=To.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const iT=new vo;class sT{constructor(){this.released=!1}tick(t,e){iT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class nT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Mo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Mo.INITIAL,fo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),fo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new sT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Mo.INITIAL&&(this.status=Mo.PAUSE,!0)}resume(){return this.status!==Mo.INITIAL&&(this.status=Mo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Mo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Mo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Mo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Mo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Mo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Mo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}oT.getInstance();class lT{static registerBuiltInAnimate(t,e){lT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&c(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+d:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&c(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+d+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=d*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const P=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,E=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;E&&R&&(i=null!==(h=E[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+P;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_;if(e&&i){const d=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=c(h)?h.call(null,null!==(m=d&&(null===(f=d.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,d):h;d.options=y,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lT.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}lT.builtInAnimateMap={};const hT="appear",cT="disappear",dT="update",uT="highlight",pT="unhighlight";class gT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=oT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lT(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hT],[{name:hT,animation:t}],e)}applyDisappearState(t,e){this.applyState([cT],[{name:cT,animation:t}],e)}applyUpdateState(t,e){this.applyState([dT],[{name:dT,animation:t}],e)}applyHighlightState(t,e){this.applyState([uT],[{name:uT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mT)._getAnimationStateManager(t),t}}class vT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new eT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:tT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new Qw}createTicker(t){return new nT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _T(){U(kp,mT),U(kp,vT)}class yT extends Zw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bT extends yT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ST(t){return new xT(t)}class kT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const AT=1e3,MT="quadInOut",wT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],TT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=ap(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},CT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?q_(t):[],n=q_(e);i&&s&&(i.fromTransform&&Z_(s,i.fromTransform.clone().getInverse()),Z_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},PT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ET=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!PT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?np.Get(t,sp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class RT extends yT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;CT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&TT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const OT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=BT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ET(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new RT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:AT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:MT);return c.play(d),c};class IT extends yT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;CT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&TT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const LT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>wT.includes(t))(i)||(e[i]=t[i])})),e},DT=(t,e,i)=>{const s=LT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=fo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},FT=(t,e,i)=>{const s=[],n=i?null:LT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:LT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=wg(t.attribute),n=Q_(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(fo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Q_(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(fo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Q_(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(fo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ty(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ty(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(fo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ey(i)}];const s=[];return sy(i,e,s),s})(t,e).forEach((t=>{s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return sy(l,e,h),h})(t,e).forEach((t=>{s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=q_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(fo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&DT(t,s,e),s};class jT extends yT{constructor(t,e,i,s,n){super(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(){super.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:No.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:No.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:No.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class HT extends jT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=fo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 VT extends jT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=fo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class NT extends yT{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ie(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=$c(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class GT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class YT extends UT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class XT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class $T extends UT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const KT=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class qT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class ZT extends qT{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=KT(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class JT extends qT{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class QT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const eC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class iC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=eC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class rC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>$c(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class aC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:nC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class oC extends rC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:nC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const lC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class hC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:lC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends rC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:lC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class uC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends rC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const gC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class fC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mC extends fC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=gC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class vC extends fC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const _C=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class yC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=_C(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class SC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class kC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class AC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class MC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends MC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class TC extends MC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class CC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends CC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class PC extends CC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class EC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class RC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=fo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Dl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=fo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:No.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:No.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=il(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=il(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=af.group({zIndex:999});e.name=uw.axisBreak,e.id=this._getNodeId(`${uw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},mw,s),a=null!==(e=r.size)&&void 0!==e?e:mw.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=af.symbol(Object.assign({x:s.x,y:s.y},o));l.name=uw.axisBreakSymbol;const h=af.symbol(Object.assign({x:n.x,y:n.y},o));h.name=uw.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=af.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=uw.background,n.id=this._getNodeId("background"),n.states=z({},gw,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=DC(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];P(l)||(c.state={line:z({},gw,l),symbol:z({},gw,l)});const d=new cw(c);d.name=uw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return dt(t[0],0)?dt(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:u}=s,p=DC(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),_=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=+E(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),w=this.getTextBaseline(A,!1);let C=u;if(d(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},gw,c.text),shape:z({},gw,c.shape),panel:z({},gw,c.background)}});return B.angle=T,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return dt(t[1],0)?i=!dt(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 Hw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Vw(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(P(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=ne(e)})),zw(i,t),!Fw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=yw(a),l=_w(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=Ww(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);k(i)&&(c=Ut(c,i))}}else{if(l){const i=Ww(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);k(i)&&(c=Ut(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&&k(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);Nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&Dw(t,{orient:o,method:m,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(k(c)&&(!k(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=af.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=uw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(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=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=si(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}}FC.defaultAttributes=fw,U(FC,Uw);class zC{isInValidValue(t){const{startAngle:e=QA,endAngle:i=tM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=QA,endAngle:i=tM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return oe(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Sw(t,i,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 jC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=jC(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 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);n0&&(c=r,d=0),k(l)&&l>=3){const t=kw(n,l,c,e,i);h=af.path(Object.assign(Object.assign({},a.style),{path:Aw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=af.circle(t)}h.name=uw.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=z({},gw,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:u={}}=a,p=NC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=E(this.attribute.label,"style.fontSize",12)+E(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},gw,u.text),shape:z({},gw,u.shape),panel:z({},gw,u.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(dt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=jC(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&&HC(e,c,i)}else e.AABBBounds.width()>r&&HC(e,r,i)}else o>a.x&&h.x2>n.x2?(HC(e,n.x2-o,i),r&&VC(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return dt(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}}WC.defaultAttributes=fw,U(WC,zC);const UC=t=>t.map(((t,e)=>({index:e,value:t}))),GC=(t,e,i=0)=>{const s=new je(t).expand(i/2),n=new je(e).expand(i/2);return s.intersects(n)},YC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ne(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=TM(a),_=t.range();let y=[];for(let i=0;i{KC[t]=!0}));const tB=t=>-Math.log(-t),eB=t=>-Math.exp(-t),iB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,sB=t=>10===t?iB:t===Math.E?Math.exp:e=>Math.pow(t,e),nB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),rB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),aB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function oB(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 lB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function hB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function cB(t,e,i,s){return 1===i&&(i=0),hB(t,i,s)*(e/(1-i))}function dB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function uB(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]{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 gB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=dB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 fB=Symbol("implicit");class mB extends gB{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=$C.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=fB}clone(){const t=(new mB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==fB)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 vB(t,e,r,n)}class yB extends mB{constructor(t){super(),this.type=$C.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=cB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:_B(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return _B(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=vt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new yB(!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:bB}=ii;function xB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return xt(t,e);if("string"===i){if(s=Qe.parseColorString(e)){const e=bB(Qe.parseColorString(t),s);return t=>e(t).formatRgb()}return xt(Number(t),Number(e))}return e instanceof ti?bB(t,e):e instanceof Qe?bB(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):xt(Number(t),Number(e))}class SB extends gB{constructor(t=QC,e=QC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=QC,this._piecewise=lB,this._interpolate=xB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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),xt)),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,tt);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=St,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=vt(i[0],i[r-1])),this._piecewise=r>2?uB:lB,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:QC),this.rescale(i)):this._clamp!==QC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const kB=Math.sqrt(50),AB=Math.sqrt(10),MB=Math.sqrt(2),wB=[1,2,5,10],TB=(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=EB(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)),J(0,e).map((t=>n+t*s))):t>0?BB(0,-(e-1)/s,s):BB((e-1)/s,0,s)},CB=gt(((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 TB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return TB(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=BB(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=BB(t,e,l);return n&&r.reverse(),r})),EB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=wB[0];return i>=kB?s=wB[3]:i>=AB?s=wB[2]:i>=MB&&(s=wB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function RB(t,e,i){const s=(e-t)/Math.max(0,i);return EB(s)}function OB(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;e0;){if(s=RB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function LB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const DB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),FB=gt(((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})),zB=gt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=PB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?DB(t,e,n):DB(t,e,pB(n)),h=DB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),jB=gt(((t,e,i,s,n)=>OB(s(t),s(e),i).map((t=>pB(n(t))))));class HB extends SB{constructor(){super(...arguments),this.type=$C.Linear}clone(){var t;const e=new HB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return CB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=PB(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(t=10){const e=this.calculateVisibleDomain(this._range);return OB(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 NB(t){return e=>-t(-e)}function WB(t=Number.EPSILON){return e=>Math.max(e,t)}class UB extends SB{constructor(){super(nB(10),sB(10)),this.type=$C.Log,this._limit=WB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new UB).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=nB(this._base),s=sB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=NB(i),this._pows=NB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=tB,this.untransformer=eB):(this._logs=i,this._pows=s,this._limit=WB(),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 QC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return FB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jB(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(UB,VB);class GB extends HB{constructor(){super(rB(1),aB(1)),this.type=$C.Symlog,this._const=1}clone(){return(new GB).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=rB(t),this.untransformer=aB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return FB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(GB,VB);class YB{constructor(){this.type=$C.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!d(t)&&k(+t)?this._range[rt(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 YB).domain(this._domain).range(this._range).unknown(this._unknown)}}function XB(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 $B(t,e,i,s,n=!1){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,n,r;if(!qC(t.type))return UC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return UC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=XB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=XB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=XB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=XC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=XC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?qB.greedy:qB.parity;for(;l.length>=3&&ww(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Mw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),$B(t,l,a,(e=>Mw(e,t,i))),$B(n,l,o,(e=>Mw(e,n,i)||!(!a||e===t)&&Mw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return UC(m)},qB={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Mw(i,t,e)||(i=t,0))))}},ZB=(t,e,i,s)=>{const n=XC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},JB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,QB=(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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?UC([s[s.length-1]]):UC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=ZB(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=eP(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=ZB(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!JB(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?QB(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=TM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=oe({x:0,y:0},i,t),a=xw(r,Sw(s,r,e,n));return o=a,l=Sw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(dt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 UC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=iP(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=nP(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return UC(d)},nP=(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&&GC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},rP=new Uint32Array(33),aP=new Uint32Array(33);aP[0]=0,rP[0]=~aP[0];for(let t=1;t<=32;++t)aP[t]=aP[t-1]<<1|1,rP[t]=~aP[t];function oP(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&rP[31&o]&aP[1+(31&l)])return!0}else{if(i[h]&rP[31&o])return!0;if(i[c]&aP[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,rP[31&o]&aP[1+(31&l)]);else for(s(h,rP[31&o]),s(c,aP[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,aP[31&a]|rP[1+(31&o)]);else for(n(l,aP[31&a]),n(h,rP[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 lP(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ft(i,-o,t.width+l),d=ft(s,-o,t.width+l),u=ft(n,-a,t.height+h),p=ft(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function hP(t,e,i=!1){return i?lP(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function cP(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=hP(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=lP(t,r)),e.getRange(r)))}function dP(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>u(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return dP(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return dP(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return dP(t,e,n,s,h,d)}return!1}const pP=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],gP=["top","inside-top","inside"];function fP(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const mP={mode:"same-time",duration:300,easing:"linear"};function vP(t){return 3===t||4===t}function _P(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 yP=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 bP(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)}}var xP=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const AP=(t,e)=>Math.ceil(t)>Math.floor(e),MP=([t,e],[i,s])=>s>t&&e>i;function wP(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 TP=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||P(e.states)||(e.addState(iM.hover,!0),pM(this,(t=>{t===e||P(t.states)||t.addState(iM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(pM(this,(t=>{P(t.states)||(t.removeState(iM.hoverReverse),t.removeState(iM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void pM(this,(t=>{P(t.states)||(t.removeState(iM.selectedReverse),t.removeState(iM.selected))}));P(e.states)||(e.addState(iM.selected,!0),pM(this,(t=>{t===e||P(t.states)||t.addState(iM.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)===No.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===No.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(be(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[bP(g,f,c,d,a,o),bP(-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=af.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Dl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),c(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return EM(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=c(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&AP(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&AP(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(dt(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(wP([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])&&!MP([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 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},h),{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(hP(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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(hP(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(hP(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{BP[t]=e};var EP=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{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,i,s)}}RP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const OP=()=>{PP("symbol",RP),PP("line-data",RP)};var IP=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{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}}}LP.tag="rect-label",LP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var DP=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};FP.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const zP=()=>{PP("line",FP),PP("area",FP)};var jP=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=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ue(h.endAngle-d/2),g=oe(c,h.outerRadius,o),f=oe(c,a+e.line.line1MinLength,o),m=new HP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=oe(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):vP(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=oe(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ut(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=vP(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=vP(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&&(pt(t.pointB.x,this._line2MinLength+h)||ut(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=vP(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?d(h)||"auto"===h?"edge"===c?vP(t.quadrant)?"left":"right":vP(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(vP(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(dt(l/2,u))g=0,f=1,m=-p;else if(dt(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?dt(v[0].y,v[1].y)?ut(t.middleAngle,-Math.PI)&&pt(t.middleAngle,0)||ut(t.middleAngle,Math.PI)&&pt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 UP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=se.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 GP(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=Aw(t,!!n),o=Aw(r,!!n);const h=se.distancePP(s,l),c=se.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=UP(e,t,!1,!!n),o=UP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Aw(t,!!n),o=Aw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}WP.defaultAttributes={pickable:!1};class YP extends Ky{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&bw(this._innerView),this.removeAllChild(!0),this._innerView=af.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 xw(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?`${uw.grid}-sub`:`${uw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Aw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=UP(t,o,!1,!!a)}const u=af.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:YP.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Aw(o,!!a),m=Ht(o[0].x-o[1].x),v=Ht(o[0].y-o[1].y),_=af.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Dt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:YP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),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=!dt(a.value,0)&&!dt(l.value,0),d=!dt(a.value,1)&&!dt(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}}YP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},OA(),jA();class XP extends YP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},YP.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=QA,endAngle:r=tM}=this.attribute;i=kw(t,s,se.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(XP,Uw);var $P=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var 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(KP,zC);const qP="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",ZP={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:qP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:qP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},JP={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 QP;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QP||(QP={}));var tE=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=QP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=aM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===QP.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===QP.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=QP.endHandler):h+=l:this._activeTag===QP.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===QP.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===__.env?__:this.stage,e=aM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===QP.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===QP.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=tE(c,["formatMethod"]),{formatMethod:g}=d,f=tE(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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+m*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==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*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==f?void 0:f.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({},f,{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 ze).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:W}=this.attribute,{start:U,end:G}=this.state,{position:Y,width:X,height:$}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:X,height:$,cursor:N?"crosshair":"auto"},L),{pickable:!W&&(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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y,width:(G-U)*X,height:$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(r=z.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+U*$,width:X,height:(G-U)*$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y-t,width:(G-U)*X,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!W&&(null===(p=null===(u=null===(d=j.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+(U+G)/2*X,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!W&&(null===(m=j.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*X,y:Y.y+$/2,size:$,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},JP.horizontal),H),{pickable:!W&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*X,y:Y.y+$/2,size:$,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},JP.horizontal),V),{pickable:!W&&(null===(b=V.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+U*X-t/2,y:Y.y+$/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},JP.horizontal),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*X-i/2,y:Y.y+$/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},JP.horizontal),{pickable:!W}),"rect")}else{if(j.visible){const t=(null===(x=j.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+X,y:Y.y+U*$,width:t,height:(G-U)*$},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!W&&(null===(M=null===(A=null===(k=j.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+X+t/2,y:Y.y+(U+G)/2*$,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=j.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},j.icon),{pickable:!W&&(null===(B=null===(C=j.icon)||void 0===C?void 0:C.pickable)||void 0===B||B)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+U*$,size:X,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},JP.vertical),H),{pickable:!W&&(null===(E=H.pickable)||void 0===E||E)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+G*$,size:X,symbolType:null!==(R=V.symbolType)&&void 0!==R?R:"square"},JP.vertical),V),{pickable:!W&&(null===(O=V.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+X/2+t/2,y:Y.y+U*$-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},JP.vertical),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+X/2+i/2,y:Y.y+G*$-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},JP.vertical),{pickable:!W}),"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 zM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;u(t)&&u(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,...G(a))}setPreviewPointsX(t){c(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._statePointToData=t)}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var sE,nE,rE,aE;function oE(){OA(),DM(),_T()}iE.defaultAttributes=ZP,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"}(sE||(sE={})),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"}(nE||(nE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(rE||(rE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(aE||(aE={}));class lE extends Ky{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Tw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Cw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Bw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=af.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=af.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=af.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 hE(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 cE(t,e,i,s){t&&(hE(t.startSymbol,e,i,s),t.lines.forEach((t=>hE(t,e,i,s))),hE(t.line,e,i,s),hE(t.endSymbol,e,i,s))}function dE(t,e,i,s){t&&(hE(t.getTextShape(),e,i,s),hE(t.getBgRect(),e,i,s))}function uE(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 pE(t,e,i,s){t&&(uE(t.startSymbol,e,i,s),t.lines.forEach((t=>uE(t,e,i,s))),uE(t.line,e,i,s),uE(t.endSymbol,e,i,s))}function gE(t,e,i,s){t&&(uE(t.getTextShape(),e,i,s),uE(t.getBgRect(),e,i,s))}function fE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;hE(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)})),hE(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;hE(t.getTextShape(),e,l,n),hE(t.getBgRect(),e,l,n)}))}function mE(t,e,i,s,n){cE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function vE(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function _E(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function yE(t,e,i,s,n,r){var a;cE(t,n,s,r),hE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?dE(i,n,s,r):hE(i,n,s,r)}function bE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;hE(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)})),hE(e,n+o+l,h,r),hE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(hE(i.getTextShape(),n+o+l+h+c,d,r),hE(i.getBgRect(),n+o+l+c,d,r)):hE(i,n+o+l+c,d,r)}function xE(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?fE(t,e,s,r,a):"fadeIn"===i&&mE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?fE(t,e,s,n,a):"fadeIn"===i&&mE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){pE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function SE(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&&vE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&vE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function kE(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&&_E(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&_E(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function AE(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?yE(n,r,e,i,s,o):"callIn"===t&&bE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?yE(n,r,e,i,s,a):"callIn"===t&&bE(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;pE(t,n,s,r),uE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?gE(i,n,s,r):uE(i,n,s,r)}(n,r,e,t,i,s)}}const ME={type:"clipIn",duration:500,easing:"linear",delay:0},wE={type:"fadeIn",duration:500,easing:"linear",delay:0},TE={type:"callIn",duration:500,easing:"linear",delay:0},CE={type:"fadeOut",duration:500,easing:"linear",delay:0};class BE{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new zM(Object.assign(Object.assign({},h),{state:{panel:z({},sM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},sM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},sM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},sM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class PE extends lE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=CE}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;LM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(PE,BE);const EE=.001,RE={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:sE.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]}},OE={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"}}},IE={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:{autoRotate:!0,position:rE.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]}},LE={interactive:!0,label:{position:nE.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}},DE={interactive:!0,label:{autoRotate:!0,position:rE.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}},FE={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"}},zE={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"}},jE={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 HE(){VE._animate=xE}oE(),lw(),_T();class VE extends PE{markerAnimate(t){VE._animate&&this._animationConfig&&VE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(fM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return mM(Math.abs(e),Math.PI/2,EE)||mM(Math.abs(e),3*Math.PI/2,EE)?vM(i,e,t):fM(e)?OE.postiveXAxis[t]:OE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new cw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},sM,null==a?void 0:a.line),startSymbol:z({},sM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},sM,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({},sM,null==a?void 0:a.line),startSymbol:z({},sM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},sM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",VE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(VE.defaultAttributes.label)}}function NE(){WE._animate=SE}VE.defaultAttributes=RE,oE(),VA(),_T();class WE extends lE{markerAnimate(t){WE._animate&&this._animationConfig&&WE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=CE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},zE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;LM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=af.polygon(Object.assign({points:e},i));n.states=z({},sM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",WE.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},sM,null==i?void 0:i.area)),this._updateMarkLabels(WE.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}WE.defaultAttributes=LE,U(WE,BE),oE(),hw(),_T();class UE extends PE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case rE.arcInnerStart:l=n;case rE.arcOuterStart:l=n;break;case rE.arcInnerEnd:l=r;case rE.arcOuterEnd:l=r;break;case rE.center:case rE.arcInnerMiddle:case rE.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return FE[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new dw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},sM,null==o?void 0:o.line),startSymbol:z({},sM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},sM,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({},sM,null==o?void 0:o.line),startSymbol:z({},sM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},sM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",UE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(UE.defaultAttributes.label)}}UE.defaultAttributes=IE,oE(),MA(),_T();class GE extends lE{markerAnimate(t){GE._animate&&this._animationConfig&&GE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GE.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=CE}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case rE.center:h=(s+n)/2,c=(r+a)/2;break;case rE.arcInnerStart:h=s,c=r;break;case rE.arcOuterStart:h=n,c=r;break;case rE.arcInnerEnd:h=s,c=a;break;case rE.arcOuterEnd:h=n,c=a;break;case rE.arcInnerMiddle:h=s,c=(r+a)/2;break;case rE.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},FE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;LM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=af.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},sM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",GE.defaultAttributes.label)}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({},sM,null==o?void 0:o.area)),this._updateMarkLabels(GE.defaultAttributes.label)}isValidPoints(){return!0}}function YE(){XE._animate=AE}GE.defaultAttributes=DE,U(GE,BE),oE(),lw(),hw(),KA(),LA(),FA(),_T();class XE extends lE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=TE,this.defaultExitAnimation=CE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return mM(Math.abs(s),Math.PI/2,EE)||mM(Math.abs(s),3*Math.PI/2,EE)?vM(t,s,n):fM(s)?jE.postiveXAxis[n]:jE.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,style:d,position:u=aE.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},sM,null==p?void 0:p.textBackground),text:z({},sM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},sM,null==p?void 0:p.itemContent));const v=fM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=af.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"text"===n?o=new zM(Object.assign(Object.assign({},i),{state:{panel:z({},sM,null==s?void 0:s.textBackground),text:z({},sM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=af.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"image"===n?(o=af.image(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},sM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=mM(c,0,EE)||mM(d,0,EE),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=OM(e-u,t-d),o=OM(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(iR.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(iR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===iR.focus||"focus"===o){const s=a.hasState(tR.focus);a.toggleState(tR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[tR.unSelected,tR.unSelectedHover,tR.focus],t),this._setLegendItemState(e,tR.selected,t)})):(this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[tR.selected,tR.selectedHover,tR.focus],t),this._setLegendItemState(e,tR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(tR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(tR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(eR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[tR.selected,tR.selectedHover],t),this._setLegendItemState(a,tR.unSelected,t)):(this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t))}else this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[tR.selected,tR.selectedHover],t),this._setLegendItemState(e,tR.unSelected,t))}))}this._dispatchLegendEvent(eR.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,tR.selected),this._removeLegendItemState(e,[tR.unSelected,tR.unSelectedHover])):(this._removeLegendItemState(e,[tR.selected,tR.selectedHover]),this._setLegendItemState(e,tR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=ZE,spaceRow:l=JE,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=af.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+E(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";p(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";p(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:p,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),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=si(c);let T;!1===x.visible?(T=af.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,iR.item,t,T)):(T=af.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,iR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?tR.selected:tR.unSelected);const C=af.group({x:0,y:0,pickable:!1});T.add(C);let B,P=0,R=0,O=0;if(v&&!1!==v.visible){const i=E(S,"style.size",10);R=_(i)?i[0]||0:i,O=E(v,"space",8);const s=af.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,iR.itemShape,t,T,S.state),s.addState(e?tR.selected:tR.unSelected),C.add(s)}let I=0;if(p){const e=E(g,"size",10);B=af.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,iR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=EM(Object.assign(Object.assign({x:R/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:y.formatMethod?o:void 0}));this._appendDataToShape(D,iR.itemLabel,t,T,k.state),D.addState(e?tR.selected:tR.unSelected),C.add(D);const F=E(y,"space",8);if(u(l)){const s=E(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=EM(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,iR.itemValue,t,T,A.state),r.addState(e?tR.selected:tR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/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]-R-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",P),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.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 qE(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 qE(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 lM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new lM(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",bt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+E(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=ZE,spaceRow:o=JE}=n,l=this._itemsContainer,{space:h=QE,defaultCurrent:c=1}=r,d=aR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=af.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+E(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=ZE,spaceRow:a=JE}=s,o=this._itemsContainer,{space:l=QE,defaultCurrent:h=1}=n,c=aR(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 _=af.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=af.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=[];dt(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),dt(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(tR.selected)?this._setLegendItemState(t,tR.selectedHover,e):this._setLegendItemState(t,tR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===iR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(eR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(tR.unSelectedHover)||t.hasState(tR.selectedHover))&&(i=!0),t.removeState(tR.unSelectedHover),t.removeState(tR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(tR.unSelectedHover)&&!t.hasState(tR.selectedHover)||(i=!0),t.removeState(tR.unSelectedHover),t.removeState(tR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===iR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(eR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(eR.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!==iR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(eR.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!==iR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(eR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(tR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},oR,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(tR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(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 hR;function cR(t){return _(t)?t:[t,t]}function dR(t){return t?"ew-resize":"ns-resize"}lR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:ZE,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:QE,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"}(hR||(hR={})),nR();class uR extends Ky{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({},uR.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=aM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=aM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:cR(p)[0],endValue:cR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=af.group({x:0,y:0});f.name=hR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=af.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)),m.name=hR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=af.group({x:g?v:0,y:g?0:v});f.add(_);const y=af.group({x:0,y:0});let b;if(y.name=hR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=af.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=hR.endText,f.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=af.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=hR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=cR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":dR(p)},r));if(v.name=hR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=hR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":dR(p)},r));if(i.name=hR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=hR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=mt(h,i,s);c=t[0],u=t[1]}else c=i,u=ft(h,i,s);const g=this._isHorizontal;e||(c=i);const f=af.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=hR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":dR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=af.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=hR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return af.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":dR(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),af.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=af.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=af.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=aM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===hR.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===hR.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===hR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===hR.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}}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}uR.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}}},rR(),nR();class pR extends sR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function gR(t="bottom"){let 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`}pR.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"}}},rR(),nR(),jA();class fR extends sR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=af.group({x:0,y:0});this._innerView.add(x);const S=new uR({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:gR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=af.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+E(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))}}fR.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)"}},OA(),ZA(),GA();let mR=class t extends Ky{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:P,maxWidth:E,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=si(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},nM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},nM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(P)&&UE&&(U=E),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};mR.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 vR={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"}}};OA(),ZA(),GA();let _R=class extends Ky{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},E(vR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=EM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(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 p=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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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",u(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;G(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 yR extends xg{constructor(t){super(t)}}var bR,xR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(bR||(bR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(xR||(xR={}));class SR extends Ky{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SR.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"},SR.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"},SR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},SR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},SR.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=()=>{d(this._playController)&&(this._playController=new yR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new yR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new yR(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(bR.OnPlay)},this.pause=()=>{this._dispatchEvent(bR.OnPause)},this.forward=()=>{this._dispatchEvent(bR.OnForward)},this.backward=()=>{this._dispatchEvent(bR.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()}}SR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},SR.defaultAttributes={[xR.Start]:{},[xR.Pause]:{},[xR.Backward]:{},[xR.Forward]:{}};const kR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},AR=[200,10];var MR,wR;!function(t){t.Default="default",t.Reverse="reverse"}(MR||(MR={})),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"}(wR||(wR={}));const TR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===MR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===MR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),CR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===MR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===MR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),BR=t=>"top"===t||"bottom"===t;class PR extends Ky{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PR.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(BR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:AR[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:AR[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 uR(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=BR(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 SR(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=BR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:AR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(BR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:BR(this._orient)?t+s:(this._size.width-r)/2,y:BR(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:BR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:BR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:BR(this._orient)?t+s:(this._size.width-r)/2,y:BR(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 ER(){nR(),OA(),KA()}PR.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({},kR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},kR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},kR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},kR),{key:"backward",position:"start"})}},ER();class RR extends PR{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:MR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(bR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(bR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(bR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(bR.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(wR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(TR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||CR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===MR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(wR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(wR.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(wR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(wR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.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(wR.change),this.dispatchCustomEvent(wR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var OR,IR=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())}))};ER();class LR extends PR{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(bR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(bR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(bR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(bR.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(wR.change))},this.play=()=>IR(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(wR.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.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(wR.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(wR.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.brushActive="brushActive",t.brushClear="brushClear"}(OR||(OR={}));const DR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},FR=5;const zR={debounce:yt,throttle:bt};OA(),VA();let jR=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=DR.updateTrigger,endTrigger:i=DR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:zR[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=DR.trigger,resetTrigger:e=DR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(OR.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(OR.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=FR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(OR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(OR.brushActive,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._dispatchBrushEvent(OR.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=FR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=DR.updateTrigger,endTrigger:e=DR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=af.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};jR.defaultAttributes=DR;const HR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},VR=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}},NR={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:eM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:eM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:eM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new je).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},WR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];OA(),WA(),KA(),ZA(),GA();let UR=class t extends Ky{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=si(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:gM(p)&&gM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gM(p)&&gM(p.value)},VR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:gM(p)&&gM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gM(p)&&gM(p.value)},VR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},nM),p.value),visible:gM(p)&&gM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=gM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=gM(p)?p.height+p.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(!gM(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 p="right"===c?(o?d:0)+(gM(n.key)?r+n.key.spacing:0)+(gM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(RM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:gM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(gM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Qc(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(gM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},VR(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},VR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},nM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(gM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},VR(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},VR(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=>WR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&gM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=gM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=TM(d),_=TM(u);let y=0;if(gM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(gM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&su[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 HR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return HR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};UR.defaultAttributes=NR;const GR=dt;function YR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function XR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function $R(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function KR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function qR(t,e){const i=KR(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 ZR(t,e){const i=JR(t),s=JR(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 JR(t,e={x:0,y:0}){return se.distancePP(t,e)}function QR(t){return k(t.x)&&k(t.y)}function tO(t,e,i){let s=!1;if(e&&c(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 eO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const iO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function nO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&nO(t[i],e)}}var rO,aO,oO;function lO(t){var e,i;const{type:s}=t;return s===aO.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(rO||(rO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(aO||(aO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(oO||(oO={}));const hO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},cO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function dO(t,e){var i;if(!t)return[];const s=_O(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?mO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fO(i)?pO(t,i,e):i)).filter(u)}))):i.map((i=>fO(i)?pO(t,i,e):i)).filter(u):[]}return[]}function uO(t,e){var i,s;return mO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 pO(t,e,i){var s;const n=_O(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=hO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=cO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new Qe(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ue(t,i,s),a=We(n,r,e.l),l=new Qe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gO=(t,e)=>{if(e&&fO(t)){const i=pO(e,t);if(i)return i}return t};function fO(t){return t&&"palette"===t.type&&!!t.key}function mO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function vO(t){return _(t)?{dataScheme:t}:t}function _O(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=lO(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 yO extends mB{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(!mO(this._range))return void super.range(this._range);const t=uO(this._range,this._domain);super.range(t)}}const bO={linear:HB,band:yB,point:class extends yB{constructor(t){super(!1),this.type=$C.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:mB,threshold:YB,colorOrdinal:yO};function xO(t){const e=bO[t];return e?new e:null}function SO(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 kO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function AO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function MO(t){return!!v(t)&&(!!t.endsWith("%")&&Yy(t.substring(0,t.length-1)))}function wO(t){return!!p(t)&&("percent"in t||"offset"in t)}function TO(t,e,i,s=0){var n,r;return x(t)?t:MO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function CO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=TO(t[s],e.size,i)}))})),o}function BO(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}}function PO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||MO(t)||c(t)||wO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function EO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const RO=(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},OO=[{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"]}];function IO(t,e){return t&&e.key in t?t[e.key]:e.default}function LO(t){return t&&"token"===t.type&&!!t.key}const DO={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%"},FO={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:OO,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"}}},token:DO,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},zO={name:"dark",colorScheme:{default:{dataScheme:OO,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}}}}}},jO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>jO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>jO(t[i],e[i])))),HO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),HO(t[s],e.slice(1),i))},VO=t=>t instanceof Ma||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 NO(t,e=["data"]){return I(t,VO,e)}function WO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=vO(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)})}UO._charts={},UO._series={},UO._components={},UO._graphicComponents={},UO._marks={},UO._regions={},UO._animations={},UO._implements={},UO._chartPlugin={},UO._vChartPlugin={},UO._componentPlugin={},UO.transforms={fields:Ur,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}},UO.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Jr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=zr(ta,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return Zr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t))},UO._layout={},UO._grammarTransforms={},UO._stageEventPlugins={},UO.registerStageEventPlugin=(t,e)=>{UO._stageEventPlugins[t]=e},UO.getStageEventPlugin=t=>UO._stageEventPlugins[t],UO._interactionTriggers={},UO.registerInteractionTrigger=(t,e)=>{UO._interactionTriggers[t]=e},UO._composedEventMap={},UO.registerComposedEvent=(t,e)=>{UO._composedEventMap[t]=e},UO._tooltipProcessors={},UO.registerTooltipProcessor=(t,e)=>{UO._tooltipProcessors[t]=e},UO.createTooltipProcessor=(t,e)=>{const i=UO._tooltipProcessors[t];return i?new i(e):null};const XO=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},$O=XO(),KO={[FO.name]:FO},qO=FO.name,ZO=new Map(Object.keys(KO).map((t=>[t,KO[t]]))),JO=new Map,QO=new Map(Object.keys(KO).map((t=>[t,t===qO]))),tI=(t,e)=>{if(!t)return;const i=nI(e);ZO.set(t,i),QO.set(t,!0)},eI=(t=qO)=>(QO.has(t)&&!QO.get(t)&&tI(t,ZO.get(t)),ZO.get(t)),iI=t=>ZO.delete(t)&&JO.delete(t)&&QO.delete(t),sI=t=>!!v(t)&&ZO.has(t),nI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:qO;return GO({},eI(i),t)};class rI{static registerInstance(t){rI.instances.set(t.id,t)}static unregisterInstance(t){rI.instances.delete(t.id)}static getInstance(t){return rI.instances.get(t)}static instanceExist(t){return rI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return rI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}rI.instances=new Map;class aI{static registerTheme(t,e){tI(t,e)}static getTheme(t,e=!1){return eI(t)}static removeTheme(t){return iI(t)}static themeExist(t){return sI(t)}static getDefaultTheme(){return aI.themes.get(qO)}static setCurrentTheme(t){aI.themeExist(t)&&(aI._currentThemeName=t,rI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return aI.getTheme(aI._currentThemeName,t)}static getCurrentThemeName(){return aI._currentThemeName}}function oI(t){return v(t)?aI.themeExist(t)?aI.getTheme(t):{}:p(t)?t:{}}aI.themes=ZO,aI._currentThemeName=qO;const lI=["animationThreshold","colorScheme","name","padding"];function hI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];lI.includes(n)?s[n]=r:f(r)?fO(r)?s[n]=gO(r,e):LO(r)?s[n]=IO(i,r):s[n]=hI(r,e,i):s[n]=r})),s}function cI(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]=cI(t[s],e)}return i}return _(t)?t.map((t=>cI(t,e))):t}function dI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=dI(t[s],e)}return i}return _(t)?t.map((t=>dI(t,e))):t}const uI=(t,e,i,s)=>((t,e,i)=>TM(t,e,i,{fontFamily:DO.fontFamily,fontSize:DO.fontSize}))(e,i,s).measure(t),pI="__VCHART",gI=500,fI=500,mI=`${pI}_MEASURE_CANVAS_ID`,vI=`${pI}_DEFAULT_DATA_INDEX`,_I=`${pI}_DEFAULT_DATA_KEY`,yI=`${pI}_DEFAULT_DATA_SERIES_FIELD`,bI=`${pI}_DEFAULT_SERIES_STYLE_NAME`,xI=`${pI}_STACK_KEY`,SI=`${pI}_STACK_START`,kI=`${pI}_STACK_END`,AI=`${pI}_STACK_START_PERCENT`,MI=`${pI}_STACK_END_PERCENT`,wI=`${pI}_STACK_START_OffsetSilhouette`,TI=`${pI}_STACK_END_OffsetSilhouette`,CI=`${pI}_STACK_TOTAL`,BI=`${pI}_STACK_TOTAL_PERCENT`,PI=`${pI}_STACK_TOTAL_TOP`,EI=`${pI}_STACK_TOTAL_BOTTOM`,RI=`${pI}_MOSAIC_VALUE_START_PERCENT`,OI=`${pI}_MOSAIC_VALUE_END_PERCENT`,II=`${pI}_MOSAIC_CAT_START_PERCENT`,LI=`${pI}_MOSAIC_CAT_END_PERCENT`,DI=`${pI}_SEGMENT_START`,FI=`${pI}_SEGMENT_END`,zI=`${pI}_KEY`;function jI(t,e){for(let i=0;it.key===e))}function VI(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 NI(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:{}},XI(t,a,n[o],l,e,r))})),s?WI(n):n}function WI(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))):WI(t[e].nodes);return t}function UI(t,e){if("values"in t&&t.values.length){const i=$R(t.values,e),s=XR(t.values,MI);t.values.forEach((t=>{t[CI]=i,t[BI]=s}))}else for(const i in t.nodes)UI(t.nodes[i],e)}function GI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][kI]/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)YI(t.nodes[r],e,i,s,n)}function XI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[kI]=function(t){if(k(t))return t;const e=+t;return k(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},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),XI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const $I=(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]=qI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function ZI(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>tL(t.style(e,i,s,n)):P(t.style)||(e.style=tL(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>tL(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=tL(t.state[e]))})),e.state=i}return e}function JI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>tL(t[i](e,s,n,r)):P(t[i])||(e[i]=tL(t[i]))})),e}function QI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),tL(i)}function tL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ne(t.angle)}):t}const eL=t=>"line"===t||"area"===t,iL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return eL(i)?e:null==e?void 0:e[0]},sL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let nL=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},n=UO.getComposedEvent(t);if(n){const e=new n(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(UO.getComposedEvent(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()}};var rL;!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"}(rL||(rL={}));const aL=["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 oL,lL,hL;!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.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(oL||(oL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(lL||(lL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(hL||(hL={}));const cL=[hL.mark,hL.model,hL.chart,hL.vchart];class dL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(hL.vchart,[]),this._levelNodes.set(hL.chart,[]),this._levelNodes.set(hL.model,[]),this._levelNodes.set(hL.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 uL={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 pL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=E(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>iL(t)))};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)||lL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||lL.chart);o.get(t)||o.set(t,new dL);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)||lL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||lL.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)||lL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||lL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?cL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[lL.chart,lL.window,lL.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(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&E(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 uL[a]&&(a=uL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?hL.model:hL.vchart:hL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=bt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=yt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=lL.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!==hL.model&&s!==hL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=hL.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 lL.chart:return this._viewBubbles;case lL.window:return this._windowBubbles;case lL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case lL.chart:return this._viewListeners;case lL.window:return this._windowListeners;case lL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return aL.includes(t)||Object.values(rL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&UO.hasInteractionTrigger(e)}}function gL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function fL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const mL=new Map;let vL;function _L(){vL||(vL=new Aa,fL(vL,"geojson",_a),fL(vL,"topojson",ba),gL(vL,"simplify",Nr))}function yL(t,e,i={type:"geojson",centroid:!0}){mL.has(t)&&Dy(`map type of '${t}' already exists, will be overwritten.`),_L();const s=new Ma(vL),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"}):p(r)&&s.transform({type:"simplify",options:r}),mL.set(t,s)}function bL(t){mL.has(t)?mL.delete(t):Dy(`map type of '${t}' does not exists.`)}function xL(t,e=!1){let i=e;return t.latestData instanceof Ma&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const SL=(t,e)=>0===t.length?[]:1===t.length?xL(t[0],null==e?void 0:e.deep):t.map((t=>xL(t,null==e?void 0:e.deep)));function kL(t,e,i){gL(e=e instanceof Aa?e:t.dataSet,"copyDataView",SL);const s=new Ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:wL.copyDataView}),s}function AL(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?I(t.parser):{clone:!0},c=I(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 Dy(`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 Dy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Dy("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 ML(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var wL,TL,CL,BL;!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"}(wL||(wL={})),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"}(TL||(TL={})),function(t){t.data="data",t.mark="mark"}(CL||(CL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(BL||(BL={}));const PL=["line","area","trail"];function EL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(zI,i?t.slice().sort(i):t.slice()),{keys:[zI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const RL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function OL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{OL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function LL(t,e,i,s){const n=EL(t,(t=>i(t))),r=EL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 DL{getRootGroup(){return this._rootGroup}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(oL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(oL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(oL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=wp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Ny(o))&&!1!==c&&UO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=BL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>OL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>OL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{OL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Ly(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===BL.before&&(this._layoutState=BL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=BL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Ly(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=IL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=LL(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=LL(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===lL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:iL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===lL.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===lL.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===lL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===lL.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===lL.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{OL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=IL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Vy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return fu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{fo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{OL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function FL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Fy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function zL(t){t.crosshair=G(t.crosshair||{}).map((e=>WO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function jL(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ni(l,i.width,i.height);a=t,o=e}else if(h&&Vy(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=ni(t,i.width,i.height);a=e,o=s}else if(Wy(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 HL(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 VL(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}}const NL=9,WL=0,UL=-1;var GL,YL,XL,$L,KL,qL;!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"}(GL||(GL={})),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"}(YL||(YL={})),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"}(XL||(XL={}));class ZL{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ZL.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]))))}}ZL.defaultMarkInfo={};class JL{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class QL{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=>WO({},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 tD extends JL{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=QL,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ZL,this._lastLayoutRect=null,this.id=Gy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new nL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${pI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=UO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return E(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class eD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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=YL.Region,this._willLayoutTag=!0,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){let a=CO(PO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:TO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:TO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:TO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:TO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:TO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:TO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=TO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=TO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=TO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(BO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class iD extends tD{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,this._transformLayoutPadding=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 eD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 sD extends QL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class nD extends iD{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=sD,this.modelType="region",this.specKey="region",this.type=nD.type,this._series=[],this.layoutType="region",this.layoutZIndex=GL.Region,this.seriesDataFilterOver=()=>{this.event.emit(oL.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"}_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._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",GL.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",XL.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:GL.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:GL.Mark+1}))}_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",XL.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",XL.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}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",XL.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",XL.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",XL.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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))&&(!u(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function rD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 aD(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 oD(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 lD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=uD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),oD(d,!0,p,l),s&&aD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function hD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=uD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=uD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),oD(d,!1,p,o),s&&aD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function dD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=uD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=uD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&lD(n,e,i,!1,"left",s),r.length&&lD(r,e,i,!0,"left",s),a.length&&hD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&cD(n,e,i,!1,"top",s),r.length&&cD(r,e,i,!0,"top",s),a.length&&dD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&lD(n,e,i,!1,"right",s),r.length&&lD(r,e,i,!0,"right",s),a.length&&hD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&cD(n,e,i,!1,"bottom",s),r.length&&cD(r,e,i,!0,"bottom",s),a.length&&dD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=uD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=uD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Fy)("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}}}pD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($L||($L={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(KL||(KL={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(qL||(qL={}));const gD=["linear","radial","conical"],fD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const mD={};Object.values(KL).forEach((t=>{mD[t]=!0})),KL.STATE_HOVER,KL.STATE_HOVER_REVERSE,KL.STATE_SELECTED,KL.STATE_SELECTED_REVERSE,KL.STATE_DIMENSION_HOVER,KL.STATE_DIMENSION_HOVER_REVERSE;class vD extends JL{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class _D extends vD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,PL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!mD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(qC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class yD extends JL{constructor(){super(...arguments),this.id=Gy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=UO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class bD extends yD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const xD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,SD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=xD(l.delay,n,a,o),d=xD(l.duration,n,a,o),u=xD(l.oneByOne,n,a,o),p=xD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?FT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zT)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);OT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?FT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>BT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ET(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:No.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new RT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:AT,null!==(l=i.easing)&&void 0!==l?l:MT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:No.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new IT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:AT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:MT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):OT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},kD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},AD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class MD extends yD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new bD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=wp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:GL.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Dl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$L.enter&&t.context.diffState!==$L.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=t,this.model=e.model,this.key=e.key,this.state=new _D(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ne)}isUserLevel(t){return[XL.User_Mark,XL.User_Series,XL.User_Chart,XL.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&WO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ZC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=xO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):gD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):ZC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",XL.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,XL.User_Mark)}else this.setStyle(i,t,XL.User_Mark)}))}_computeGradientAttr(e){var i,s;const{gradient:n,scale:r,field:a}=e,o=t(e,["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 d=uO(dO(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()),p=Object.assign(Object.assign({},fD[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(p).forEach((s=>{const n=p[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=Qe.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||d[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)gD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=uO(dO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return EL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return UO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[_I],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=EL(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{AD(t),s.push(...t.getGraphics())})),e.forEach((t=>{AD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);SD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=kD(e,n),r=kD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===TL.exit?TL.exit:i===TL.update?TL.update:TL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$L.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===$L.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$L.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$L.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=$L.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=TL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=TL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return RL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=RL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=sL(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===KL.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=UO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=UO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===BL.before||(Ly(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$L.exit&&!e.isExiting)if(e.context.animationState===$L.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$L.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=wp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var wD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(wD||(wD={}));class TD extends MD{constructor(){super(...arguments),this.type=TD.type,this._marks=[],this._diffState=$L.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Dy("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?(Dy("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))}getMarkInUserId(t){let e;return OL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===$L.update){const t=this.hasAnimation(),e=sL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$L.update}render(){this._isCommited&&(Ly(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}TD.type="group";const CD={measureText:uI};class BD{static instance(){return BD.instance_||(BD.instance_=new BD),BD.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 PD{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))?Dy("不要重复添加相同的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 ED extends PD{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}}const RD={type:"fadeIn"};function OD(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 RD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ID={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"}},LD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},DD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},FD=()=>{UO.registerAnimation("scaleInOut",(()=>LD))},zD=()=>{UO.registerAnimation("fadeInOut",(()=>DD))},jD=(t,e)=>({appear:OD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:NT,duration:ID.update.duration,easing:ID.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),HD=()=>{UO.registerAnimation("line",jD)},VD=()=>{lT.registerBuiltInAnimate("growPointsIn",aC),lT.registerBuiltInAnimate("growPointsOut",oC),lT.registerBuiltInAnimate("growPointsXIn",hC),lT.registerBuiltInAnimate("growPointsXOut",cC),lT.registerBuiltInAnimate("growPointsYIn",uC),lT.registerBuiltInAnimate("growPointsYOut",pC),lT.registerBuiltInAnimate("clipIn",GT),lT.registerBuiltInAnimate("clipOut",YT)},ND=()=>{_T(),lT.registerBuiltInAnimate("scaleIn",xC),lT.registerBuiltInAnimate("scaleOut",SC),lT.registerBuiltInAnimate("fadeIn",XT),lT.registerBuiltInAnimate("fadeOut",$T),lT.registerBuiltInAnimate("moveIn",wC),lT.registerBuiltInAnimate("moveOut",TC),lT.registerBuiltInAnimate("rotateIn",BC),lT.registerBuiltInAnimate("rotateOut",PC),lT.registerBuiltInAnimate("update",AC),lT.registerBuiltInAnimate("state",kC),lT.registerBuiltInAnimate("fromTo",EC)},WD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};KL.STATE_HIGHLIGHT,KL.STATE_BLUR;class UD{constructor(t){this._markSet=new ZL,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 GD={highlightState:KL.STATE_HIGHLIGHT,blurState:KL.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class YD extends UD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},GD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}YD.type="element-highlight",YD.defaultOptions=GD;const XD=()=>{UO.registerInteractionTrigger(YD.type,YD)},$D={state:KL.STATE_SELECTED,trigger:"click"};class KD extends UD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},$D,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}KD.type="element-select",KD.defaultOptions=$D;const qD=()=>{UO.registerInteractionTrigger(KD.type,KD)};class ZD extends PD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class JD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>UO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>UO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>UO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return UO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>UO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){UO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&BD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&BD.instance().unregisterFunction(t)}static getFunction(t){return t?BD.instance().getFunction(t):null}static getFunctionList(){return BD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=UO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=UO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,mL.get(e);var e}static registerSVG(t,e,i){const s=UO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=UO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){rI.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=Gy(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=HL(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?UO.getSeriesBuiltInTheme(e):UO.getComponentBuiltInTheme(e);i=i?WO({},s,i[e]):s}s===t.length-1&&u(i)&&(i=hI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},nO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Vy(_);if(S?ex(Ch):"node"===_&&jS(Ch),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=aI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:st.Error);nt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new DL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new pL(this,this._compiler),this._event=new nL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),rI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=WO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=cI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;JD.getFunctionList()&&JD.getFunctionList().length&&(t=dI(t,JD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=UO.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=UO.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=UO.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._chartSpecTransformer),this._chart.init(),this._event.emit(oL.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)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(oL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=bt(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 jL(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:gI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:fI})}_initDataSet(t){this._dataSet=t instanceof Aa?t:new Aa,fL(this._dataSet,"dataview",xa),fL(this._dataSet,"array",i),gL(this._dataSet,"copyDataView",SL);for(const t in UO.transforms)gL(this._dataSet,t,UO.transforms[t]);for(const t in UO.dataParser)fL(this._dataSet,t,UO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(oL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?TL.none:TL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,rI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,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 e(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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ma?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=AL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.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,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?WO({},t[n][e.index],i):i):t[n]=s?WO({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?WO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?WO({},t[n],i):i)}))}(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=WO({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(oL.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=GO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=oI(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=GO({},oI(this._currentThemeName),oI(n),oI(r));this._currentTheme=o(a,t)}else{const t=GO({},oI(this._currentThemeName),oI(n),oI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(HM.poptip,jM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Vy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return oI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!aI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield FL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Vy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?EO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Dy("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 u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?EO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Dy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return BD.instance().getFunction(t)}registerFunction(t,e){t&&e&&BD.instance().registerFunction(t,e)}unregisterFunction(t){t&&BD.instance().unregisterFunction(t)}getFunctionList(){return BD.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(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.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=UO.getChartPlugins();t.length>0&&(this._chartPlugin=new ED(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=UO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new ZD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}JD.InstanceManager=rI,JD.ThemeManager=aI,JD.globalConfig={uniqueTooltip:!0},JD.Utils=CD,JD.vglobal=__;UO.registerRegion("region",nD),UO.registerLayout("base",pD),XA(),OA(),UO.registerMark(TD.type,TD),UO.registerStageEventPlugin("gesture",Ab),XD(),qD(),tI(zO.name,zO);const QD="monotone",tF="linear",eF="bevel";var iF;function sF(t,e){return e("component",t)}function nF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=UO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(iF||(iF={}));const rF=(t,e,i,s)=>{if(d(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},aF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},oF="2.0.5",lF=(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},hF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?E(e,t.field):t,s){const{formatFunc:i,args:r}=nF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},cF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const dF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function uF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=gF(hF(h,r,a,c),p,g),o.value=gF(hF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=hF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function pF(t,e,i,s,n,r,a){if(c(e)){uF(t,e(n,a),i,s,r,a)}else e&&uF(t,e,i,s,r,a)}const gF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=pi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class fF{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:u(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(u(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(u(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=>{pF(a,t,e,i,s,n,r)})):c(t)?pF(a,t,e,i,s,n,r):t&&uF(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=c(e)?e(s,n):e;if(r?d(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:hF(r.visible,t,n),value:gF(hF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:hF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=hF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&dF(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 mF={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}},vF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=jI([],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 _F(a,n,o)},_F=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Yy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Yy(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=mF[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},yF=(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=>{Yy(t[e])||(t[e]=0)}))})),t},bF=`${pI}_HIERARCHY_DEPTH`,xF=`${pI}_HIERARCHY_ROOT`,SF=`${pI}_HIERARCHY_ROOT_INDEX`;function kF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function AF(t,e,i){t&&(i.needDefaultSeriesField&&(t[yI]=i.defaultSeriesField),t[vI]=e,t[_I]=i.getKey(t,e,i))}function MF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function wF(t,e,i,s=0,n,r){void 0===r&&(r=e),AF(t,e,i),t[bF]=s,t[xF]=n||t[i.categoryField],t[SF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>wF(e,s,i,t[bF]+1,t[xF],r)))}const TF={label:{name:"label",type:"text"}},CF=`${pI}_rect_x`,BF=`${pI}_rect_x1`,PF=`${pI}_rect_y`,EF=`${pI}_rect_y1`,RF={data:!0},OF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},IF=[...Object.keys(ID),"normal"];function LF(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 HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=WO({},o[e],a);return HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(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;const i=["custom","customParameters"];return t=I(t,null,i),VF(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function FF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function zF(t,e){var i;return null!==(i=null==t?void 0:t[vI])&&void 0!==i?i:e.context.graphicIndex}function jF(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 HF(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function VF(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),VF(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),VF(t[s],e,i))}function NF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class WF extends QL{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=lO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=UO.getSeriesMarkMap(o)?function(t,e,i){const s=UO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=WO({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return WO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(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:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=WO({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>WO({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class UF extends tD{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){u(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:`${pI}_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=WF,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=GL.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(oL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=NF(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(oL.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 d(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),u(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)&&(gL(this._rawData.dataSet,"invalidTravel",yF),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=AL(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=kL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=kL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new bD(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=_F(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(){gL(this._dataSet,"dimensionStatistics",vF);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&&jI(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){gL(this._dataSet,"dimensionStatistics",vF);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=jI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&jI(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(gL(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:kF.bind(this),call:AF}},!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(oL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(oL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(oL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(oL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=LF({},DF(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Ny(i)||Wy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=WO(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=WO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=WD(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=WD(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:KL.STATE_HOVER_REVERSE,highlightState:KL.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:KL.STATE_SELECTED_REVERSE,state:KL.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=WD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:yI;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:bI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,bI,XL.User_SeriesStyle)}))}afterInitMark(){this.event.emit(oL.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",XL.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new fF(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)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},RF),OF),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=>OF[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ma||ML(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:yI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new yO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return dO(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:yI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,WO({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:_I}_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!==kI&&t!==MI&&t!==SI&&t!==AI||(t=this.getStackValueField()),null!==(e=VI(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=>Yy(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:yI]}}function GF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();qC(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 YF(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}}}UF.mark=TF,UF.transformerConstructor=WF;class XF extends UF{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);qC(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:`${pI}_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(kI),this.setFieldX2(SI)):(this.setFieldY(kI),this.setFieldY2(SI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(MI),this.setFieldX2(AI)):(this.setFieldY(MI),this.setFieldY2(AI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(TI),this.setFieldX2(wI)):(this.setFieldY(TI),this.setFieldY2(wI))}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),u(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(),u(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(oL.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)&&(GF("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function $F(t){return"bottom"===t||"top"===t}function KF(t){return"left"===t||"right"===t}function qF(t){return"z"===t}function ZF(t,e){return AO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function JF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function QF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?$F(t)?"linear":"band":$F(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const tz=(t,e,i)=>{var s;const n=null!==(s="band"===e?sF("axisBand",i):["linear","log","symlog"].includes(e)?sF("axisLinear",i):{})&&void 0!==s?s:{},r=$F(t)?sF("axisX",i):KF(t)?sF("axisY",i):sF("axisZ",i);return WO({},sF("axis",i),n,r)};class ez{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:Fy)("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:Fy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>JC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return $F(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class iz extends ez{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:lL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const sz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},nz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},rz=(t,e,i,s)=>{var n;const r=e.getScale(),a=JC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:az(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,oz=(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};class lz extends ez{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)=>!sz(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:lL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:lL.canvas}),callback:this.onMouseOut}),Ny(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:lL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ny(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var hz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(hz||(hz={}));const cz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class dz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(cz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{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",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.event.on(oL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:eF,curveType:tF,closePath:!0},"normal",XL.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===QD?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",XL.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",XL.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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(cz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:jF(this._spec,cz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ma(this._option.dataSet,{name:`${pI}_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()},{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(hz.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:XL.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:KL.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",XL.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",XL.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[cz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(hz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,WO({},this._spec[cz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:KL.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",XL.Series),this.event.on(oL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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",XL.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",XL.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const uz=Object.assign(Object.assign({},TF),cz),pz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>pz(t,e[i])));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]))},gz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class fz extends MD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return gz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(ZC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?pz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$L.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[_I]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class mz extends fz{constructor(){super(...arguments),this.type=mz.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)===aO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}mz.type="line";const vz=()=>{UO.registerMark(mz.type,mz),XA(),FA(),zP(),OP(),VD(),UO.registerGraphicComponent("line",Mg)};class _z extends MD{constructor(){super(...arguments),this.type=_z.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}_z.type="symbol";const yz=()=>{UO.registerMark(_z.type,_z),XA(),KA(),OP(),UO.registerGraphicComponent("symbol",Sg)};class bz extends WF{_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 xz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function Sz(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:!k(o.min),extendable_max:!k(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 kz(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 Az(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 Mz(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 wz(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 Tz=(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=>function(t,e,i,s,n){const r=ee(t,e),a=Math.max(Qt(i),Qt(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return UC(v)};class Cz{constructor(t){this.id=Gy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Bz extends Cz{constructor(){super(Bz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!qC(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(oL.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&&xz(c)&&xz(d)))return;const u=Sz(t,c),p=Sz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!Az(u,p))return}else if(0===y&&0===b){if(!Az(p,u))return}else if(_||k)if(_&&!k){if(!kz(u,p))return}else if(k&&!_){if(!kz(p,u))return}else{if(f===b)return;if(f>b){if(!Mz(u,p))return}else if(!Mz(p,u))return}else{if(0===f&&0===y){if(!wz(u,p))return}else if(0===b&&0===g&&!wz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){gL(e.getOption().dataSet,"tickAlign",Tz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Bz.pluginType="component",Bz.type="AxisSyncPlugin";const Pz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Ez(t){let e=0;return E(t,"tick.visible")&&(e+=E(t,"tick.tickSize")),E(t,"label.visible")&&(e+=E(t,"label.space")),e}function Rz(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 Oz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Iz=t=>"band"===t||"ordinal"===t||"point"===t;function Lz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Dz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Fz extends PD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const zz=`${pI}_ARC_TRANSFORM_VALUE`,jz=`${pI}_ARC_RATIO`,Hz=`${pI}_ARC_START_ANGLE`,Vz=`${pI}_ARC_END_ANGLE`,Nz=`${pI}_ARC_K`,Wz=`${pI}_ARC_MIDDLE_ANGLE`,Uz=`${pI}_ARC_QUADRANT`,Gz=`${pI}_ARC_RADIAN`,Yz=-Math.PI/2,Xz=3*Math.PI/2,$z=.6,Kz=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(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 de(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},qz=(t,e,i)=>{var s;const n=null!==(s="band"===e?sF("axisBand",i):"linear"===e?sF("axisLinear",i):{})&&void 0!==s?s:{},r=sF("angle"===t?"axisAngle":"axisRadius",i);return WO({},sF("axis",i),n,r)};function Zz(t,e,i,s){switch(t){case n.cartesianBandAxis:return tz(ZF(i,["z"]),"band",e);case n.cartesianLinearAxis:return tz(ZF(i,["z"]),"linear",e);case n.cartesianLogAxis:return tz(ZF(i,["z"]),"log",e);case n.cartesianSymlogAxis:return tz(ZF(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return tz(ZF(i),void 0,e);case n.polarBandAxis:return qz(i.orient,"band",e);case n.polarLinearAxis:return qz(i.orient,"linear",e);case n.polarAxis:return qz(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=sF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>$F(t.orient)));let g;g=u(p)?WO({},Iz(p.type)?a:o,l):l;const f=r.find((t=>KF(t.orient)));let m;return m=u(f)?WO({},JC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=sF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?WO({},Iz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?WO({},JC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Jz(i,sF(t,e));default:return sF(t,e)}}const Jz=(t,e)=>{var i;const s=WO({},e,e[JF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Qz extends QL{getTheme(t,e){return Zz(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({},PO(e)),{[s]:0}))}}class tj extends iD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Qz,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:lL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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}}getDatum(t){}}var ej,ij;tj.transformerConstructor=Qz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(ej||(ej={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ij||(ij={}));class sj extends MD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=UO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(rL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}sj.type="component";const nj=()=>{UO.registerMark(sj.type,sj)},rj=t=>t;class aj extends tj{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?ej.circleAxis:ej.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),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()?ij.circleAxisGrid:ij.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),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:GL.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==E(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=LF(null===(l=UO.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:E(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:E(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:E(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:E(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:E(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:E(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:E(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:E(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:E(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:E(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()),e=new bD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return tO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?qC(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===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.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 tO(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(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(oL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=eO(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()})),tO(this._regions,(t=>{t.event.on(oL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(oL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(tO(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 e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=ZI(s=e.domainLine)).startSymbol=ZI(s.startSymbol),s.endSymbol=ZI(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return tL(WO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:tL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>tL(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=tL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return tL(WO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:tL(e.tick.style)),e.tick.state&&(i.tick.state=JI(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return tL(WO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:tL(e.subTick.style)),e.subTick.state&&(i.subTick.state=JI(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Pz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ne(p):null,textStyle:WO({},u,tL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:tL(h.style)}),h.state&&(i.title.state.shape=JI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:tL(o.style)}),o.state&&(i.title.state.background=JI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=JI(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=tL(e.background.style)),e.background.state&&(i.panel.state=JI(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:c(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 tL(WO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:tL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:tL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=nF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){fL(this._option.dataSet,"scale",rj);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)}getDatum(t){var e;return t&&t.name===uw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}aj.specKey="axes";const oj=()=>{nj(),UO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},lj=[Bz];class hj extends aj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=GL.Axis,this.layoutLevel=YL.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),tO(this._regions,(t=>{const e=this.getOrient();$F(e)?Dz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):KF(e)?Dz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):qF(e)&&Dz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=WO({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(WO({x:e.x,y:e.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=$F(this.getOrient()),n=t=>{var e;return(s?!$F(t.getOrient()):$F(t.getOrient()))&&qC(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(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=ZF(e,["z"]),qF(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(!Oz(e))return null;const{axisType:t,componentName:s}=QF(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=>KF(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(!Oz(t))return;const{axisType:s,componentName:n}=QF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=UO.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return $F(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):qF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(lj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){$F(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!$F(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!qF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;KF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=TO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=TO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=$F(this.getOrient())?t.fieldX:qF(this.getOrient())?t.fieldZ:t.fieldY,qC(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:qC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(rL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&($F(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=$F(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)}))}collectScale(){const t=[];return tO(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]:$F(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:qF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();tO(this._regions,(e=>{$F(t)?Dz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):KF(t)?Dz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):qF(t)&&Dz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(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=$F(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=$F(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=WO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new ze).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=$F(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-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Lz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:qC(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(oL.layoutEnd,this._updateAxisLayout),this.event.on(oL.layoutEnd,this._fixAxisOnZero),this.event.on(oL.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}}}}hj.type=n.cartesianAxis,hj.specKey="axes";const cj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function dj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,pj=(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 gj(t,e,i="count"){const s=pj(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const fj=Math.sqrt(50),mj=Math.sqrt(10),vj=Math.sqrt(2);class _j{constructor(){this._extend={},this.niceLabelFormatter=null}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Rz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=$F(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=k(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(uj),e.sort(uj),{domain:dj(t,e),scope:gj(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Rz(this._spec);if(u(e)||u(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>=fj?10:n>=mj?5:n>=vj?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(oL.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(oL.scaleDomainUpdate,{model:this}),this.event.emit(oL.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=>k(+t)?Math.round(+t*s)/s:t}}const yj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},bj={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}}},xj={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}}},Sj={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}}};class kj extends hj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new HB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(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(!qF(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=$F(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=MO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 gL(this._option.dataSet,t,KB),t}}kj.type=n.cartesianLinearAxis,kj.specKey="axes",kj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},U(kj,_j);const Aj=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),oj(),UO.registerComponent(kj.type,kj)};class Mj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new bD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(oL.scaleDomainUpdate,{model:this}),this.event.emit(oL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Lz(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=>Lz(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 wj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Tj extends hj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new yB}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 gL(this._option.dataSet,t,tP),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=cB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),oj(),UO.registerComponent(Tj.type,Tj,!1)};class Bj extends kj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),tO(this._regions,(t=>{$F(this.getOrient())?Dz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Dz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=WO({},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 bD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=pi.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=>Lz(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=>Lz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Bj.type=n.cartesianTimeAxis,Bj.specKey="axes",Bj.builtInTheme={axis:Sj,axisX:bj,axisY:xj};const Pj=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),oj(),UO.registerComponent(Bj.type,Bj)};class Ej extends kj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new UB}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 gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Ej.type=n.cartesianLogAxis,Ej.specKey="axes",Ej.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},U(Ej,_j);const Rj=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),oj(),UO.registerComponent(Ej.type,Ej)};class Oj extends kj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new GB}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 gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Oj.type=n.cartesianSymlogAxis,Oj.specKey="axes",Oj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},U(Oj,_j);const Ij=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),oj(),UO.registerComponent(Oj.type,Oj)},Lj=`${pI}_hide_`;function Dj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Fj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Lj]&&(Dj(t,!0),t[Lj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Lj]=!0,Dj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},zj=()=>{UO.registerGrammarTransform("symbolOverlap",{transform:Fj,runType:"afterEncode"})},jj={min:$,max:X,average:KR,sum:$R};function Hj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Vj(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 Nj(t,e,i,s){return Vj(t,e,i,"min",s)}function Wj(t,e,i,s){return Vj(t,e,i,"max",s)}function Uj(t,e,i,s){return Vj(t,e,i,"average",s)}function Gj(t,e,i,s){return Vj(t,e,i,"sum",s)}const Yj=(t,e)=>{let i=c(t.size)?t.size():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=Hj;if("min"===n?l=Nj:"max"===n?l=Wj:"average"===n?l=Uj:"sum"===n&&(l=Gj),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[]},Xj=()=>{UO.registerGrammarTransform("dataSampling",{transform:Yj})};class $j extends XF{constructor(){super(...arguments),this.type=aO.line,this.transformerConstructor=bz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(LF(null===(i=UO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}$j.type=aO.line,$j.mark=uz,$j.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},$j.transformerConstructor=bz,U($j,dz);class Kj{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)=>{ML(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];Dy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Dy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class qj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{jI(e,[{key:t,operations:qC(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&&jI(e,[{key:i.field,operations:qC(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?xO("colorOrdinal"):xO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(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(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:N(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=qC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=qC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;qC(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(qC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=qC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));qC(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class Zj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Jj extends JL{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Gy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gI,height:fI},this._viewRect={width:gI,height:fI},this._viewBox={x1:0,y1:0,x2:gI,y2:fI},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=>u(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=PO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new nL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Kj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Zj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=UO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=UO.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:GL.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=UO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(oL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(oL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(oL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof tD)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 MD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof MD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&ML(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=jL(this._spec,this._option,{width:gI,height:fI})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=dO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new qj(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){HL(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=dO(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(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{HL(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,HL(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):HL(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()];HL(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=CO(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(oL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(KL.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(KL.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(KL.STATE_SELECTED)}clearHovered(){this.clearState(KL.STATE_HOVER)}_initEvent(){[oL.dataZoomChange,oL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(rL.AFTER_MARK_RENDER_END,e)};this._event.on(rL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:iL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(eL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===hz.dimensionHover||s===hz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>JC(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.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(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Qj=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class tH{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):HO(t,a,c.spec),HO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Qj(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=Qj(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(UO.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(UO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=UO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=UO.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=UO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):rF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=rF(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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class eH extends tH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),E(i,"trimPadding")&&WO(i,VL(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 iH extends eH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),zL(t)}}const sH=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=NI(t,!0);for(const e in o)for(const i in o[e].nodes)YI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)GI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&UI(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(oL.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 rH{_beforeInit(){this._dataSet&&gL(this._dataSet,"stackSplit",sH)}_initStack(){this._stack=new nH(this),this._stack.init()}}const aH={state:KL.STATE_DIMENSION_HOVER,reverseState:KL.STATE_DIMENSION_HOVER_REVERSE,trigger:hz.dimensionHover};class oH extends UD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},aH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=iL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}oH.type="dimension-hover",oH.defaultOptions=aH;const lH=()=>{UO.registerInteractionTrigger(oH.type,oH)},hH=()=>{UO.registerComposedEvent(hz.dimensionHover,lz),UO.registerComposedEvent(hz.dimensionClick,iz)},cH=t=>t.fieldX[0],dH=t=>t.fieldY[0],uH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},pH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},gH=(t,e)=>t?e?cH:uH:e?dH:pH,fH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=oz(t,(t=>$F(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=oz(t,(t=>KF(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=>{JC(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=mH(t,i,gH(e,JC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=mH(t,i,gH(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},mH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:vH(t,s,i)},vH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=rz(e,t,"cartesian",null!=i?i:$F(t.getOrient())?cH:dH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},_H=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(JC(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(qC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Ez(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};bH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&yH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),yH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=nF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},bH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},xH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=SH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},SH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},kH=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return _H(c,r,e),c.xField.cacheInfo?xH(c.xField):c.yField.cacheInfo?xH(c.yField):void 0},AH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],MH=(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])&&AH.forEach((e=>{u(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(wH(s).every((t=>{var e;return!dF("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},wH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},TH={dom:`${pI}_TOOLTIP_HANDLER_DOM`,canvas:`${pI}_TOOLTIP_HANDLER_CANVAS`},CH={key:"其他",value:"..."};var BH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(BH||(BH={}));class PH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(oL.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:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=MH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[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({},CH),t):CH;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!d(e)&&dF(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 EH extends PH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!JC(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const RH=()=>{UO.registerTooltipProcessor("dimension",EH)};class OH extends PH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(iL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const IH=()=>{UO.registerTooltipProcessor("mark",OH)};class LH extends PH{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 DH=()=>{UO.registerTooltipProcessor("group",LH)};class FH extends Jj{constructor(){super(...arguments),this.transformerConstructor=iH,this.type="line",this.seriesType=aO.line}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}FH.type="line",FH.seriesType=aO.line,FH.transformerConstructor=iH,U(FH,rH);const zH=[...gz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class jH extends fz{constructor(){super(...arguments),this.type=jH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return zH}_getIgnoreAttributes(){return[]}}jH.type="area";const HH=()=>{UO.registerMark(jH.type,jH),XA(),TA(),zP(),OP(),VD(),UO.registerGraphicComponent("area",qg)};class VH extends fF{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")),u(e))return e}return i}}}const NH=Object.assign(Object.assign(Object.assign({},TF),cz),{area:{name:"area",type:"area"}}),WH=()=>{UO.registerAnimation("area",jD),HD(),FD()};class UH extends bz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=WO({},f.style,g.style),l.state=WO({},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 GH extends XF{constructor(){super(...arguments),this.type=aO.area,this.transformerConstructor=UH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(GH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===QD?"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 SO(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",XL.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return SO(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",XL.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[kI]},"normal",XL.Series),this.setMarkStyle(o,{curveType:a},"normal",XL.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(LF(null===(e=UO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(LF(null===(i=UO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("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 VH(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(){super.onLayoutEnd(),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}}}GH.type=aO.area,GH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},GH.mark=NH,GH.transformerConstructor=UH,U(GH,dz);class YH extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),zL(t)}}class XH extends Jj{constructor(){super(...arguments),this.transformerConstructor=YH,this.type="area",this.seriesType=aO.area}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}XH.type="area",XH.seriesType=aO.area,XH.transformerConstructor=YH,U(XH,rH);function $H(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 KH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:$H(t,e)}),qH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:$H(t,e)}),ZH={type:"fadeIn"},JH={type:"growCenterIn"};function QH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZH;case"scaleIn":return JH;default:return KH(t)}}class tV extends MD{constructor(){super(...arguments),this.type=tV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}tV.type="rect";const eV=()=>{XA(),WA(),PP("rect",LP),UO.registerMark(tV.type,tV),lT.registerBuiltInAnimate("growHeightIn",iC),lT.registerBuiltInAnimate("growHeightOut",sC),lT.registerBuiltInAnimate("growWidthIn",yC),lT.registerBuiltInAnimate("growWidthOut",bC),lT.registerBuiltInAnimate("growCenterIn",QT),lT.registerBuiltInAnimate("growCenterOut",tC),UO.registerGraphicComponent("rect",Bg)},iV=Object.assign(Object.assign({},TF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function sV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=RO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):SO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[BF]):SO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=SO(this._dataToPosX(t),e,i),n=SO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):SO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[EF]):SO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=SO(this._dataToPosY(t),e,i),n=SO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},aV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:jF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(aV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",XL.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===n.cartesianBandAxis));let r;if(gL(this._option.dataSet,"addVChartProperty",lF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};gL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:kF.bind(this),call:AF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new bD(this._option,r)}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=EF,s=PF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=BF,s=CF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=NI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)sV(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=SO(this[r](t),l,i),u=SO(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",XL.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",XL.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[SI],n=t[kI],r=t[AI],h=t[MI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[SI]:i,[kI]:s}),a?{[AI]:o,[MI]:l}:void 0),d="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(Bg(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,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=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>SO(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",XL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",XL.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>SO(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",XL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",XL.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=d(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",XL.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",XL.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YF(this);this._barMark.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=RO(this._spec.barWidth,a)),l&&(c=Math.max(c,RO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,RO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(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=RO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=qC(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}aV.type=aO.bar,aV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},aV.mark=iV,aV.transformerConstructor=rV;const oV=()=>{Xj(),eV(),UO.registerAnimation("bar",((t,e)=>({appear:QH(t,e),enter:KH(t,!1),exit:qH(t,!1),disappear:qH(t)}))),Cj(),Aj(),UO.registerSeries(aV.type,aV)};class lV extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),zL(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=p(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 hV extends Jj{constructor(){super(...arguments),this.transformerConstructor=lV,this.type="bar",this.seriesType=aO.bar}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}hV.type="bar",hV.seriesType=aO.bar,hV.transformerConstructor=lV,U(hV,rH);const cV=[10,20],dV=$C.Linear,uV="circle",pV=$C.Ordinal,gV=["circle","square","triangle","diamond","star"],fV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},mV=Object.assign(Object.assign({},TF),{point:{name:"point",type:"symbol"}});class vV extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class _V extends XF{constructor(){super(...arguments),this.type=aO.scatter,this.transformerConstructor=vV,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(c(e))return e;if(_(e)){if(d(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=`${pI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:dV,defaultRange:cV},"size")}getShapeAttribute(t,e){return d(e)?uV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:pV,defaultRange:gV},"shape")}initMark(){this._symbolMark=this._createMark(_V.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,_V.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=YF(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(LF(null===(i=UO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),DF("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:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:uV},KL.STATE_NORMAL,XL.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},KL.STATE_NORMAL,XL.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},KL.STATE_NORMAL,XL.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",XL.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",XL.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},KL.STATE_NORMAL,XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},KL.STATE_NORMAL,XL.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}_V.type=aO.scatter,_V.mark=mV,_V.builtInTheme={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"}}}}},_V.transformerConstructor=vV;const yV=()=>{yz(),UO.registerAnimation("scatter",((t,e)=>Object.assign({appear:fV(0,e)},LD))),Cj(),Aj(),UO.registerSeries(_V.type,_V)};class bV extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class xV extends Jj{constructor(){super(...arguments),this.transformerConstructor=bV,this.type="scatter",this.seriesType=aO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}xV.type="scatter",xV.seriesType=aO.scatter,xV.transformerConstructor=bV,U(xV,rH);const SV=()=>{RH(),IH(),hH(),lH(),yV(),UO.registerChart(xV.type,xV)};class kV extends UF{constructor(){super(...arguments),this.type=aO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${pI}_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 AV=`${pI}_MAP_LOOK_UP_KEY`,MV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[vI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[AV]=e.nameMap[n]:t[AV]=n})),t.features);class wV extends fF{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 TV extends MD{constructor(){super(...arguments),this.type=TV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}TV.type="path";const CV=()=>{UO.registerMark(TV.type,TV),XA(),jA(),UO.registerGraphicComponent("path",Xg)},BV=Object.assign(Object.assign({},TF),{area:{name:"area",type:"path"}});class PV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ta[i]?(wa[i]||(wa[i]=Ba(i,Ta[i])),wa[i]):null}(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 EV{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(){}}class RV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 OV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:EV}:Ny(t)||Wy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:RV}:null}const IV={debounce:yt,throttle:bt};class LV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Ny(this._renderMode)||Wy(this._renderMode),OV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return OV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!xe({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:hL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:hL.chart,consume:!1}];l.on(...c,IV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,IV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||OV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||OV(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 d(r)&&d(a)?s:xe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:hL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:hL.chart,consume:!1}];l.on(...c,IV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,IV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){OV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||OV(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:hL.chart},(t=>{if(!t.event)return;const{event:n}=t;xe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:hL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||OV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:hL.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||OV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:hL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:hL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:hL.chart,source:lL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:hL.chart,source:lL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=IV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=IV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:hL.chart})}));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:hL.chart,source:lL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:hL.chart,source:lL.chart},this._handleDragMouseUp)}))}}function DV(t,e){return`${pI}_${e}_${t}`}class FV extends tj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=GL.Mark,this._projectionSpec={name:DV(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(d(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:n.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=WO(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(){var t,e,i;this.event.on(oL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 PV(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===aO.map||e.type===aO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),tO(this._regions,(t=>{var e;if(t.type===aO.map||t.type===aO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ve})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==aO.map&&e.type!==aO.pictogram||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[AV],s=t.getDatumCenter(e);i&&u(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=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}FV.type=n.geoCoordinate,U(FV,LV);const zV=()=>{UO.registerComponent(FV.type,FV)};class jV extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class HV extends kV{constructor(){super(...arguments),this.type=aO.map,this.transformerConstructor=jV,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 !`),mL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),gL(this._dataSet,"copyDataView",SL),gL(this._dataSet,"map",MV),gL(this._dataSet,"lookup",aF);const i=mL.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:wL.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:AV,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 bD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(HV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:jF(this._spec,HV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:yI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:yI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",XL.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",XL.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(LF(null===(t=UO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),DF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new wV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[vI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[vI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ve}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ve}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 vI}getActiveMarks(){return[this._pathMark]}}HV.type=aO.map,HV.mark=BV,HV.builtInTheme={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"}}}}},HV.transformerConstructor=jV;const VV=`${pI}_waterfall_default_seriesField`,NV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[PI]=!0:delete t[PI]})),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=WV([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 f=g[0];let{start:m,end:v}=UV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=te(_,e)):(t[c]=+y,y=te(y,e)),t[d]=te(t[c],e),m=te(m,e),b=ee(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=te(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=WV(a,t,n,r,h,l,i,e),r.push(n)})),r};function WV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=UV(t,i,s,n,u);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=te(i.positive,e)):(t[h]=+i.negative,i.negative=te(i.negative,e)),t[c]=te(t[h],e),i.end=te(i.end,e)}i.isTotal=e,(d(p)||p===VV)&&(t[VV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function UV(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&&!d(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?Dy("total.collectCountField error"):n=e[a].start;o<0?Dy("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&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=te(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 GV=(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)=>te(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},YV={type:"fadeIn"},XV={type:"growCenterIn"};function $V(t,e){switch(e){case"fadeIn":return YV;case"scaleIn":return XV;default:return KH(t,!1)}}class KV extends MD{constructor(){super(...arguments),this.type=KV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Mg(t)}}KV.type="rule";const qV=()=>{UO.registerMark(KV.type,KV),XA(),FA(),UO.registerGraphicComponent("line",Mg)},ZV=Object.assign(Object.assign({},iV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),JV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:QV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function QV(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)=>QV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class tN{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 Aa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),gL(e,"dimensionTree",JV),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 eN extends rV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const iN={rect:lN,symbol:aN,arc:cN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=aN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:dN,line:uN,area:uN,rect3d:lN,arc3d:cN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function sN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=iN[t])&&void 0!==i?i:iN.point;return e.series.type===aO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=rN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(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&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:pN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function nN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==aO.sankey){const{formatFunc:t,args:n}=nF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function rN(t){return c(t)?e=>t(e.data):t}function aN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=rN(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:oN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function oN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function lN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=rN(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:hN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function hN(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 cN(t){var e;const{labelSpec:i}=t,s=null!==(e=rN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function dN(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=nN(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),yg(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 uN(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}))):[{index:0,[yI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function pN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class gN extends aV{constructor(){super(...arguments),this.type=aO.waterfall,this.transformerConstructor=eN,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 tN(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]],d(this._seriesField)&&(this._seriesField=VV)}getSeriesKeys(){return this._seriesField===VV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),gL(this._dataSet,"waterfallFillTotal",GV),gL(this._dataSet,"waterfall",NV),(d(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=kL(this.getViewData(),this._dataSet,{name:`${pI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new bD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:SI,endAs:kI,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=YF(this);this._barMark.setAnimationConfig(LF(null===(i=UO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),DF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("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(){super.initMark();const t=this._createMark(gN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ee(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:ee(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return dN(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?SO(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):SO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",XL.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",XL.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}gN.type=aO.waterfall,gN.mark=ZV,gN.builtInTheme={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}}}},gN.transformerConstructor=eN;const fN=()=>{qV(),eV(),UO.registerAnimation("waterfall",((t,e)=>({appear:$V(t,e),enter:KH(t,!1),exit:qH(t,!1),disappear:qH(t,!1)}))),zD(),Cj(),Aj(),UO.registerSeries(gN.type,gN)},mN=`${pI}_BOX_PLOT_OUTLIER_VALUE`;var vN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(vN||(vN={}));const _N=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[mN]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class yN extends fF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===vN.OUTLIER)return this.series.getOutliersField();if(t===vN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case vN.MIN:return this.series.getMinField();case vN.MAX:return this.series.getMaxField();case vN.MEDIAN:return this.series.getMedianField();case vN.Q1:return this.series.getQ1Field();case vN.Q3:return this.series.getQ3Field();case vN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===vN.OUTLIER)return e[mN];if(t===vN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case vN.MIN:return e[this.series.getMinField()];case vN.MAX:return e[this.series.getMaxField()];case vN.MEDIAN:return e[this.series.getMedianField()];case vN.Q1:return e[this.series.getQ1Field()];case vN.Q3:return e[this.series.getQ3Field()];case vN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[mN])}getDefaultContentList(t){return[{key:this.getContentKey(vN.OUTLIER),value:this.getContentValue(vN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(vN.MAX),value:this.getContentValue(vN.MAX)},{key:this.getContentKey(vN.Q3),value:this.getContentValue(vN.Q3)},{key:this.getContentKey(vN.MEDIAN),value:this.getContentValue(vN.MEDIAN)},{key:this.getContentKey(vN.Q1),value:this.getContentValue(vN.Q1)},{key:this.getContentKey(vN.MIN),value:this.getContentValue(vN.MIN)},{key:this.getContentKey(vN.SERIES_FIELD),value:this.getContentValue(vN.SERIES_FIELD)}]}}class bN extends MD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$L.enter&&t.context.diffState!==$L.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Eg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=UO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const xN=()=>{UO.registerGraphicComponent("glyph",Eg),XA(),EA()},SN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],kN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class AN extends bN{constructor(){super(...arguments),this.type=AN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=SN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=kN,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}AN.type="boxPlot";const MN=Object.assign(Object.assign({},TF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),wN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},TN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},CN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),BN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,P;if("horizontal"===e){w=null===(r=null===(n=(null===(s=CN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=CN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=CN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=CN(t,"box").attribute.width,i=CN(t,"box").attribute.x;B=i,P=i+e}else{w=null===(m=null===(f=(null===(g=CN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=CN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=CN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=CN(t,"box").attribute.height,i=CN(t,"box").attribute.y;B=i,P=i+e}return k(w)?w:k(B)&&k(P)?(B+P)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},PN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=CN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=CN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=CN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=CN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=CN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=CN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=CN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=CN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=CN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=CN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class EN extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return wN(BN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class RN extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return TN(BN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class ON extends EN{computeAttribute(){return wN(PN)(this.target,this.params,this.params.options)}}class IN extends RN{computeAttribute(){return TN(PN)(this.target,this.params,this.params.options)}}class LN extends XF{constructor(){super(...arguments),this.type=aO.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(){this._boxPlotMark=this._createMark(LN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(LN.mark.outlier,{key:vI,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={lineWidth:this._lineWidth,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"};r.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const 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,KL.STATE_NORMAL,XL.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:x(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},KL.STATE_NORMAL,XL.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=>SO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>SO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>SO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>SO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>SO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},KL.STATE_NORMAL,XL.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=>SO(t(this.getDatumPositionValues(e,mN),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>SO(t(this.getDatumPositionValues(e,mN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,KL.STATE_NORMAL,XL.Series)}}initData(){if(super.initData(),!this._data)return;gL(this._dataSet,"foldOutlierData",_N),gL(this._dataSet,"addVChartProperty",lF);const t=new Ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pI}_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:kF.bind(this),call:AF}},!1),this._outlierDataView=new bD(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(){super.onLayoutEnd(),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=YF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=UO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(DF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(LF(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(LF(null===(a=UO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new yN(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]}}LN.type=aO.boxPlot,LN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},LN.mark=MN;const DN=()=>{xN(),FA(),WA(),UO.registerGraphicComponent("line",(t=>Mg(t))),UO.registerGraphicComponent("rect",(t=>Bg(t))),UO.registerMark(AN.type,AN),yz(),FD(),Cj(),Aj(),lT.registerBuiltInAnimate("boxplotScaleIn",EN),lT.registerBuiltInAnimate("boxplotScaleOut",RN),lT.registerBuiltInAnimate("barBoxplotScaleIn",ON),lT.registerBuiltInAnimate("barBoxplotScaleOut",IN),UO.registerSeries(LN.type,LN)};class FN extends MD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=FN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Ug(t):yg(t)}}FN.type="text";const zN=()=>{UO.registerMark(FN.type,FN),XA(),ZA(),GA(),UO.registerGraphicComponent("text",yg),UO.registerGraphicComponent("richtext",Ug)};class jN extends fF{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 HN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),VN={type:"fadeIn"},NN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function WN(t,e){return"fadeIn"===e?VN:HN(t)}const UN=Object.assign(Object.assign({},iV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class GN extends rV{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 YN extends aV{constructor(){super(...arguments),this.type=aO.rangeColumn,this._barMarkType="rect",this._barName=aO.bar,this.transformerConstructor=GN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(YN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,YN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(YN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(YN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(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",XL.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=YF(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(LF(null===(i=UO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),DF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(LF(null===(n=UO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),DF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new jN(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)}}YN.type=aO.rangeColumn,YN.mark=UN,YN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},YN.transformerConstructor=GN;const XN=()=>{eV(),zN(),UO.registerAnimation("rangeColumn",((t,e)=>({appear:WN(t,e),enter:HN(t),exit:NN(t),disappear:NN(t)}))),zD(),Cj(),Aj(),UO.registerSeries(YN.type,YN)};var $N,KN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}($N||($N={})),function(t){t.middle="middle",t.start="start",t.end="end"}(KN||(KN={}));class qN extends fF{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 ZN=Object.assign({},NH);class JN extends GH{constructor(){super(...arguments),this.type=aO.rangeArea}initMark(){this._areaMark=this._createMark(JN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{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",XL.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",XL.Series),this.setMarkStyle(t,{stroke:!1},"normal",XL.Series))}initTooltip(){this._tooltipHelper=new qN(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))}}JN.type=aO.rangeArea,JN.mark=ZN;class QN extends UF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=$z,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(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(d(t)||d(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:[]};qC(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:[]};qC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(oL.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)&&GF(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 tW(t){return Yy(t)?Number.parseFloat(t):0}const eW=(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&&iW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ue(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(m.forEach(((t,e)=>{const i=t[zz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[zz]*t;v(e,k,i),k+=i}))}if(0!==_&&(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},iW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===tW(t[e])))||!i&&0===t.reduce(((t,i)=>t+tW(i[e])),0)));function sW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const nW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:sW(t,!0,TL.appear)}),rW={type:"fadeIn"},aW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:sW(t,!0,TL.enter)}),oW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:sW(t,!0,TL.exit)}),lW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:sW(t,!0,TL.exit)});function hW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rW;case"growRadius":return nW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return nW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class cW extends MD{constructor(t,e){super(t,e),this.type=dW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>oe({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Wz])[t]+s,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 dW extends cW{constructor(){super(...arguments),this.type=dW.type}}dW.type="arc";const uW=()=>{XA(),MA(),PP("arc",VP),lT.registerBuiltInAnimate("growRadiusIn",mC),lT.registerBuiltInAnimate("growRadiusOut",vC),lT.registerBuiltInAnimate("growAngleIn",ZT),lT.registerBuiltInAnimate("growAngleOut",JT),UO.registerGraphicComponent("arc",Qg),UO.registerMark(dW.type,dW)},pW=Object.assign(Object.assign({},TF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class gW extends WF{_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=WO({},this._theme,i,t);const n=(t,e)=>WO({},"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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const fW=`${pI}_LABEL_VISIBLE`;class mW extends QN{constructor(){super(...arguments),this.transformerConstructor=gW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:TO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:TO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Yz,this._endAngle=Xz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Wz];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return oe(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=u(t),r=u(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}}(u(this._spec.startAngle)?ne(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ne(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ne(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;gL(this._dataSet,"pie",eW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ne(this._spec.minAngle):0,asStartAngle:Hz,asEndAngle:Vz,asRatio:jz,asMiddleAngle:Wz,asRadian:Gz,asQuadrant:Uz,asK:Nz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ma(this._dataSet,{name:`${pI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new bD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},mW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:_I,groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return sO(Hz)(t)}endAngleScale(t){return sO(Vz)(t)}_computeLayoutRadius(){return Kz((()=>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:kO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:kO(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",XL.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",XL.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,XL.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",XL.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:sO(fW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(oL.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*(d(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[Wz];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return oe(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===TL.appear)return this._startAngle;if(i===TL.disappear)return this._endAngle;const r=[TL.disappear,TL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[vI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Wz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Wz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Wz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Wz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=LF(null===(i=UO.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]}}mW.transformerConstructor=gW,mW.mark=pW,mW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class vW extends mW{constructor(){super(...arguments),this.type=aO.pie}}vW.type=aO.pie;const _W=()=>{uW(),UO.registerAnimation("pie",((t,e)=>({appear:hW(t,e),enter:aW(t),exit:oW(t),disappear:lW(t)}))),UO.registerAnimation("emptyCircle",((t,e)=>({appear:hW(t,e)}))),UO.registerSeries(vW.type,vW)};function yW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const bW=t=>({type:yW(t.growField),options:{overall:!0}}),xW={type:"fadeIn"},SW=t=>({type:yW(t.growField)}),kW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},AW=kW;function MW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xW;case"growAngle":return bW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return bW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class wW extends QN{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(kI),this.setInnerRadiusField(SI)}setValueFieldToPercent(){this.setRadiusField(MI),this.setInnerRadiusField(AI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const TW=Object.assign(Object.assign({},TF),{rose:{name:"rose",type:"arc"}});class CW extends WF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class BW extends aj{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=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,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:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,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(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=UO.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=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=GL.Axis,this._tick=void 0,this._center=null,this._startAngle=Yz,this._endAngle=Xz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),tO(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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:TO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:TO(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=ne(this._spec.startAngle),this._endAngle=ne(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Ez(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(){tO(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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 qC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:qC(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 oe(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return le(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=>Lz(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",scale:this._scale});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=se.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",scale:this._scale.clone()});(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(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Kz((()=>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=$z,e=0;const i=this.getChart().getSpec();return tO(this.getRegions(),(s=>{const n=s;if(r=n.type,[aO.rose,aO.radar,aO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(WO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(WO({},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)}}BW.type=n.polarAxis,BW.specKey="axes";const PW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},EW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class RW extends BW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new HB}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 gL(this._option.dataSet,t,KB),t}}RW.type=n.polarLinearAxis,RW.specKey="axes",RW.builtInTheme={axis:Sj,axisLinear:yj,axisAngle:EW,axisRadius:PW},U(RW,_j);const OW=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),UO.registerGraphicComponent(ej.circleAxis,((t,e)=>new WC(t,e))),UO.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new KP(t,e))),oj(),UO.registerComponent(RW.type,RW)};class IW extends BW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new yB}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 gL(this._option.dataSet,t,sP),t}transformScaleDomain(){}}IW.type=n.polarBandAxis,IW.specKey="axes",IW.builtInTheme={axis:Sj,axisBand:wj,axisAngle:EW,axisRadius:PW},U(IW,Mj);const LW=()=>{UO.registerGraphicComponent(ej.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new XP(t,e))),UO.registerGraphicComponent(ej.circleAxis,((t,e)=>new WC(t,e))),UO.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new KP(t,e))),oj(),UO.registerComponent(IW.type,IW)};class DW extends wW{constructor(){super(...arguments),this.type=aO.rose,this.transformerConstructor=CW,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(){this._roseMark=this._createMark(DW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,DW.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=>SO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=SO(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(LF(null===(i=UO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),DF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}DW.type=aO.rose,DW.mark=TW,DW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},DW.transformerConstructor=CW;const FW=()=>{UO.registerSeries(DW.type,DW),uW(),UO.registerAnimation("rose",((t,e)=>({appear:MW(t,e),enter:SW(t),exit:kW(t),disappear:AW(t)}))),LW(),OW()};class zW extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:oe(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=le(this.from,this._prevCenter),{angle:i,radius:s}=le(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,GR(this._fromAngle,this._toAngle)&&GR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=oe({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jW extends NT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!QR(t)&&!QR(e))return e;const s=le(t,this._prevCenter),n=le(e,this._center);let r=ce(s.angle),a=ce(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return oe({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 ie(s,n,r,a);return o.defined=e.defined,o}}const HW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function VW(t,e,i){return"fadeIn"===e?HW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function NW(t,e,i){return"fadeIn"===e?HW(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 WW=(t,e)=>({custom:HT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),UW=Object.assign(Object.assign(Object.assign({},TF),cz),{area:{name:"area",type:"area"}});class GW extends wW{constructor(){super(...arguments),this.type=aO.radar,this.transformerConstructor=bz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(GW.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:tF,closePath:!0},"normal",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.event.on(oL.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:u(this._spec.startAngle)?ne(this._spec.startAngle):Yz},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(LF(null===(s=UO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),DF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=UO.getAnimationInKey(e);t.setAnimationConfig(LF(null==i?void 0:i(n,r),DF(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&&_(a)?a[0]:a}}}GW.type=aO.radar,GW.mark=UW,GW.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},GW.transformerConstructor=bz,U(GW,dz);const YW=()=>{UO.registerSeries(GW.type,GW),HH(),vz(),yz(),UO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:VW(t,e,"in"),enter:VW(t,e,"in"),exit:VW(t,e,"out"),disappear:"clipIn"===e?void 0:VW(t,e,"out"),update:[{channel:["points","center"],custom:jW,customParameters:t,duration:ID.update.duration,easing:ID.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),UO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:NW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:NW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:zW,customParameters:t,duration:ID.update.duration,easing:ID.update.easing}]}))),UO.registerAnimation("radarGroup",((t,e)=>({appear:WW(t,"in"),disappear:WW(t,"out")}))),MA(),LW(),OW()};class XW extends fF{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=>pi.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 $W=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(pI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[vI]:r,[_I]:`${s}_${e}`})),r++}))})),n},KW={fill:"#bbb",fillOpacity:.2},qW=Object.assign(Object.assign({},TF),{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 ZW extends XF{constructor(){super(...arguments),this.type=aO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),gL(this._option.dataSet,"objFlat",$W),gL(this._option.dataSet,"copyDataView",SL),fL(this._option.dataSet,"dataview",xa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:wL.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(WO(KW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(ZW.mark.group),this._containerMark=this._createMark(ZW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(ZW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(ZW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(ZW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(ZW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(ZW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(ZW.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",XL.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",XL.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",XL.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",XL.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",XL.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",XL.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",XL.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",XL.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",XL.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:yI}}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 yO).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:yI}}initTooltip(){this._tooltipHelper=new XW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}ZW.type=aO.dot,ZW.mark=qW,ZW.builtInTheme={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"}}}}};class JW extends fF{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=>pi.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 QW=Object.assign(Object.assign({},TF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),tU=(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 eU extends XF{constructor(){super(...arguments),this.type=aO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),gL(this._option.dataSet,"linkDotInfo",tU),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:wL.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(eU.mark.group),this._containerMark=this._createMark(eU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(eU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(eU.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",XL.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",XL.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",XL.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",XL.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:yI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new JW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}eU.type=aO.link,eU.mark=QW,eU.builtInTheme={link:{arrow:{style:{size:10}}}};const iU=Object.assign(Object.assign({},TF),{group:{name:"group",type:"group"}});class sU extends QN{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()?SI:DI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle);let o;if(u(s)){const t=at(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 d(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()?kI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle),o=at(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=u(n)?ne(n):Yz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ne(r):Xz,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)||u(null==s?void 0:s.startAngle)||u(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=SO(this.angleAxisHelper.dataToPosition([t[SI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=SO(this.angleAxisHelper.dataToPosition([t[kI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?SO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(sU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",XL.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ne(a),o=ne(r)/2;return Qg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Bg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 oU=()=>{UO.registerAnimation("circularProgress",((t,e)=>({appear:aU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class lU extends WF{constructor(){super(...arguments),this._supportStack=!0}}class hU extends sU{constructor(){super(...arguments),this.type=aO.circularProgress,this.transformerConstructor=lU,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(k(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(k(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(){return this._progressMark=this._createMark(hU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:jF(this._spec,"progress")}),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",XL.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(hU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?SI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?kI: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",XL.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(LF(null===(i=UO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}hU.type=aO.circularProgress,hU.mark=nU,hU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},hU.transformerConstructor=lU;const cU=()=>{UO.registerSeries(hU.type,hU),uW(),oU(),zD(),LW(),OW()};function dU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const uU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:dU(t)}),pU={type:"fadeIn"};function gU(t,e="grow"){return!1===e?{}:"fadeIn"===e?pU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:dU(t)}))(t)}class fU extends fF{enableByType(t){return"dimension"!==t}}const mU=Object.assign(Object.assign({},TF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class vU extends XF{constructor(){super(...arguments),this.type=aO.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=u(e.width)?e.width:e.x1-e.x,o=u(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;return this._progressMark=this._createMark(vU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape: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 SO(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 SO(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?SO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",XL.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 SO(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 SO(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,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?SO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",XL.Series)}}_initTrackMark(){return this._trackMark=this._createMark(vU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return SO(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",XL.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return SO(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",XL.Series))}getInteractionTriggers(){const t=[];return 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(LF(null===(i=UO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new fU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}vU.type=aO.linearProgress,vU.mark=mU,vU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const _U=()=>{eV(),UO.registerAnimation("linearProgress",((t,e)=>({appear:gU(t,e),enter:gU(t),disappear:uU(t)}))),zD(),UO.registerSeries(vU.type,vU)},yU=[0],bU=[20,40],xU=[200,500],SU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},kU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],AU=`${pI}_WORD_CLOUD_TEXT`,MU=Object.assign(Object.assign({},TF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),wU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class TU extends UF{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){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=bU}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:xU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:yU,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)?AU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:SU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Vy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:yU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!kU.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;this._wordMark=this._createMark(TU.mark.word,{key:_I,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(TU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:GL.Mark-1}))}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",XL.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",XL.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",XL.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(LF(UO.getAnimationInKey("wordCloud")(n,s),DF("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 yO).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:yI])}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 HB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new HB).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[vI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,oL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:_I,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:hf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:Fg,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(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:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}TU.mark=MU,TU.builtInTheme={wordCloud:wU};function CU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ID.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;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===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=BU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},PU=(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=PU(t.children,e,t,n))})),s},EU=(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=EU(t.children,e,t,n)),n=e(t,s,i,n)})),n},RU=(t,e=[],i)=>{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):RU(t.children,e,i)))})),e};function OU(t,e){let i,s;if(DU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function DU(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*B,y:n+A+M*B,radius:B}}function HU(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 VU(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 NU(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 WU(t){return{_:t,next:null,prev:null}}function UU(t,e){const i=(t=G(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];HU(n,s,r);let a,o,l,h,c,d,u,p=WU(s),g=WU(n),f=WU(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=BU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:$U.defaultOpionts.nodeSort;PU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)PU([o],GU(h)),EU([o],YU(this._getPadding,.5,a)),PU([o],XU(1,this._maxDepth));else{const t=Math.min(s.width,s.height);PU([o],GU($U.defaultOpionts.setRadius)),EU([o],YU(Pt,1,a)),d&&EU([o],YU(this._getPadding,o.radius/t,a)),PU([o],XU(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}$U.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const KU=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KU(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qU(t){return t.depth}function ZU(t,e){return e-1-t.endDepth}const JU=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QU=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},tG={left:qU,right:ZU,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?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qU,end:ZU},eG=vt(0,1);class iG{constructor(t){this._ascendingSourceBreadth=(t,e)=>JU(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JU(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},iG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._logger=nt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):tG[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===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=[];KU(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=d(t.value)?0:kt(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=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=kt(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=!d(r.source),l=!d(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&&d(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=[QU(s[t.source]),QU(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=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,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*eG(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)}d(this.options.nodeSortBy)&&n.sort(JU),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(JU),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];sG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),nG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},rG.defaultOpionts,t):Object.assign({},rG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Bt(t,n))):Bt(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Bt(t,n))):Bt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Bt(r,n),i=(u-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-(_(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=BU(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=oe({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)}}}function aG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:sG,slice:aG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?aG:sG)(t,e,i,s,n)}};class hG{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=_(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=_(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=_(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=_(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({},hG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Ct(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?oG(this.options.aspectRatio):null!==(e=lG[this.options.splitType])&&void 0!==e?e:lG.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=BU(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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function cG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+oi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return nt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=cG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Mi(o.map(Mi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rAt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=dG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&nt.getInstance().error("Area "+r+" not represented on screen")}return i}function _G(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ci((function(i){return-1*yG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},xG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:G(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||pG,s=e.lossFunction||uG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];li(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rse.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:bG(l),arcs:l})}))},SG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:kG,triangle:kG,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 kG(){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 AG(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 MG=t=>SG[t]?SG[t]():SG.circle(),wG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function TG(t){return c(t)?t:function(){return t}}class CG{constructor(t){var e,i;switch(this.options=z({},CG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=MG(this.options.shape),this.getText=null!==(e=TG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=TG(this.options.fontWeight),this.getTextFontSize=TG(this.options.fontSize),this.getTextFontStyle=TG(this.options.fontStyle),this.getTextFontFamily=TG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>wG(10,50);break;case"random-light":this.getTextColor=()=>wG(50,90);break;default:this.getTextColor=TG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return ne(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():At(e);return ne(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&&!d(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 PG extends CG{constructor(t){var e;super(z({},PG.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<=PG.defaultOptions.minFontSize&&(this.options.minFontSize=PG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=BG[this.options.spiral])&&void 0!==e?e:BG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=TG(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}=AG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(IG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(OG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}IG(p,this._size)&&(p=LG(p,this._size))}else if(IG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||RG(p,i))&&(!i||!EG(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 EG(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 RG(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,IG=(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 LG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},FG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>oe(t,e,i+r*n)))},zG=(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()},jG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=AG(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=MG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return oe(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)zG(n,FG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)zG(n,FG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)zG(n,FG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)zG(n,FG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)zG(n,FG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=FG({x:l,y:h},o,-Math.PI/2,5),e=FG({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]);zG(n,i)}else n.fillRect(0,0,i,s)}; +function t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function P(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var E=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(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];!u(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,s=!1,n=!1){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(y(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=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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(!N(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(!N(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;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 tt(t){return Number(t)}const et="undefined"!=typeof console;function it(t,e,i){const s=[e].concat([].slice.call(i));et&&console[t].apply(console,s)}var st;!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"}(st||(st={}));class nt{static getInstance(t,e){return nt._instance&&x(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=st.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=st.Info}canLogDebug(){return this._level>=st.Debug}canLogError(){return this._level>=st.Error}canLogWarn(){return this._level>=st.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=st.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):it(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=st.Warn&&it(this._method||"warn","WARN",t),this}info(...t){return this._level>=st.Info&&it(this._method||"log","INFO",t),this}debug(...t){return this._level>=st.Debug&&it(this._method||"log","DEBUG",t),this}}function rt(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}nt._instance=null;const at=(t,e)=>ot(0,t.length,(i=>e(t[i]))),ot=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},lt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),function(t,e,i=tt){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)},ht=1e-10,ct=1e-10;function dt(t,e,i=ct,s=ht){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ut(t,e,i,s){return t>e&&!dt(t,e,i,s)}function pt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ft=function(t,e,i){return ti?i:t};var mt=(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 vt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let _t=!1;try{_t="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){_t=!1}function yt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&_t;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 g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function bt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),yt(t,e,{leading:s,trailing:n,maxWait:e})}function xt(t,e){return i=>t*(1-i)+e*i}function St(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function At(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}_t=!1;const Mt=4294967296;const wt=t=>e=>E(e,t),Tt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||wt)(i)},Ct=(t,e={})=>{if(_(t)){const i=t.map((t=>Tt(t,e)));return t=>i.map((e=>e(t)))}return Tt(t,e)},Bt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Et=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!d(n)&&(n=+n)>=n&&!d(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Lt=1e-12,Dt=Math.PI,Ft=Dt/2,zt=2*Dt,jt=2*Math.PI,Ht=Math.abs,Vt=Math.atan2,Nt=Math.cos,Wt=Math.max,Ut=Math.min,Gt=Math.sin,Yt=Math.sqrt,Xt=Math.pow;function $t(t){return t>=1?Ft:t<=-1?-Ft:Math.asin(t)}function Kt(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 qt(t,e){return t[0]*e[1]-t[1]*e[0]}function Zt(t,e){let i=0;for(let s=0;s0?i:0}function te(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))}function ee(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))}class ie{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ie(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 se{static distancePP(t,e){return Yt(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Yt(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return Yt(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new ie((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ae=(t=0)=>{if(t<0)for(;t<-zt;)t+=zt;else if(t>0)for(;t>zt;)t-=zt;return t};function oe(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 le(t,e={x:0,y:0},i=0,s=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 he(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ce(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function de(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=ce(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 ue(t){return(t=ce(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 pe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ge(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 me(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}=_e(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 ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const _e=(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 ye(t,e,i){if(!t||!e)return ve.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=_e(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 Se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ne(t.angle):t.angle,s=Ae(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Ae(t),Ae(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ne(t.angle):t.angle;let u=i?ne(90-t.angle):t.angle+Ft;const p=i?ne(e.angle):e.angle;let g=i?ne(90-e.angle):e.angle+Ft;u>jt&&(u-=jt),g>jt&&(g-=jt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Se(n,i)+Se(n,s))/2>Se(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Te=1e-8;function Ce(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ee(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Oe(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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(v(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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const Le=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),De=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Fe(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 je extends ze{}class He extends ze{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new He(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ve{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ve,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 Ve;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ve(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=re(r.rotateDeg),r}}class Ne{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 We(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 Ue(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 Ge=/^#([0-9a-f]{3,8})$/,Ye={transparent:4294967040},Xe={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 $e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ke(t){return x(t)?new ti(t>>16,t>>8&255,255&t,1):_(t)?new ti(t[0],t[1],t[2]):new ti(255,255,255)}function qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ze(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Je=(t,e)=>{const i=Ge.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ti((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ke(t):8===e?new ti(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Qe{static Brighter(t,e=1){return 1===e?t:new Qe(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Qe(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Qe?t:new Qe(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Ye[t]))return function(t){return x(t)?new ti(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ti(t[0],t[1],t[2],t[3]):new ti(255,255,255,1)}(Ye[t]);if(u(Xe[t]))return Ke(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Je(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 ti(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ti(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Qe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ti(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=Ue(this.color.r,this.color.g,this.color.b),r=We(d(t)?n.h:ft(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ti(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Je(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Qe(this.color.toString())}copyGammaToLinear(t,e=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,e=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=qe(t.color.r),this.color.g=qe(t.color.g),this.color.b=qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ti{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${$e(this.r)+$e(this.g)+$e(this.b)+(1===this.opacity?"":$e(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}=Ue(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ei(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 ti(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:Ue});function si(t){if(k(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(p(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 ni(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ri(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 ai(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}const oi=1e-10;function li(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+oi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=ui(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=se.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=hi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-oi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function hi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ci(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return hi(t,t-(i*i-e*e+t*t)/(2*i))+hi(e,s)}function di(t,e){const i=se.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function ui(t){const e={x:0,y:0};for(let i=0;ithis.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 fi;function mi(t,e){const i=gi(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 vi{constructor(t={}){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 _i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yi(t){let e;if(e=_i.exec(t))return new vi({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]});nt.getInstance().error("invalid format: "+t)}const bi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class xi{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 xi.instance||(xi.instance=new xi),xi.instance}newFormat(t){const e=yi(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"):Si[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=Si[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:_,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)?m: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?bi[8+fi/3]:"")+k+(t&&"("===n?")":""),f)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=yi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=gi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=bi[8+n/3];return function(t){return s(r*t)+a}}}const Si={"%":(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)=>mi(100*t,e),r:mi,s:function(t,e){const i=gi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(fi=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")+gi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ti(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ti(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Zt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Zi=Math.sqrt,Ji=Math.tan;function Qi(t){return t>1?0:t<-1?Di:Math.acos(t)}function ts(t){return t>1?Fi:t<-1?-Fi:Math.asin(t)}function es(){}function is(t,e){t&&ns.hasOwnProperty(t.type)&&ns[t.type](t,e)}var ss={Feature:function(t,e){is(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sDi?t+Math.round(-t/ji)*ji:t,e]}function vs(t,e,i){return(t%=ji)?e||i?fs(ys(t),bs(e,i)):ys(t):e||i?bs(e,i):ms}function _s(t){return function(e,i){return[(e+=t)>Di?e-ji:e<-Di?e+ji:e,i]}}function ys(t){var e=_s(t);return e.invert=_s(-t),e}function bs(t,e){var i=Gi(t),s=Ki(t),n=Gi(e),r=Ki(e);function a(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*i+o*s;return[Ui(l*n-c*r,o*i-h*s),ts(c*n+l*r)]}return a.invert=function(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*n-l*r;return[Ui(l*n+h*r,o*i+c*s),ts(c*i-o*s)]},a}function xs(t,e){(e=hs(e))[0]-=t,gs(e);var i=Qi(-e[1]);return((-e[2]<0?-i:i)+ji-Li)%ji}function Ss(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:es,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ni(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=Ki(s),r=[Ki(i),-Gi(i),0],a=0,o=0;Bs.reset(),1===n?s=Fi+Li:-1===n&&(s=-Fi-Li);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Di,T=f*x;if(Bs.add(Ui(T*A*Ki(M),m*S+T*Gi(M))),a+=w?k+A*ji:k,w^p>=i^y>=i){var C=ds(hs(u),hs(_));gs(C);var B=ds(r,C);gs(B);var P=(w^k>=0?-1:1)*ts(B[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Li||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(Is))}return u}}function Is(t){return t.length>1}function Ls(t,e){return((t=t.x)[0]<0?t[1]-Fi-Li:Fi-t[1])-((e=e.x)[0]<0?e[1]-Fi-Li:Fi-e[1])}1===(Ts=Es).length&&(Cs=Ts,Ts=function(t,e){return Es(Cs(t),e)});var Ds=Os((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?Di:-Di,l=Ni(r-i);Ni(l-Di)0?Fi:-Fi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Di&&(Ni(i-n)Li?Wi((Ki(e)*(r=Gi(s))*Ki(i)-Ki(s)*(n=Gi(e))*Ki(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*Fi,s.point(-Di,n),s.point(0,n),s.point(Di,n),s.point(Di,0),s.point(Di,-n),s.point(0,-n),s.point(-Di,-n),s.point(-Di,0),s.point(-Di,n);else if(Ni(t[0]-e[0])>Li){var r=t[0]0,n=Ni(e)>Li;function r(t,i){return Gi(t)*Gi(i)>e}function a(t,i,s){var n=[1,0,0],r=ds(hs(t),hs(i)),a=cs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ds(n,r),u=ps(n,h);us(u,ps(r,c));var p=d,g=cs(u,p),f=cs(p,p),m=g*g-f*(cs(u,u)-1);if(!(m<0)){var v=Zi(m),_=ps(p,(-g-v)/f);if(us(_,u),_=ls(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ni(_[0]-b)Di^(b<=_[0]&&_[0]<=x)){var w=ps(p,(-g+v)/f);return us(w,u),[_,ls(w)]}}}function o(e,i){var n=s?t:Di-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Di:-Di),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Gi(e),o=Ki(e),l=s*i;null==n?(n=e+s*ji,r=e-l/2):(n=xs(a,n),r=xs(a,r),(s>0?nr)&&(n+=s*ji));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 Ni(s[0]-t)0?0:3:Ni(s[0]-i)0?2:1:Ni(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,f,m,v,_,y=a,b=Ss(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ms(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&&m)y.point(r,a);else{var l=[g=Math.max(js,Math.min(zs,g)),f=Math.max(js,Math.min(zs,f))],b=[r=Math.max(js,Math.min(zs,r)),a=Math.max(js,Math.min(zs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Vs(t){return t}var Ns,Ws,Us,Gs,Ys=Ei(),Xs=Ei(),$s={point:es,lineStart:es,lineEnd:es,polygonStart:function(){$s.lineStart=Ks,$s.lineEnd=Js},polygonEnd:function(){$s.lineStart=$s.lineEnd=$s.point=es,Ys.add(Ni(Xs)),Xs.reset()},result:function(){var t=Ys/2;return Ys.reset(),t}};function Ks(){$s.point=qs}function qs(t,e){$s.point=Zs,Ns=Us=t,Ws=Gs=e}function Zs(t,e){Xs.add(Gs*t-Us*e),Us=t,Gs=e}function Js(){Zs(Ns,Ws)}var Qs=$s,tn=1/0,en=tn,sn=-tn,nn=sn;var rn,an,on,ln,hn={point:function(t,e){tsn&&(sn=t);enn&&(nn=e)},lineStart:es,lineEnd:es,polygonStart:es,polygonEnd:es,result:function(){var t=[[tn,en],[sn,nn]];return sn=nn=-(en=tn=1/0),t}},cn=0,dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn={point:bn,lineStart:xn,lineEnd:An,polygonStart:function(){yn.lineStart=Mn,yn.lineEnd=wn},polygonEnd:function(){yn.point=bn,yn.lineStart=xn,yn.lineEnd=An},result:function(){var t=_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:un?[cn/un,dn/un]:[NaN,NaN];return cn=dn=un=pn=gn=fn=mn=vn=_n=0,t}};function bn(t,e){cn+=t,dn+=e,++un}function xn(){yn.point=Sn}function Sn(t,e){yn.point=kn,bn(on=t,ln=e)}function kn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,bn(on=t,ln=e)}function An(){yn.point=bn}function Mn(){yn.point=Tn}function wn(){Cn(rn,an)}function Tn(t,e){yn.point=Cn,bn(rn=on=t,an=ln=e)}function Cn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,mn+=(n=ln*t-on*e)*(on+t),vn+=n*(ln+e),_n+=3*n,bn(on=t,ln=e)}var Bn=yn;function Pn(t){this._context=t}Pn.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,ji)}},result:es};var En,Rn,On,In,Ln,Dn=Ei(),Fn={point:es,lineStart:function(){Fn.point=zn},lineEnd:function(){En&&jn(Rn,On),Fn.point=es},polygonStart:function(){En=!0},polygonEnd:function(){En=null},result:function(){var t=+Dn;return Dn.reset(),t}};function zn(t,e){Fn.point=jn,Rn=In=t,On=Ln=e}function jn(t,e){In-=t,Ln-=e,Dn.add(Zi(In*In+Ln*Ln)),In=t,Ln=e}var Hn=Fn;function Vn(){this._string=[]}function Nn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),os(t,i(s))),s.result()}return r.area=function(t){return os(t,i(Qs)),Qs.result()},r.measure=function(t){return os(t,i(Hn)),Hn.result()},r.bounds=function(t){return os(t,i(hn)),hn.result()},r.centroid=function(t){return os(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Vs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Vn):new Pn(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 Un(t){return function(e){var i=new Gn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Gn(){}function Yn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),os(i,t.stream(hn)),e(hn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return Yn(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 $n(t,e,i){return Xn(t,[[0,0],e],i)}function Kn(t,e,i){return Yn(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 qn(t,e,i){return Yn(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)}Vn.prototype={_radius:4.5,_circle:Nn(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=Nn(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}},Gn.prototype={constructor:Gn,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 Zn=16,Jn=Gi(30*Vi);function Qn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Zi(b*b+x*x+S*S),A=ts(S/=k),M=Ni(Ni(S)-1)e||Ni((v*B+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Vi:0,B()):[m*Hi,v*Hi,_*Hi]},T.angle=function(t){return arguments.length?(y=t%360*Vi,B()):y*Hi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=Qn(o,w=t*t),P()):Zi(w)},T.fitExtent=function(t,e){return Xn(T,t,e)},T.fitSize=function(t,e){return $n(T,t,e)},T.fitWidth=function(t,e){return Kn(T,t,e)},T.fitHeight=function(t,e){return qn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function rr(t){var e=0,i=Di/3,s=nr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Vi,i=t[1]*Vi):[e*Hi,i*Hi]},n}function ar(t,e){var i=Ki(t),s=(i+Ki(e))/2;if(Ni(s)2?t[2]*Vi:0),e.invert=function(e){return(e=t.invert(e[0]*Vi,e[1]*Vi))[0]*=Hi,e[1]*=Hi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===pr?[[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 fr(t){return Ji((Fi+t)/2)}function mr(t,e){var i=Gi(t),s=t===e?Ki(t):Xi(i/Gi(e))/Xi(fr(e)/fr(t)),n=i*$i(fr(t),s)/s;if(!s)return pr;function r(t,e){n>0?e<-Fi+Li&&(e=-Fi+Li):e>Fi-Li&&(e=Fi-Li);var i=n/$i(fr(e),s);return[i*Ki(s*t),n-i*Gi(s*t)]}return r.invert=function(t,e){var i=n-e,r=qi(s)*Zi(t*t+i*i),a=Ui(t,Ni(i))*qi(i);return i*s<0&&(a-=Di*qi(t)*qi(i)),[a/s,2*Wi($i(n/r,1/s))-Fi]},r}function vr(t,e){return[t,e]}function _r(t,e){var i=Gi(t),s=t===e?Ki(t):(i-Gi(e))/(e-t),n=i/s+t;if(Ni(s)Li&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Tr.invert=cr(ts),Cr.invert=cr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi(Yi(t))-Fi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Lr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Lr(t.slice(0,s),e),o=Lr(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},Dr=Lr;!function(t){var e=Dr;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;r{const i=zr(Vr,e),{tolerance:s}=i;return Fr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Ur=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Kr(e,6):Kr(e,4))+"-"+Kr(t.getUTCMonth()+1,2)+"-"+Kr(t.getUTCDate(),2)+(r?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"."+Kr(r,3)+"Z":n?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"Z":s||i?"T"+Kr(i,2)+":"+Kr(s,2)+"Z":"")}function Zr(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 Yr;if(h)return h=!1,Gr;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(;a0}function la(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=ea(t));var r=[];switch(t.type){case"GeometryCollection":return ha(t,(function(t){da(t,s)})),t;case"FeatureCollection":return la(t,(function(t){la(da(t,s),(function(t){r.push(t)}))})),ai(r)}return da(t,s)}function da(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ha(t,(function(t){da(t,e)})),t;case"LineString":return ua(aa(t),e),t;case"Polygon":return pa(aa(t),e),t;case"MultiLineString":return aa(t).forEach((function(t){ua(t,e)})),t;case"MultiPolygon":return aa(t).forEach((function(t){pa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ua(t,e){oa(t)===e&&t.reverse()}function pa(t,e){oa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ga(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},_a=(t,e={},i)=>{i.type=Wr.GEO;const s=zr(ma,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(va(t))})):e.push(va(t))})),e})(t);let l=t.features;return o&&(l=ca(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=fa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=fa.bounds(t);t.bbox=e}})),t.features=l,t},ya={},ba=(t,e,i)=>{i.type=Wr.GEO;const s=zr(ma,ya,e),{object:n}=s;if(!v(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 Er(a,t)}))}:Er(a,o));var a,o;return _a(r,s,i)},xa=(t,e,i)=>{const s=!h(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 Sa=0;function ka(t="dataset"){return Sa>1e8&&(Sa=0),t+"_"+Sa++}class Aa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:ka("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.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()}}class Ma{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ma||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ur),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ta={albers:lr,albersusa:function(){var t,e,i,s,n,r,a=lr(),o=or().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=or().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)}},Ca=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ca.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class Ea{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",La="inversify:tagged",Da="inversify:paramtypes";class Fa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var za=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 ja(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};za.hasOwnMetadata(t,e)&&(r=za.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,za.defineMetadata(t,r,e)}(La,t,i.toString(),s)}function Ha(t){return(e,i,s)=>{ja(e,0,s,t)}}function Va(t){return e=>(i,s,n)=>Ha(new Fa(t,e))(i,s,n)}const Na=Va(Oa),Wa=Va(Ia);function Ua(){return function(t){return za.defineMetadata(Da,null,t),t}}function Ga(t){return Ha(new Fa(Ra,t))}const Ya="Singleton",Xa="Transient",$a="ConstantValue",Ka="DynamicValue",qa="Factory",Za="Function",Ja="Instance",Qa="Invalid";class to{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Qa,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new to(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ya&&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 eo{getConstructorMetadata(t){return{compilerGeneratedMetadata:za.getMetadata(Da,t),userGeneratedMetadata:za.getMetadata(La,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const io=(so=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===so&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const ao=Symbol("ContributionProvider");class oo{constructor(t,e){this.serviceIdentifier=t,this.container=e,ho.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function lo(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).inSingletonScope().whenTargetNamed(e)}class ho{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ho.store=new Map;class co{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 uo extends co{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const po=Symbol.for("EnvContribution"),go=Symbol.for("VGlobal"),fo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new eo}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new to(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ro(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case $a:case Za: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===Ya&&(t.cache=e,t.activated=!0)}},mo=Symbol.for("RenderService");const vo=new class{get renderService(){return this._renderService||(this._renderService=fo.get(mo)),this._renderService}};let _o=0;class yo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=vo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++_o,t),this.tryRunAnimationFrameNextFrame(),_o}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class bo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var xo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ko=function(t,e){return function(i,s){e(i,s,t)}},Ao=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 Mo=class extends bo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new uo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new yo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ao(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var wo,To,Co,Bo;Mo=xo([Ua(),ko(0,Na(ao)),ko(0,Ga(po)),So("design:paramtypes",[Object])],Mo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(To||(To={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Bo||(Bo={}));const Po=zt-1e-8;class Eo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Po)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%=zt)<0&&(s+=zt),(n%=zt)<0&&(n+=zt),nn;++o,a-=Ft)g(a);else for(a=s-s%Ft+Ft,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Oo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Io={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 Do,Fo,zo,jo,Ho,Vo;var No,Wo,Uo,Go,Yo,Xo;function $o(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;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 Ko(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ne(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=zt:C>0&&0===r&&(C-=zt);const B=Math.ceil(Math.abs(C/(Ft+.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 Zo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=nl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function al(t,e){const{p0:i,p1:s}=t,n=se.pointAtPP(i,s,e);return[new ol(i,n),new ol(n,s)]}class ol extends Jo{constructor(t,e){super(),this.type=Yo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return se.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Vt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?se.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Go.ROW?Ht(this.p0.x-this.p1.x):t===Go.COLUMN?Ht(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ll{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new rl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ol(new ie(this._lastX,this._lastY),new ie(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Go.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ht(t.p0.y-s.y)}if(t===Go.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ht(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class hl extends ll{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 cl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function dl(t,e,i){const s=null!=e?e:Ht(i[i.length-1].x-i[0].x)>Ht(i[i.length-1].y-i[0].y)?Go.ROW:Go.COLUMN;return"monotoneY"===t?new hl(t,s):new ll(t,s)}class ul{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 pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new ul(n,s),t),n}function gl(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 fl{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&&gl(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:gl(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 ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("basis",i,t);return function(t,e){cl(t,e,2)}(new fl(n,s),t),n}function vl(t){return t<0?-1:1}function _l(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(vl(r)+vl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function yl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function bl(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 xl{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:bl(this,this._t0,yl(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,bl(this,yl(this,e=_l(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:bl(this,this._t0,e=_l(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 Sl extends xl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneX",i,t);return function(t,e){cl(t,e,2)}(new xl(n,s),t),n}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneY",i,t);return function(t,e){cl(t,e,2)}(new Sl(n,s),t),n}let Ml=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class wl extends Ml{lineEnd(){this.context.closePath()}}function Tl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Ml(r,e,n),t),r}function Cl(t,e){return cl(t,e,1)}class Bl extends ul{lineEnd(){this.context.closePath()}}function Pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new Bl(n,s),t),n}function El(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Lt){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>Lt){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,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return pl(i,n);const o=dl(t,r,i);return cl(new e(o,s,a),i,2),o}}const Ol=Rl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:El(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 Il=Rl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:El(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Ll extends Jo{constructor(t,e,i){super(),this.type=Yo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return sl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Qo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Go.ROW?Ht(this.p0.x-this.p2.x):t===Go.COLUMN?Ht(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Ut(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Vt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=sl(i,s,n,e),a=se.pointAtPP(i,s,e),o=se.pointAtPP(s,n,e);return[new Ll(i,a,r),new Ll(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Dl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ol(new ie(this._lastX,this._lastY),new ie(t,e))}quadraticCurveTo(t,e,i,s){const n=new Ll(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new rl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Fl(t,e,i){var s,n;switch(e){case"linear":default:return pl(t,i);case"basis":return ml(t,i);case"monotoneX":return kl(t,i);case"monotoneY":return Al(t,i);case"step":return Tl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new wl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Tl(t,0,i);case"stepAfter":return Tl(t,1,i);case"catmullRom":return Ol(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Il(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Pl(t,i)}}class zl extends Ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Eo(this.bounds)}get curves(){return this.tryBuildCurves()}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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Dl(this);Zo(this.commandList,t,0,0,1,1)}return this._curves}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=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`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;tVo){let t,e=zo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Go.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.y-e.p1.y)}if(this.direction===Go.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{nt.getInstance().warn("空函数")}}),ih=Object.assign(Object.assign({},$l),{points:[],cornerRadius:0,closePath:!0}),sh=Object.assign(Object.assign({},$l),{width:100,height:100,spikes:5,thickness:.5}),nh=Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const rh=Object.assign(Object.assign({},$l),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ah=Object.assign(Object.assign(Object.assign({},$l),Gl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),oh=Object.assign(Object.assign(Object.assign({},$l),Gl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),lh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},$l),{fill:!0,cornerRadius:0,cornerType:"round"}),hh=Object.assign(Object.assign({},lh),{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}),ch=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&&_(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 dh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(dh.IsGradientStr(t))try{const e=ch(t)[0];if(e){if("linear"===e.type)return dh.ParseLinear(e);if("radial"===e.type)return dh.ParseRadial(e);if("conic"===e.type)return dh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2,n=parseFloat(e.value)/180*Dt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+jt,stops:dh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:dh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2;let n="angular"===e.type?parseFloat(e.value)/180*Dt:0;for(;n<0;)n+=jt;for(;n>=jt;)n-=jt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const gh={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"}},fh=!0,mh=!1,vh=/\w|\(|\)|-/,_h=/[.?!,;:/,。?!、;:]/,yh=/\S/,bh=(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})};function xh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=vo.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=Sh(t,a)),a}function Sh(t,e,i=!1){let s=e;for(;vh.test(t[s-1])&&vh.test(t[s])||_h.test(t[s]);)if(s--,s<=0)return i?kh(t,e):e;return s}function kh(t,e){let i=e;for(;vh.test(t[i+1])&&vh.test(t[i])||_h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ah(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=vo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ah.fontSize}){let i=0,s=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=Sh(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){nt.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,a=!1){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=Sh(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}};wh=Mh([Ua()],wh);var Th=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ch=Symbol.for("TextMeasureContribution");let Bh=class extends wh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Bh=Th([Ua()],Bh);const Ph=Symbol.for("CanvasFactory"),Eh=Symbol.for("Context2dFactory");function Rh(t){return fo.getNamed(Ph,vo.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Lh=1/3;function Dh(t){return t>-Kh&&tKh||t<-Kh}const zh=[0,0],jh=[0,0],Hh=[0,0];function Vh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Nh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Uh(t){return(t%=jt)<0&&(t+=jt),t}function Gh(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+=jt);let d=Math.atan2(l,o);return d<0&&(d+=jt),d>=s&&d<=n||d+jt>=s&&d+jt<=n}function $h(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(Dh(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 Zh=[-1,-1,-1],Jh=[-1,-1];function Qh(){const t=Jh[0];Jh[0]=Jh[1],Jh[1]=t}function tc(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(Dh(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,Lh):Math.pow(i,Lh),s=s<0?-Math.pow(-s,Lh):Math.pow(s,Lh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Zh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Qh(),p=Wh(e,s,r,o,Jh[0]),u>1&&(g=Wh(e,s,r,o,Jh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Dh(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,Zh);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=Nh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Zh[0]=-l,Zh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=jt-1e-4){s=0,n=jt;const e=r?1:-1;return a>=Zh[0]+t&&a<=Zh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=jt,n+=jt);let c=0;for(let e=0;e<2;e++){const i=Zh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=jt+t),(t>=s&&t<=n||t+jt>=s&&t+jt<=n)&&(t>Dt/2&&t<1.5*Dt&&(e=-e),c+=e)}}return c}function sc(t){return Math.round(t/Dt*1e8)/1e8%2*Dt}function nc(t,e){let i=sc(t[0]);i<0&&(i+=jt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=jt?n=i+jt:e&&i-n>=jt?n=i-jt:!e&&i>n?n=i+(jt-sc(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;rc[0]=S,rc[1]=k,nc(rc,Boolean(a[6])),S=rc[0],k=rc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case Lo.M:u=m,p=v,c=u,d=p;break;case Lo.L:if(i){if($h(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Lo.C:if(i){if(Yh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=tc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Lo.Q:if(i){if(Gh(c,d,m,v,_,y,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Lo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Xh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ic(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case Lo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if($h(u,p,o,p,e,s,n)||$h(o,p,o,l,e,s,n)||$h(o,l,u,l,e,s,n)||$h(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Lo.Z:if(i){if($h(c,d,u,p,e,s,n))return!0}else h+=Pe(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},hc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cc=Symbol.for("VWindow"),dc=Symbol.for("WindowHandlerContribution");let uc=class extends bo{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(){super(),this.hooks={onChange:new uo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(fo.getNamed(dc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=vo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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&&dt(this.width,t.width())&&dt(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)}};uc=lc([Ua(),hc("design:paramtypes",[])],uc);var pc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,s){e(i,s,t)}};let mc=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=vo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=oc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:Gl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Gl.fontFamily,fontSize:Gl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=fo.get(cc),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 vc;mc=pc([Ua(),fc(0,Na(ao)),fc(0,Ga(Ch)),gc("design:paramtypes",[Object])],mc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(vc||(vc={}));const _c=new Ve;let yc=class{constructor(){this.matrix=new Ve}init(t){return this.mode=vc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=vc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}scale(t,e,i){return this.mode===vc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===vc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return _c.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}translate(t,e){return this.mode===vc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===vc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};yc=pc([Ua(),gc("design:paramtypes",[])],yc);const bc={arc:Kl,area:ql,circle:Zl,line:th,path:eh,symbol:rh,text:ah,rect:nh,polygon:ih,star:sh,richtext:oh,richtextIcon:hh,image:lh,group:Jl,glyph:Ql},xc=Object.keys(bc);function Sc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},bc.arc),area:Object.assign({},bc.area),circle:Object.assign({},bc.circle),line:Object.assign({},bc.line),path:Object.assign({},bc.path),symbol:Object.assign({},bc.symbol),text:Object.assign({},bc.text),rect:Object.assign({},bc.rect),polygon:Object.assign({},bc.polygon),star:Object.assign({},bc.star),richtext:Object.assign({},bc.richtext),richtextIcon:Object.assign({},bc.richtextIcon),image:Object.assign({},bc.image),group:Object.assign({},bc.group),glyph:Object.assign({},bc.glyph)};class Ac{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},xc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;xc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Sc(n,t[s]),i[s]&&Sc(n,i[s]),e[s]&&Sc(n,e[s]),this.combinedTheme[s]=n})),e.common&&xc.forEach((t=>{Sc(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 Mc=new Ac;function wc(t,e){return t.glyphHost?wc(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)):Mc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Mc.getTheme()}var Tc=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 Cc extends o{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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Tc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ec))return void nt.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(Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Lc(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 Ec))return void nt.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=Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Lc(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(Lc(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,Lc(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 Ec))return void nt.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"):Lc(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 Rc))return void nt.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=Ic.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 Dc(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 Ec,this.rootWheelEvent=new Rc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Hc{static GetImage(t,e){var i;const s=Hc.cache.get(t);s?"fail"===s.loadState?vo.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):Hc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Hc.cache.get(t);s?"fail"===s.loadState?vo.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"},Hc.cache.set(t,s),s.dataPromise=vo.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=Hc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Hc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vo.global.loadBlob(t):"json"===e&&(i.dataPromise=vo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Hc.isLoading&&Hc.toLoadAueue.length){Hc.isLoading=!0;const t=Hc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Hc.cache.set(i,n),n.dataPromise=vo.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((()=>{Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()})).catch((t=>{console.error(t),Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()}))}}),0)}static loadImage(t,e){const i=Vc(t,Hc.toLoadAueue);if(-1!==i)return Hc.toLoadAueue[i].marks.push(e),void Hc.loading();Hc.toLoadAueue.push({url:t,marks:[e]}),Hc.loading()}static improveImageLoading(t){const e=Vc(t,Hc.toLoadAueue);if(-1!==e){const t=Hc.toLoadAueue.splice(e,1);Hc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Vc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Uc[0]=t[0],Uc[2]=t[0],Uc[1]=t[1],Uc[3]=t[1],Uc):t:t:0,Yc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function $c(t,e,i,s){for(;t>=jt;)t-=jt;for(;t<0;)t+=jt;for(;t>e;)e+=jt;Yc[0].x=i,Yc[1].y=i,Yc[2].x=-i,Yc[3].y=-i;const n=Math.ceil(t/Ft)%4,r=Math.ceil(e/Ft)%4;if(s.add(Nt(t)*i,Gt(t)*i),s.add(Nt(e)*i,Gt(e)*i),n!==r||e-t>Dt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Jc.TimeOut=1e3/60;const Qc=new Jc,td=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ed{bounds(t,e){if(x(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 x(t)?t:Math.min(t[0],t[1])}}function id(t,e,i,s,n){return n?t.arc(i,s,e,0,zt,!1,n):t.arc(i,s,e,0,zt),!1}var sd=new class extends ed{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 id(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return id(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 nd=new class extends ed{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 rd(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 ad=new class extends ed{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 rd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return rd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return rd(t,this.parseSize(e)/2+n,i,s,r)}};function od(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ld=new class extends ed{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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,n=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 cd extends ed{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 hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}}var dd=new cd;var ud=new class extends cd{constructor(){super(...arguments),this.type="triangle"}};const pd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),gd=Math.sin(zt/10)*pd,fd=-Math.cos(zt/10)*pd;function md(t,e,i,s){const n=gd*e,r=fd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=zt*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 vd=new class extends ed{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 md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return md(t,this.parseSize(e)/2+n,i,s)}};const _d=Yt(3);function yd(t,e,i,s){const n=e,r=n/_d,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 bd=new class extends ed{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 yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return yd(t,this.parseSize(e)/2+n,i,s)}};function xd(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 Sd=new class extends ed{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ad=new class extends ed{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Md=-.5,wd=Yt(3)/2,Td=1/Yt(12);function Cd(t,e,i,s){const n=e/2,r=e*Td,a=n,o=e*Td+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(Md*n-wd*r+i,wd*n+Md*r+s),t.lineTo(Md*a-wd*o+i,wd*a+Md*o+s),t.lineTo(Md*l-wd*h+i,wd*l+Md*h+s),t.lineTo(Md*n+wd*r+i,Md*r-wd*n+s),t.lineTo(Md*a+wd*o+i,Md*o-wd*a+s),t.lineTo(Md*l+wd*h+i,Md*h-wd*l+s),t.closePath(),!1}var Bd=new class extends ed{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 Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ed=new class extends ed{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends ed{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Ld=new class extends ed{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Dd=Yt(3);function Fd(t,e,i,s){const n=e*Dd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var zd=new class extends ed{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Fd(t,this.parseSize(e)/2/Dd,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2/Dd+n,i,s)}};function jd(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 Hd=new class extends ed{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 jd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/4+n,i,s)}};function Vd(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 Nd=new class extends ed{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Ud=new class extends ed{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 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 Gd(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 Yd=new class extends ed{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var $d=new class extends ed{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 Kd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var qd=new class extends ed{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(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 ed{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 Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function tu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var eu=new class extends ed{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 x(e)?tu(t,e,i,s):Qd(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?tu(t,e+2*n,i,s):Qd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const iu=new je;class su{constructor(t,e,i=!1){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(),Zo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Zo(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 x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{iu.x1=i.bounds.x1*t,iu.y1=i.bounds.y1*t,iu.x2=i.bounds.x2*t,iu.y2=i.bounds.y2*t,e.union(iu)}))}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 nu={};[sd,nd,ad,ld,zd,ud,vd,bd,Sd,Ad,Bd,Ed,Od,dd,Ld,Hd,Nd,Ud,Yd,eu,$d,qd,Jd].forEach((t=>{nu[t.type]=t}));const ru={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class au{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 ou(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function lu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=lu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ou(t,"--\x3e",r+4,"Comment is not closed.");else{const a=lu(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 au(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 au(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 du(t,e){return uu(t)}function uu(t,e){const i={};for(let e=0;exu.set(t,!0)));const Su=new Map;function ku(t){if(xu.has(t))return!0;if(Su.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Su.set(t,!0)));const Au=yu(),Mu=yu(),wu=yu(),Tu=yu(),Cu=yu(),Bu=yu(),Pu=yu(),Eu=yu(),Ru=yu(),Ou=yu();yu();const Iu=yu();yu();const Lu=yu();yu();const Du=yu(),Fu=yu(),zu=Symbol.for("GraphicService"),ju=Symbol.for("GraphicCreator"),Hu={"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"},Vu=Object.keys(Hu),Nu={duration:200,easing:"cubicOut"};function Wu(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 Uu(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 Gu(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 Yu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 $u{constructor(){this.pools=[]}static identity(t){return Wu(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 $u.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},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Qu=new Ve(1,0,0,1,0,0),tp={x:0,y:0};let ep=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this.path=new zl,this._clearMatrix=new Ve(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ku.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},tp),function(t,e,i){return ac(t,0,!1,e,i)}(this.path.commandList,tp.x,tp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},tp);const i=uh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return ac(t,e,!0,i,s)}(this.path.commandList,i,tp.x,tp.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Qu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};ep=Zu([Ua(),Ju("design:paramtypes",[Object,Number])],ep);const ip={WIDTH:500,HEIGHT:500,DPR:1};class sp{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}set nativeCanvas(t){this._nativeCanvas=t}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=ip.WIDTH,height:n=ip.HEIGHT,dpr:r=ip.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var np;sp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(np||(np={}));class rp{static Get(t,e=np.Color1,i=[0,0,0,1]){if(e===np.Color1){const e=rp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Qe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];rp.store1[t]=e,rp.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=rp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Qe.parseColorString(t);return n&&(rp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],rp.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===np.Color1){if(rp.store1[t])return;rp.store1[t]=i,rp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rp.store255[t])return;rp.store255[t]=i,rp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function ap(t,e=!1){return Array.isArray(t)&&x(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 op(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return lp(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):lp(t,e,i,s,n)}function lp(t,e,i,s,n){if(!t||!e)return t&&ap(t)||e&&ap(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rp.Get(t,np.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rp.Get(e,np.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:ap(a)})))});return o?op(r,l,i,s,n):op(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:up(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:up(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:up(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),ap(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)}function hp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}rp.store255={},rp.store1={};const cp=[0,0,0,0],dp=[0,0,0,0];function up(t,e,i){return rp.Get(t,np.Color255,cp),rp.Get(e,np.Color255,dp),`rgba(${Math.round(cp[0]+(dp[0]-cp[0])*i)},${Math.round(cp[1]+(dp[1]-cp[1])*i)},${Math.round(cp[2]+(dp[2]-cp[2])*i)},${cp[3]+(dp[3]-cp[3])*i})`}class pp{static GetCanvas(){try{return pp.canvas||(pp.canvas=vo.global.createCanvas({})),pp.canvas}catch(t){return null}}static GetCtx(){if(!pp.ctx){const t=pp.GetCanvas();pp.ctx=t.getContext("2d")}return pp.ctx}}class gp extends Ne{static getInstance(){return gp._instance||(gp._instance=new gp),gp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=pp.GetCanvas(),s=pp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new gp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class fp{static GetSize(t){for(let e=0;e=t)return fp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=fp.GenKey(t,e,i,s,n),l=fp.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=fp.GenKey(t,e,i,s,n);fp.cache[l]?fp.cache[l].push({width:a,height:o,pattern:r}):fp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}fp.cache={},fp.ImageSize=[20,40,80,160,320,640,1280,2560];const mp=new je,vp=new Ve;new je;const _p=["lineWidth","scaleX","scaleY","angle","anchor","visible"],yp=["x","y"],bp=["scaleX","scaleY"],xp=["angle"],Sp=new ie,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ap extends Cc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=nu[t];if(e)return e;if(e=Ap.userSymbolMap[t],e)return e;if(!0===((i=t=ru[t]||t).startsWith("{const e=(new zl).fromString(t.d),i={};Vu.forEach((e=>{t[e]&&(i[Hu[e]]=t[e])})),n.push({path:e,attribute:i}),mp.union(e.bounds)}));const r=mp.width(),a=mp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new su(t,n,!0);return Ap.userSymbolMap[t]=l,l}var i;const s=(new zl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new su(t,s);return Ap.userSymbolMap[t]=o,o}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=Gc(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 Eo(t);return Zo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ve),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&No.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&No.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&No.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&No.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=No.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Wo.GLOBAL){const i=new ie(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Nu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Uo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Uo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Uo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=No.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=No.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&No.UPDATE_SHAPE_AND_BOUNDS)===No.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=No.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=No.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=No.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=No.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=No.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&No.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,scaleX:i=Vl.scaleX,scaleY:s=Vl.scaleY,angle:n=Vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Nt(a),f=Gt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),vo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=vp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Uo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new zl).fromString(t):this.pathProxy=new zl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),vo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||vo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ep(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Mp;Ap.userSymbolMap={},Ap.mixin(Fc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Mp||(Mp={}));let wp=class t extends Ap{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=No.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 Ac),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ac)}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===Wo.GLOBAL){const i=new ie(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&No.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,dx:i=Vl.dx,dy:s=Vl.dy,scaleX:n=Vl.scaleX,scaleY:r=Vl.scaleY,angle:a=Vl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return vo.graphicService.updateTempAABBBounds(i),vo.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&=No.CLEAR_BOUNDS,this._childUpdateTag&=No.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&No.UPDATE_BOUNDS||(this._childUpdateTag|=No.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&No.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=vo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Tp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Cp extends wp{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 Ac,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vo.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=>{vo.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Ep=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Lp,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},Fp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zp=Lp=class{static GenerateLayerId(){return`${Lp.idprefix}_${Lp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vo.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?fo.get(Rp):"dynamic"===t?fo.get(Op):fo.get(Ip),e}createLayer(t,e={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 Cp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Lp.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)}};zp.idprefix="visactor_layer",zp.prefix_count=0,zp=Lp=Dp([Ua(),Fp("design:paramtypes",[])],zp);var jp=new Ea((t=>{t(go).to(Mo).inSingletonScope(),t(cc).to(uc),t(Pp).to(mc).inSingletonScope(),t(Bp).to(yc).inSingletonScope(),t(Ep).to(zp).inSingletonScope()}));function Hp(t,e){return!(!t&&!e)}function Vp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Np(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Up(t,e){return t*e>0}function Gp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Yp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-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-m,B=M-v,P=w-m,E=T-v;return C*C+B*B>P*P+E*E&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Ht(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 k=n*Nt(c),A=n*Gt(c),M=s*Nt(u),w=s*Gt(u);let T,C,B,P;if((b>Lt||y>Lt)&&(T=n*Nt(d),C=n*Gt(d),B=s*Nt(p),P=s*Gt(p),r1?0:E<-1?Dt:Math.acos(E))/2),l=Yt(t[0]*t[0]+t[1]*t[1]);S=Ut(b,(s-l)/(o-1)),x=Ut(y,(n-l)/(o+1))}}var E;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:P,xore:T,yore:C,xire:M,yire:w,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 $p(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ht(l-o),c=l>o;let d=!1;if(n=jt-Lt)e.moveTo(i+n*Nt(o),s+n*Gt(o)),e.arc(i,s,n,o,l,!c),r>Lt&&(e.moveTo(i+r*Nt(l),s+r*Gt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:P,innerCornerRadiusEnd:E,maxInnerCornerRadius:R}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Lt){const t=Ut(v,m),r=Ut(_,m),o=Yp(g,f,u,p,n,t,Number(c)),l=Yp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,n,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Nt(Vt(l.y01,l.x01)),s+l.cy+r*Gt(Vt(l.y01,l.x01))):e.moveTo(i+b,s+n*Gt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Nt(M),s+n*Gt(M));if(!(r>Lt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Lt){const t=Ut(P,w),n=Ut(E,w),o=Yp(S,k,b,x,r,-n,Number(c)),l=Yp(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),w0&&e.arc(i+o.cx,s+o.cy,n,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,r,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Nt(Vt(l.y01,l.x01)),s+l.cy+t*Gt(Vt(l.y01,l.x01))):e.moveTo(i+g,s+f)}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,B,c):e.moveTo(i+r*Nt(B),s+r*Gt(B))}return a?a[3]&&e.lineTo(i+n*Nt(o),s+n*Gt(o)):e.closePath(),d}const Kp=Symbol.for("ArcRenderContribution"),qp=Symbol.for("AreaRenderContribution"),Zp=Symbol.for("CircleRenderContribution"),Jp=Symbol.for("GroupRenderContribution"),Qp=Symbol.for("ImageRenderContribution"),tg=Symbol.for("PathRenderContribution"),eg=Symbol.for("PolygonRenderContribution"),ig=Symbol.for("RectRenderContribution"),sg=Symbol.for("SymbolRenderContribution"),ng=Symbol.for("TextRenderContribution"),rg=Symbol.for("InteractiveSubRenderContribution");function ag(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function og(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var lg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cg=function(t,e){return function(i,s){e(i,s,t)}};function dg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Uu(t,t,[n+o,r+l,a+h]),Uu(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),Uu(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]),f){const i=qu.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]}Uu(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),Uu(i,i,[-s[0],-s[1],0]),Yu(t,t,i)}}let ug=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new uo(["graphic"]),onSetStage:new uo(["graphic","stage"]),onRemove:new uo(["graphic"]),onRelease:new uo(["graphic"]),onAddIncremental:new uo(["graphic","group","stage"]),onClearIncremental:new uo(["graphic","group","stage"]),beforeUpdateAABBBounds:new uo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new je,this.tempAABBBounds2=new je}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Eo(t);return Zo(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=og(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ag(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){vu(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;vu(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&&Fe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};ug=lg([Ua(),cg(0,Na(ju)),hg("design:paramtypes",[Object])],ug);const pg=(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},gg=["radius","startAngle","endAngle",..._p];class fg extends Ap{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Tu}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 wc(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}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.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>jt-Lt?i.set(-r,-r,r,r):$c(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new zl,s.arc(0,0,r,a,o),s}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=kp;class vg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=wo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Fu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new yg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=vo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){vu(n,o/Math.abs(r+a),!0,l),i.union(n)}return vo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Fe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=vo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new vg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=vo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new vg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],P=[0,0];let E=1/0;if(b>0&&(E=Math.max(Math.floor(b/A),1)),x&&(E=Math.min(E,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),P[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const t=ag(_,a),e=this.cache.verticalList.length*v,i=og(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===bu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const x=ag(_,a),S=this.cache.verticalList.length*v,k=og(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=td(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=_g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=_g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return yg.baselineMapAlign}getAlignMapBaseline(){return yg.alignMapBaseline}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),yg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},yg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const xg=["symbolType","size",..._p];let Sg=class t extends Ap{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Du}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=vo.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;vu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return vo.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,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new zl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new zl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Ag=["segments","points","curveType","curveTension",..._p];let Mg=class t extends Ap{constructor(t={}){super(t),this.type="line",this.numberType=Eu}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=qc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new zl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Tg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Cg=["width","x1","y1","height","cornerRadius",..._p];class Bg extends Ap{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Tg(e);return t=new zl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Eg extends Ap{constructor(t){super(t),this.type="glyph",this.numberType=Cu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Eg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=kp;class Og{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=gh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Lg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=td(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ah(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ah(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=xh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Dg=["width","height","image",..._p];class Fg extends Ap{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return lh[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}clone(){return new Fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class jg extends Fg{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=Gc(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=Gc(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=lh.width,height:e=lh.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 Hg{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 jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Lg){const e=yh.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 jg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ah(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)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||mh;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,bh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||fh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ph(t,s,{AABBBounds:i}):s,bh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Ah(t,s.character,s.ascentDescentMode),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 jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Vg{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=gh[this.direction]}store(t){if(t instanceof jg){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 Hg(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,e=!1){t instanceof jg?"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||this.newLine)&&("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=xh(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 Lg(i,t.newLine,t.character,t.ascentDescentMode),new Lg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ng=!1;try{Ng=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ng=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",..._p];class Ug extends Ap{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Lu,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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Ug.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Ug.splitText(t.text).length>1)))}static splitText(t){if(Ng){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Ug.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),vo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Ug.AllSingleCharacter(_)&&(_=Ug.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Og(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Vg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Ug(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Ug.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const Yg=["path","customPath",..._p];class Xg extends Ap{constructor(t){super(t),this.type="path",this.numberType=Ru}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 zl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof zl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return vo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new zl).fromString(t.path):t.customPath&&(this.cache=new zl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){return(new zl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const Kg=["segments","points","curveType","curveTension",..._p];class qg extends Ap{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return vo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new zl;const 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 qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Jg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",..._p];class Qg extends Ap{constructor(t){super(t),this.type="arc",this.numberType=Au}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(x(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=ae(e),i=e+r,s&&Ht(r)Lt&&o>Lt)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=Yt(a*a+o*o)}=this.attribute,h=Ht(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Lt&&l>Lt){const i=e>t?1:-1;let s=$t(Number(l)/o*Gt(g)),n=$t(Number(l)/a*Gt(g));return(f-=2*s)>Lt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Lt?(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 wc(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}=vo.graphicService.updateTempAABBBounds(i);pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return vo.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<=Lt?i.set(0,0,0,0):Math.abs(o-l)>jt-Lt?i.set(-s,-s,s,s):($c(l,o,s,i),$c(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ht(o-a),d=o>a;if(h=jt-Lt)n.moveTo(0+h*Nt(a),0+h*Gt(a)),n.arc(0,0,h,a,o,!d),l>Lt&&(n.moveTo(0+l*Nt(o),0+l*Gt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Nt(a),e=h*Gt(a),i=l*Nt(o),s=l*Gt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const ef=["points","cornerRadius",..._p];class sf extends Ap{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new zl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=kp;class rf extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function af(t){return new rf(t)}const of=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 lf,hf;function cf(t){return lf||(lf=of.CreateGraphic("text",{})),lf.initAttributes(t),lf.AABBBounds}var df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},pf=function(t,e){return function(i,s){e(i,s,t)}};class gf{constructor(){this.time=Xo.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=oc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),oc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const ff=new gf;let mf=class{constructor(t){this.subRenderContribitions=t,this.time=Xo.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)}))}};mf=df([Ua(),pf(0,Na(ao)),pf(0,Ga(rg)),uf("design:paramtypes",[Object])],mf);const vf=new class{constructor(){this.time=Xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const _f=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class yf{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=oc.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])),oc.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,jt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=oc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:uh(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(),$p(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"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},Sf=bf,kf=ff;const Af=new class{constructor(){this.time=Xo.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{radius:m=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:uh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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"),f&&M(p,"innerBorder")}},Mf=bf,wf=ff;const Tf=new class extends gf{constructor(){super(...arguments),this.time=Xo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Cf=Dt/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Ht(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ht(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ht(t[0]),i=Ht(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ht(l[0]),l[1]=Ht(l[1]),l[2]=Ht(l[2]),l[3]=Ht(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cf,Dt,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Dt,Dt+Cf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ef{constructor(){this.time=Xo.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,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:uh(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(),Bf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),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&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Rf=class{constructor(){this.time=Xo.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)}};Rf=Pf([Ua()],Rf);let Of=class{constructor(){this.time=Xo.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,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x: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 Bf(e,i,s,b,x,v,"bevel"!==y,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ua()],Of);const If=new Ef,Lf=bf,Df=ff;const Ff=new class extends Ef{constructor(){super(...arguments),this.time=Xo.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)}},zf=ff;const jf=new class{constructor(){this.time=Xo.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:_=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:uh(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()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Hf=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Vf=bf,Nf=ff;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Uf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(vf),this.builtinContributions.push(_f),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===Xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Xo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Np(d,u,h),y=Up(d,g),b=Hp(h),x=Vp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Zo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Np(o,l,n),p=Up(o,c),g=Hp(n,r),f=Vp(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),qu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&qu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let $f=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Au,this.builtinContributions=[xf,kf,Sf],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(nLt){const t=Ut(b,y),r=Ut(x,y),a=Yp(v,_,f,m,n,t,Number(u)),o=Yp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Vt(o.y11,o.x11),Vt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Lt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Lt){const t=Ut(P,T),n=Ut(E,T),a=Yp(M,w,k,A,r,-n,Number(u)),o=Yp(f,m,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,Vt(a.y01,a.x01),Vt(a.y11,a.x11),!u);const t=Vt(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*Nt(B),s+r*Gt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{fill:c=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:_,doStroke:y}=f,{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=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ht(s-i){var e;let i=!0;if(h(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((_||B)&&(e.beginPath(),$p(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),$p(t,e,i,s,A,M,P),C||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())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ht(h-r)>=jt-Lt){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,m,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+=jt;for(;i>jt;)i-=jt;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),op(o.color,l.color,h,!1)}(0,0,h,n);a||Np&&(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,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};$f=Gf([Ua(),Xf(0,Na(ao)),Xf(0,Ga(Kp)),Yf("design:paramtypes",[Object])],$f);var 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},qf=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 Jf=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[Af,wf,Mf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Qf(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]=nl(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 tm(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 em(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=tm(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),Qf(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Go.ROW:"y"===s?u=Go.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 sm=class extends Uf{constructor(){super(...arguments),this.numberType=Eu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();em(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Fl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Ut(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function nm(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),Qf(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),Qf(t,l,1,s),o=!1):o=!0}t.closePath()}sm=im([Ua()],sm);const rm=new class extends yf{constructor(){super(...arguments),this.time=Xo.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Zc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Zc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Zc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Zc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},am=ff;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 Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[rm,am],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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function P(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,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=Fl(P(t.points,x),B,{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=Fl(P(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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=P(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Fl(e,B,{curveTension:b}),n=Fl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Ut(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Go.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ht(y.x-b.x),k=Ht(y.y-b.y);x=null==y.x1?Go.ROW:null==y.y1?Go.COLUMN:Number.isFinite(S+k)?S>k?Go.ROW:Go.COLUMN:Go.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Go.ROW:Go.COLUMN,Number.isFinite(c)||(o=Go.COLUMN),Number.isFinite(d)||(o=Go.ROW);const u=i*(o===Go.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),em(t,i[0]?e.top:e.bottom,l,x===Go.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};cm=om([Ua(),hm(0,Na(ao)),hm(0,Ga(qp)),lm("design:paramtypes",[Object])],cm);const dm=bf,um=ff;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},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[um,dm],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zo(t.pathShape.commandList,e,i,s,1,1,f);else{Zo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};mm=pm([Ua(),fm(0,Na(ao)),fm(0,Ga(tg)),gm("design:paramtypes",[Object])],mm);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},_m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Df,Lf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Wp(g,f,w,T,h),B=Gp(g,v,w,T,M),P=Hp(h,c),E=Vp(d,m);if(!t.valid||!y)return;if(!P&&!E)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Bf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:P,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,P,E,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,P,E,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};bm=vm([Ua(),ym(0,Na(ao)),ym(0,Ga(ig)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[jf,Nf,Vf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Am=xm([Ua(),km(0,Na(ao)),km(0,Ga(sg)),Sm("design:paramtypes",[Object])],Am);const Mm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new je)}allocate(t,e,i,s){if(!this.pools.length)return(new je).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 je(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends gf{constructor(){super(...arguments),this.time=Xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=p(T)&&T.background,E=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(g=T.dx)&&void 0!==g?g: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!==(_=T.height)&&void 0!==_?_:e.height();if(B=Mm.allocate(i,s,i+n,s+r),T=T.background,!E){const t=B.width(),e=B.height();B.set((null!==(y=T.x)&&void 0!==y?y: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 B=t.AABBBounds,E||(B=cf(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(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Bf(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Mm.free(B),C()}};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},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=td(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Ku.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Ku.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(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,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:ag(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Em(t,e,i,s){if(e&&e.length){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},Fm=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 jm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Lm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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))?Em(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Em(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),k=Om(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Rm(A,M),T=Om(h,Rm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let P=B-C;P<0&&(C=B,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,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=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};jm=Dm([Ua(),zm(0,Na(ao)),zm(0,Ga(eg)),Fm("design:paramtypes",[Object])],jm);var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Tf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Wp(p,m,g,f,c),C=Gp(p,v,g,f),B=Hp(c,u),P=Vp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!P)return;if(!(T||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Tf));const E={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o,E)})),h&&e.clip();const R=()=>{E.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{E.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Xo.afterFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=vo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(i,p||i,n),a.modelMatrix=i,qu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&qu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Hm([Ua(),Nm(0,Na(ao)),Nm(0,Ga(Jp)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let $m=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Ff,zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Bf(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Hc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};$m=Um([Ua(),Ym(0,Na(ao)),Ym(0,Ga(Qp)),Gm("design:paramtypes",[Object])],$m);const Km=Symbol.for("IncrementalDrawContribution"),qm=Symbol.for("ArcRender"),Zm=Symbol.for("AreaRender"),Jm=Symbol.for("CircleRender"),Qm=Symbol.for("GraphicRender"),tv=Symbol.for("GroupRender"),ev=Symbol.for("LineRender"),iv=Symbol.for("PathRender"),sv=Symbol.for("PolygonRender"),nv=Symbol.for("RectRender"),rv=Symbol.for("SymbolRender"),av=Symbol.for("TextRender"),ov=Symbol.for("RichTextRender"),lv=Symbol.for("GlyphRender"),hv=Symbol.for("ImageRender"),cv=Symbol.for("DrawContribution"),dv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Mu,!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+=jt;for(;o<0;)o+=jt;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 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},pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gv=Symbol.for("DrawItemInterceptor"),fv=new je,mv=new je;class vv{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){fv.copy(s.dirtyBounds),mv.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,Ku.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(fv),s.backupDirtyBounds.copy(mv)),!0}}class _v{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 yv=class{constructor(){this.order=1,this.interceptors=[new vv,new xv,new bv,new _v]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&qu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Av=function(t,e){return function(i,s){e(i,s,t)}};let Mv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Mv=Sv([Ua(),Av(0,Na(cv)),kv("design:paramtypes",[Object])],Mv);var wv=new Ea((t=>{t(mo).to(Mv)}));const Tv=Symbol.for("PickerService"),Cv=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Ev([Ua()],Rv);let Ov=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Ku.allocateByObj(a),u=new ie(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}};Ov=Ev([Ua()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ie(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}};Iv=Ev([Ua()],Iv);let Lv=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=dv(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()}};Lv=Ev([Ua()],Lv);var Dv=new Ea(((t,e,i)=>{i(Tv)||(t(Cv).toSelf(),t(Tv).toService(Cv)),t(Lv).toSelf().inSingletonScope(),t(Bv).toService(Lv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),lo(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),lo(t,Pv)})),Fv=new Ea((t=>{t(zu).to(ug),t(ju).toConstantValue(of)}));const zv=Symbol.for("AutoEnablePlugins"),jv=Symbol.for("PluginService");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},Vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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&&fo.isBound(zv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Hv([Ua(),Nv(0,Na(ao)),Nv(0,Ga(zv)),Vv("design:paramtypes",[Object])],Wv);var Uv=new Ea((t=>{t(jv).to(Wv),function(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).whenTargetNamed(e)}(t,zv)})),Gv=new Ea((t=>{lo(t,po)})),Yv=new Ea((t=>{t(Ch).to(Bh).inSingletonScope(),lo(t,Ch)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kv=class{constructor(){this.type="static",this.offscreen=!1,this.global=vo.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=Rh({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()}};Kv=Xv([Ua(),$v("design:paramtypes",[])],Kv);var qv=new Ea((t=>{t(Kv).toSelf(),t(Rp).toService(Kv)}));var Zv=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 Jv(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 Qv(t,e,i,s=!1,n=!1){let 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}=Jv(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;t{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}=Jv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,s){e(i,s,t)}};let r_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Qv(e,$l.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ze,this.backupDirtyBounds=new ze,this.global=vo.global,this.layerService=vo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=me(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:$l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:$l.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ku.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=e_(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&&!be(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Mm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Ku.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Mm.free(n),Ku.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||fo.get(Km);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 o_=class extends sm{constructor(){super(...arguments),this.numberType=Eu}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=wc(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=Np(u,p,c),_=Up(u,g),y=Hp(c),b=Vp(d,f);if(!t.valid||!m)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())}};o_=a_([Ua()],o_);var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 h_=class extends cm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Np(u,d,c),f=Hp(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())}};h_=l_([Ua()],h_);var c_,d_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},u_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p_=function(t,e){return function(i,s){e(i,s,t)}},g_=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"}(c_||(c_={}));let f_=class extends r_{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=c_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return g_(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 g_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return g_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>g_(this,void 0,void 0,(function*(){if(2!==t.count)yield t_(t,$l.zIndex,((i,s)=>{if(this.status===c_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return g_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return g_(this,void 0,void 0,(function*(){this.rendering&&(this.status=c_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=c_.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 g_(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:()=>g_(this,void 0,void 0,(function*(){yield t_(t,$l.zIndex,(t=>g_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};f_=d_([Ua(),p_(0,Wa(Qm)),p_(1,Na(o_)),p_(2,Na(h_)),p_(3,Na(ao)),p_(3,Ga(gv)),u_("design:paramtypes",[Array,Object,Object,Object])],f_);var m_=new Ea((t=>{t(gf).toSelf().inSingletonScope(),t(yf).toSelf().inSingletonScope(),t(cv).to(r_),t(Km).to(f_),t(tv).to(Wm).inSingletonScope(),t(Qm).toService(tv),lo(t,Jp),t(mf).toSelf().inSingletonScope(),lo(t,rg),lo(t,Qm),t(yv).toSelf().inSingletonScope(),t(gv).toService(yv),lo(t,gv)}));function v_(){v_.__loaded||(v_.__loaded=!0,fo.load(jp),fo.load(Fv),fo.load(wv),fo.load(Dv),fo.load(Uv),function(t){t.load(Gv),t.load(Yv),t.load(qv)}(fo),function(t){t.load(m_)}(fo))}v_.__loaded=!1,v_();const __=fo.get(go);vo.global=__;const y_=fo.get(Pp);vo.graphicUtil=y_;const b_=fo.get(Bp);vo.transformUtil=b_;const x_=fo.get(zu);vo.graphicService=x_;const S_=fo.get(Ep);vo.layerService=S_;class k_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class A_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=vo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vo.global.getRequestAnimationFrame();this.rafId=t((()=>{vo.global.devicePixelRatio!==this.dpr&&(this.dpr=vo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=vo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class M_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vo.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 w_=new je;class T_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(w_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(w_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let C_;function B_(){!function(){if(null==C_)try{const t=document.createElement("canvas"),e=t.getContext("2d");C_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),C_&&(C_=!!document.createElement)}catch(t){C_=!1}}();const t=vo.global&&vo.global.env;return t?"browser"===t:C_}let P_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};P_._pluginClasses={};const E_="white";class R_ extends wp{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:E_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ac,this.hooks={beforeRender:new uo(["stage"]),afterRender:new uo(["stage"]),afterClearScreen:new uo(["stage"]),afterClearRect:new uo(["stage"])},this.global=vo.global,!this.global.env&&B_()&&this.global.setEnv("browser"),this.window=fo.get(cc),this.renderService=fo.get(mo),this.pluginService=fo.get(jv),this.layerService=fo.get(Ep),this.graphicService=fo.get(zu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:E_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new jc(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(t=!1){t&&(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,_=(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=P_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,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=P_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=P_.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 k_))}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 A_))}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 M_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ze;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new T_,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=P_.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=P_.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=P_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ie(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=fo.get(cc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=fo.get(Tv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var O_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},I_=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 L_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new je}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}}loadFont(t,e,i){return I_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};L_=O_([Ua()],L_);var D_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},F_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let z_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new je,this.modelMatrix=new Ve(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};z_=D_([Ua(),F_("design:paramtypes",[])],z_);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},H_=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)}};let N_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=vo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 je).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 Ve(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ie(e.x,e.y),a=wc(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 ie(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&qu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Ku.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function W_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function U_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function q_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ey=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},iy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new ze;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ey(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ey(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);iy(n[0],s,i),iy(n[1],e-s,i)}};let sy=!1;const ny=new Ea((t=>{sy||(sy=!0,t($f).toSelf().inSingletonScope(),t(qm).to($f).inSingletonScope(),t(Qm).toService(qm),t(Kp).toService(mf),lo(t,Kp))}));let ry=!1;const ay=new Ea((t=>{ry||(ry=!0,t(bm).toSelf().inSingletonScope(),t(nv).to(bm).inSingletonScope(),t(Qm).toService(nv),t(Of).toSelf(),t(Rf).toSelf(),t(ig).toService(Of),t(ig).toService(Rf),t(ig).toService(mf),lo(t,ig))}));let oy=!1;const ly=new Ea((t=>{oy||(oy=!0,t(sm).toSelf().inSingletonScope(),t(o_).toSelf().inSingletonScope(),t(ev).to(sm).inSingletonScope(),t(Qm).toService(ev))}));let hy=!1;const cy=new Ea((t=>{hy||(hy=!0,t(cm).toSelf().inSingletonScope(),t(Zm).to(cm).inSingletonScope(),t(Qm).toService(Zm),t(qp).toService(mf),lo(t,qp),t(h_).toSelf().inSingletonScope())}));let dy=!1;const uy=new Ea((t=>{dy||(dy=!0,t(Am).toSelf().inSingletonScope(),t(rv).to(Am).inSingletonScope(),t(Qm).toService(rv),t(sg).toService(mf),lo(t,sg))}));let py=!1;const gy=new Ea((t=>{py||(py=!0,t(Jf).toSelf().inSingletonScope(),t(Jm).to(Jf).inSingletonScope(),t(Qm).toService(Jm),t(Zp).toService(mf),lo(t,Zp))}));let fy=!1;const my=new Ea((t=>{fy||(fy=!0,t(av).to(Pm).inSingletonScope(),t(Qm).toService(av),t(ng).toService(mf),lo(t,ng))}));let vy=!1;const _y=new Ea((t=>{vy||(vy=!0,t(mm).toSelf().inSingletonScope(),t(iv).to(mm).inSingletonScope(),t(Qm).toService(iv),t(tg).toService(mf),lo(t,tg))}));let yy=!1;const by=new Ea((t=>{yy||(yy=!0,t(sv).to(jm).inSingletonScope(),t(Qm).toService(sv),t(eg).toService(mf),lo(t,eg))}));var xy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Sy=class{constructor(){this.numberType=Cu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Sy=xy([Ua()],Sy);let ky=!1;const Ay=new Ea((t=>{ky||(ky=!0,t(lv).to(Sy).inSingletonScope(),t(Qm).toService(lv))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ty=class extends Uf{constructor(){super(),this.numberType=Lu,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Np(o,l,!0),d=Np(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};Ty=My([Ua(),wy("design:paramtypes",[])],Ty);let Cy=!1;const By=new Ea((t=>{Cy||(Cy=!0,t(ov).to(Ty).inSingletonScope(),t(Qm).toService(ov))}));let Py=!1;const Ey=new Ea((t=>{Py||(Py=!0,t(hv).to($m).inSingletonScope(),t(Qm).toService(hv),t(Qp).toService(mf),lo(t,Qp))}));function Ry(t){const e=[];for(let i=0;i=0&&n>=0&&snt.getInstance().info(`[VChart log]: ${t}`,...e),Ly=(t,e)=>(c(Fy.warnHandler)&&Fy.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),Dy=(t,e,i)=>{if(!c(Fy.errorHandler))throw new Error(t);Fy.errorHandler.call(null,t,e)},Fy={silent:!1,warnHandler:!1,errorHandler:!1},zy=B_(),jy=zy&&globalThis?globalThis.document:void 0;function Hy(t){return("desktop-browser"===t||"mobile-browser"===t)&&zy}function Vy(t){return Ny(t)||"mobile-browser"===t}function Ny(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Wy=0;function Uy(){return Wy>=9999999&&(Wy=0),Wy++}function Gy(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function Yy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Xy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class $y extends wp{constructor(t,e){super(t),this._skipRenderAttributes=Xy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},Sb=(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 kb extends o{constructor(t,e={}){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.startTime=Ic.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=Ic.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||xb(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=Sb(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=Ic.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=Sb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=xb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Sb(s[0],t){vo.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){if(!this.element)return;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},Mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const wb=[0,0,0];let Tb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Nl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ul),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Gl),{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this._clearMatrix=new Ve(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Ku.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&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=jt;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(f,-2*y),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&&fp.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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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,e=vo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Gl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Gl.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&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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=ph(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:uh(this,a,this.dpr),r.strokeStyle=ph(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};Tb.env="browser",Tb=Ab([Ua(),Mb("design:paramtypes",[Object,Number])],Tb);var Cb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pb=class extends sp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Tb(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 Eb(t,e){return new Ea((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Eh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Pb.env="browser",Pb=Cb([Ua(),Bb("design:paramtypes",[Object])],Pb);const Rb=Eb(Pb,Tb);var 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},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lb=function(t,e){return function(i,s){e(i,s,t)}};let Db=class extends N_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=oc.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 zb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};zb=Fb([Ua()],zb);const jb=new Ea(((t,e,i,s)=>{jb.__vloaded||(jb.__vloaded=!0,t(yb).to(zb).inSingletonScope(),t(bb).toService(yb),lo(t,bb))}));jb.__vloaded=!1;var Hb=jb;const Vb=new Ea(((t,e,i,s)=>{i(Db)||t(Db).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(Db):t(Tv).toService(Db)}));var Nb,Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ub=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gb=Nb=class extends z_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Nb.idprefix}_${Nb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vo.global,this.viewBox=new je,this.modelMatrix=new Ve(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:Nb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Pb(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 Pb({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)}};Gb.env="browser",Gb.idprefix="visactor_window",Gb.prefix_count=0,Gb=Nb=Wb([Ua(),Ub("design:paramtypes",[])],Gb);const Yb=new Ea((t=>{t(Gb).toSelf(),t(dc).toDynamicValue((t=>t.container.get(Gb))).whenTargetNamed(Gb.env)}));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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kb=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 qb{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 Zb(t,e=!1){const i=document.createElement("img");if(vo.global.isImageAnonymous&&(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 Jb=class extends L_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 qb(t)}return new je}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Zb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Zb(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:Pa.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(...t){}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}}loadFont(t,e,i){return Kb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Jb=Xb([Ua(),$b("design:paramtypes",[])],Jb);const Qb=new Ea((t=>{Qb.isBrowserBound||(Qb.isBrowserBound=!0,t(Jb).toSelf().inSingletonScope(),t(po).toService(Jb))}));function tx(t,e=!0){tx.__loaded||(tx.__loaded=!0,t.load(Qb),t.load(Rb),t.load(Yb),e&&function(t){t.load(Hb),t.load(Vb)}(t))}Qb.isBrowserBound=!1,tx.__loaded=!1;var ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ix=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sx=function(t,e){return function(i,s){e(i,s,t)}};let nx=class extends N_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 ep(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}};nx=ex([Ua(),sx(0,Na(ao)),sx(0,Ga(Ky)),sx(1,Na(ao)),sx(1,Ga(Bv)),sx(2,Na(ao)),sx(2,Ga(Pv)),ix("design:paramtypes",[Object,Object,Object])],nx);const rx=new Ea((t=>{rx.__vloaded||(rx.__vloaded=!0,lo(t,Ky))}));rx.__vloaded=!1;var ax=rx;class ox{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:uh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Au}};dx=lx([Ua(),cx(0,Na(qm)),hx("design:paramtypes",[Object])],dx);let ux=!1;const px=new Ea(((t,e,i,s)=>{ux||(ux=!0,t(qy).to(dx).inSingletonScope(),t(Ky).toService(qy))}));var gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fx=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 vx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};vx=gx([Ua(),mx(0,Na(Zm)),fx("design:paramtypes",[Object])],vx);let _x=!1;const yx=new Ea(((t,e,i,s)=>{_x||(_x=!0,t(Zy).to(vx).inSingletonScope(),t(Ky).toService(Zy))}));var bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sx=function(t,e){return function(i,s){e(i,s,t)}};let kx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Tu}};kx=bx([Ua(),Sx(0,Na(Jm)),xx("design:paramtypes",[Object])],kx);let Ax=!1;const Mx=new Ea(((t,e,i,s)=>{Ax||(Ax=!0,t(Jy).to(kx).inSingletonScope(),t(Ky).toService(Jy))}));class wx{constructor(){this.type="glyph",this.numberType=Cu}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 Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Px=class extends wx{constructor(t){super(),this.canvasRenderer=t}};Px=Tx([Ua(),Bx(0,Na(lv)),Cx("design:paramtypes",[Object])],Px);let Ex=!1;const Rx=new Ea(((t,e,i,s)=>{Ex||(Ex=!0,t(ab).to(Px).inSingletonScope(),t(Px).toService(ab))}));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};let Ix=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Ix=Ox([Ua()],Ix);let Lx=!1;const Dx=new Ea(((t,e,i,s)=>{Lx||(Lx=!0,t(Qy).to(Ix).inSingletonScope(),t(Ix).toService(Qy))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Eu}};Hx=Fx([Ua(),jx(0,Na(ev)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Ea(((t,e,i,s)=>{Vx||(Vx=!0,t(tb).to(Hx).inSingletonScope(),t(Ky).toService(tb))}));var Wx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Yx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};Yx=Wx([Ua(),Gx(0,Na(sv)),Ux("design:paramtypes",[Object])],Yx);let Xx=!1;const $x=new Ea(((t,e,i,s)=>{Xx||(Xx=!0,t(rb).to(Yx).inSingletonScope(),t(Ky).toService(rb))}));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},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};Jx=Kx([Ua(),Zx(0,Na(iv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Ea(((t,e,i,s)=>{Qx||(Qx=!0,t(eb).to(Jx).inSingletonScope(),t(Ky).toService(eb))})),eS=new je;class iS{constructor(){this.type="rect",this.numberType=Iu}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||x(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:uh(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;eS.setValue(i.x1,i.y1,i.x2,i.y2),eS.expand(-r/2),h=!eS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class extends iS{constructor(t){super(),this.canvasRenderer=t}};aS=sS([Ua(),rS(0,Na(nv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new Ea(((t,e,i,s)=>{oS||(oS=!0,t(ib).to(aS).inSingletonScope(),t(Ky).toService(ib))}));let hS=!1;const cS=new Ea(((t,e,i,s)=>{hS||(hS=!0,t(Qy).to(Ix).inSingletonScope(),t(Ix).toService(Qy))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}};gS=dS([Ua(),pS(0,Na(rv)),uS("design:paramtypes",[Object])],gS);let fS=!1;const mS=new Ea(((t,e,i,s)=>{fS||(fS=!0,t(sb).to(gS).inSingletonScope(),t(Ky).toService(sb))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="text",this.numberType=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};_S=vS([Ua()],_S);let yS=!1;const bS=new Ea(((t,e,i,s)=>{yS||(yS=!0,t(nb).to(_S).inSingletonScope(),t(Ky).toService(nb))})),xS=new Ea(((t,e,i,s)=>{i(nx)||t(nx).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(nx):t(Tv).toService(nx)}));class SS{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 kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let MS=class extends Tb{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};MS.env="node",MS=kS([Ua(),AS("design:paramtypes",[Object,Number])],MS);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 sp{constructor(t){super(t)}init(){this._context=new MS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};CS.env="node",CS=wS([Ua(),TS("design:paramtypes",[Object])],CS);const BS=Eb(CS,MS);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},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class extends z_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new CS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new CS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};OS.env="node",OS=PS([Ua(),RS(0,Na(go)),ES("design:paramtypes",[Object])],OS);const IS=new Ea((t=>{t(OS).toSelf(),t(dc).toDynamicValue((t=>t.container.get(OS))).whenTargetNamed(OS.env)}));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 DS=class extends L_{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 Qc.call(t)}}getCancelAnimationFrame(){return t=>{Qc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};DS=LS([Ua()],DS);const FS=new Ea((t=>{FS.isNodeBound||(FS.isNodeBound=!0,t(DS).toSelf().inSingletonScope(),t(po).toService(DS))}));function zS(t,e=!0){zS.__loaded||(zS.__loaded=!0,t.load(FS),t.load(BS),t.load(IS))}FS.isNodeBound=!1,zS.__loaded=!1;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};let HS=class extends Tb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:uh(this,l,this.dpr),r.strokeStyle=ph(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=vo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,vo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Oe(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Oe(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};HS.env="harmony",HS=jS([Ua()],HS);var VS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends sp{constructor(t){super(t)}init(){this._context=new HS(this,this._dpr)}resize(t,e){}release(...t){}};WS.env="harmony",WS=VS([Ua(),NS("design:paramtypes",[Object])],WS);var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},YS=function(t,e){return function(i,s){e(i,s,t)}};class XS{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 $S=class extends z_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new XS}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{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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new WS(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}this.canvas=new WS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};$S.env="harmony",$S=US([Ua(),YS(0,Na(go)),GS("design:paramtypes",[Object])],$S);const KS=new Ea((t=>{t($S).toSelf(),t(dc).toDynamicValue((t=>t.container.get($S))).whenTargetNamed($S.env)})),qS=Eb(WS,HS);var ZS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let QS=class extends L_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new Jc(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new SS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};QS=ZS([Ua(),JS("design:paramtypes",[])],QS);const tk=new Ea((t=>{tk.isHarmonyBound||(tk.isHarmonyBound=!0,t(QS).toSelf().inSingletonScope(),t(po).toService(QS))}));function ek(t,e=!0){ek.__loaded||(ek.__loaded=!0,t.load(tk),t.load(qS),t.load(KS),e&&function(t){t.load(ax),t.load(xS),t.load(px),t.load(yx),t.load(Mx),t.load(Rx),t.load(Dx),t.load(Nx),t.load($x),t.load(tS),t.load(lS),t.load(cS),t.load(mS),t.load(bS)}(t))}tk.isHarmonyBound=!1,ek.__loaded=!1;var ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nk=function(t,e){return function(i,s){e(i,s,t)}};let rk=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Au}};rk=ik([Ua(),nk(0,Na(qm)),sk("design:paramtypes",[Object])],rk);let ak=!1;const ok=new Ea(((t,e,i,s)=>{ak||(ak=!0,t(ob).to(rk).inSingletonScope(),t(bb).toService(ob))}));var lk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ck=function(t,e){return function(i,s){e(i,s,t)}};let dk=class extends iS{constructor(t){super(),this.canvasRenderer=t}};dk=lk([Ua(),ck(0,Na(nv)),hk("design:paramtypes",[Object])],dk);let uk=!1;const pk=new Ea(((t,e,i,s)=>{uk||(uk=!0,t(pb).to(dk).inSingletonScope(),t(bb).toService(pb))}));class gk extends Uf{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:uh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends gk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Eu}};_k=fk([Ua(),vk(0,Na(ev)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Ea(((t,e,i,s)=>{yk||(yk=!0,t(db).to(_k).inSingletonScope(),t(bb).toService(db))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Ak=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};Ak=xk([Ua(),kk(0,Na(Zm)),Sk("design:paramtypes",[Object])],Ak);let Mk=!1;const wk=new Ea(((t,e,i,s)=>{Mk||(Mk=!0,t(lb).to(Ak).inSingletonScope(),t(bb).toService(lb))}));class Tk extends Uf{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&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Ek=class extends Tk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}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:uh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&qu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Ek=Ck([Ua(),Pk(0,Na(rv)),Bk("design:paramtypes",[Object])],Ek);let Rk=!1;const Ok=new Ea(((t,e,i,s)=>{Rk||(Rk=!0,t(gb).to(Ek).inSingletonScope(),t(bb).toService(gb))}));var Ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Tu}};Fk=Ik([Ua(),Dk(0,Na(Jm)),Lk("design:paramtypes",[Object])],Fk);let zk=!1;const jk=new Ea(((t,e,i,s)=>{zk||(zk=!0,t(hb).to(Fk).inSingletonScope(),t(bb).toService(hb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nk=function(t,e){return function(i,s){e(i,s,t)}};let Wk=class extends Tk{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Fu}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=og(a,u,n),v=ag(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&&qu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Wk=Hk([Ua(),Nk(0,Na(av)),Vk("design:paramtypes",[Object])],Wk);let Uk=!1;const Gk=new Ea(((t,e,i,s)=>{Uk||(Uk=!0,t(fb).to(Wk).inSingletonScope(),t(bb).toService(fb))}));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},Xk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$k=function(t,e){return function(i,s){e(i,s,t)}};let Kk=class extends gk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};Kk=Yk([Ua(),$k(0,Na(iv)),Xk("design:paramtypes",[Object])],Kk);let qk=!1;const Zk=new Ea(((t,e,i,s)=>{qk||(qk=!0,t(ub).to(Kk).inSingletonScope(),t(bb).toService(ub))}));var Jk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};eA=Jk([Ua(),tA(0,Na(sv)),Qk("design:paramtypes",[Object])],eA);let iA=!1;const sA=new Ea(((t,e,i,s)=>{iA||(iA=!0,t(mb).to(eA).inSingletonScope(),t(bb).toService(mb))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends wx{constructor(t){super(),this.canvasRenderer=t}};oA=nA([Ua(),aA(0,Na(lv)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new Ea(((t,e,i,s)=>{lA||(lA=!0,t(_b).to(oA).inSingletonScope(),t(bb).toService(_b))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Lu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};pA=cA([Ua(),uA(0,Na(ov)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new Ea(((t,e,i,s)=>{gA||(gA=!0,t(vb).to(pA).inSingletonScope(),t(bb).toService(vb))}));var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_A=function(t,e){return function(i,s){e(i,s,t)}};let yA=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};yA=mA([Ua(),_A(0,Na(hv)),vA("design:paramtypes",[Object])],yA);let bA=!1;const xA=new Ea(((t,e,i,s)=>{bA||(bA=!0,t(cb).to(yA).inSingletonScope(),t(bb).toService(cb))})),SA=B_();function kA(){kA.__loaded||(kA.__loaded=!0,of.RegisterGraphicCreator("arc",tf),fo.load(ny),fo.load(SA?ok:px))}kA.__loaded=!1;const AA=kA;function MA(){MA.__loaded||(MA.__loaded=!0,of.RegisterGraphicCreator("area",Zg),fo.load(cy),fo.load(SA?wk:yx))}MA.__loaded=!1;const wA=MA;function TA(){TA.__loaded||(TA.__loaded=!0,of.RegisterGraphicCreator("circle",mg),fo.load(gy),fo.load(SA?jk:Mx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,of.RegisterGraphicCreator("glyph",Rg),fo.load(Ay),fo.load(SA?hA:Rx))}BA.__loaded=!1;const PA=BA;function EA(){EA.__loaded||(EA.__loaded=!0,of.RegisterGraphicCreator("group",Tp))}EA.__loaded=!1;const RA=EA;function OA(){OA.__loaded||(OA.__loaded=!0,of.RegisterGraphicCreator("image",zg),fo.load(Ey),fo.load(SA?xA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,of.RegisterGraphicCreator("line",wg),fo.load(ly),fo.load(SA?bk:Nx))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,of.RegisterGraphicCreator("path",$g),fo.load(_y),fo.load(SA?Zk:tS))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,of.RegisterGraphicCreator("polygon",nf),fo.load(by),fo.load(SA?sA:$x))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,of.RegisterGraphicCreator("rect",Pg),fo.load(ay),fo.load(SA?pk:lS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,of.RegisterGraphicCreator("richtext",Gg),fo.load(By),fo.load(SA?fA:cS))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,of.RegisterGraphicCreator("shadowRoot",af))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,of.RegisterGraphicCreator("symbol",kg),fo.load(uy),fo.load(SA?Ok:mS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,of.RegisterGraphicCreator("text",bg),fo.load(my),fo.load(SA?Gk:bS))}KA.__loaded=!1;const qA=KA;function ZA(){RA(),NA()}const JA=-.5*Math.PI,QA=1.5*Math.PI,tM="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 eM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(eM||(eM={}));const iM={[eM.selectedReverse]:{},[eM.selected]:{},[eM.hover]:{},[eM.hoverReverse]:{}},sM={container:"",width:30,height:30,style:{}},nM="scrollDrag";function rM(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const aM={debounce:yt,throttle:bt};ZA();let oM=class t extends $y{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=rM(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:aM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=mt(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(nM,{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",aM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(mt(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:si(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]=si(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]=mt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?mt([a+i*n,a+s*n],a,n-l):mt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=rM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};oM.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};var lM,hM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 cM=lM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new ze).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ht(t.deltaX)>Ht(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new je,e.addEventListener("wheel",this.scroll),this.params=lM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(nM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new oM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(cM)||(t(cM).toSelf(),t(zv).toService(cM))}));function uM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&uM(t,e)}))}const pM=t=>!d(t)&&!1!==t.visible;function gM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function fM(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 vM=["#ffffff","#000000"];function _M(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Qe(t).toHex(),o=new Qe(e).toHex();return yM(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(...vM);for(const n of a)if(t!==n&&yM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function yM(t,e,i,s,n){if("lightness"===n){const i=Qe.getColorBrightness(new Qe(e));return Qe.getColorBrightness(new Qe(t))<.5?i>=.5:i<.5}return s?bM(t,e)>s:"largeText"===i?bM(t,e)>3:bM(t,e)>4.5}function bM(t,e){const i=xM(t),s=xM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function xM(t){const e=ei(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 SM(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 kM(t,e){return[t[0]*e,t[1]*e]}function AM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function MM(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=qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const wM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:tM,fontSize:14},s),getTextBounds:i?void 0:cf,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function TM(t,e,i={}){if(!t)return{width:0,height:0};const s=cf({text:t,fontFamily:e.fontFamily||i.fontFamily||tM,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 CM(t,e="type"){var i,s;return p(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 BM(t){var e,i;return u(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,e="type"){const i=CM(t,e);return"rich"===i?of.richtext(BM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),of.text(t))}function EM(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 RM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function OM(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 IM(t,e){const{dx:i,dy:s}=OM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function LM(){RA(),NA(),$A(),UA(),qA()}var DM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=DM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new zl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},FM.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))}}FM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const zM={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}},jM={poptip:z({},zM)};var HM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Ut(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Ut(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Dt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Dt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Dt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}XM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let KM=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,XM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new XM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,jM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};KM=$M([Ua()],KM);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};class ZM{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 JM=class extends ZM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};JM=qM([Ua()],JM);let QM=class extends ZM{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)}};QM=qM([Ua()],QM);const tw=new Ea(((t,e,i,s)=>{i(KM)||(t(KM).toSelf().inSingletonScope(),t(rg).toService(KM)),i(JM)||(t(JM).toSelf(),t(zv).toService(JM)),i(QM)||(t(QM).toSelf(),t(zv).toService(QM))}));class ew extends $y{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}RA(),DA();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iw.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})}}iw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},RA(),NA();class sw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sw.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})}}sw.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},RA(),AA();class nw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nw.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=se.distancePP(t,e);this.setAttribute("radius",i)}}nw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},RA(),AA();class rw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rw.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=JA,endAngle:s=QA}=this.attribute,n=s-i,r=re(he(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}rw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},RA(),zA();class aw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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=oe(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=se.distancePP(t,e);this.setAttribute("radius",i)}}function ow(){RA(),DA(),HA(),$A()}function lw(){RA(),DA(),AA(),$A()}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ow();class hw extends $y{getStartAngle(){return ce(this._startAngle)}getEndAngle(){return ce(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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(k(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=of.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),P(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=of.line;G(i)[0].cornerRadius&&(t=of.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=of.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}hw.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}}},lw();class cw extends hw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=of.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var dw,uw;!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"}(dw||(dw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uw||(uw={}));const pw={[uw.selectedReverse]:{},[uw.selected]:{},[uw.hover]:{},[uw.hoverReverse]:{}},gw={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}}},fw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const mw=Math.sin(Math.PI/10);function vw(t,e=mw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function _w(t,e=mw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function yw(t){const e={};return uM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function bw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function xw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return kM(r,(s?-1:1)*(n?-1:1)*t/AM(r))}function Sw(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 Aw(t,e,i){var s;if(_w(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Le(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Le(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>De(n,r)}function Mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(eM.hover,!0),uM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(eM.hoverReverse,!0)})),s):i},Tw=(t,e,i)=>i?(uM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(eM.hoverReverse),t.removeState(eM.hover))})),null):i,Cw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(eM.selected)?(uM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(eM.selectedReverse),t.removeState(eM.selected))})),null):s.name&&!P(s.states)?(s.addState(eM.selected,!0),uM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(eM.selectedReverse,!0)})),s):i};class Bw extends $y{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Pw={type:"default",duration:300,easing:"linear"};class Ew extends Bw{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=Tw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Cw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=of.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._prepare(),this._prevInnerView=this._innerView&&yw(this._innerView),this.removeAllChild(!0),this._innerView=of.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Pw)}_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=of.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=dw.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=of.group({x:0,y:0,pickable:!1});t.name=dw.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=of.group({x:0,y:0,pickable:!1});i.name=dw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=of.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=dw.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=iM;else{const t=this.data[s],e=z({},iM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=of.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=dw.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=iM;else{const i=z({},iM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=of.group({x:0,y:0,pickable:!1});return r.name=`${dw.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=dw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=iM;else{const s=z({},iM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new FM(Object.assign({},e));i.name=dw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return bw(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&&c(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;Ht(s[0])>Ht(s[1])?o=Dt/2*(l.x>e.x?1:-1):h=Dt/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+E(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+E(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:_}=this.attribute.label;_=c(_)?z({},gw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d: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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},uM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Rw={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&&Aw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Ow(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Iw(t,e,i,s,n=!1){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=c(n)?n:Rw[n]||Rw.parity;if(s.length>=3&&Mw(s,r)){do{s=a(s,r)}while(s.length>=3&&Mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Aw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Iw(l,s,n,(t=>Aw(t,l,r))),Iw(h,s,o,(t=>Aw(t,h,r)||!(!n||t===l)&&Aw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Dw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},jw(t,e.attribute.angle)),{angle:zw(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({},Hw(t,e.attribute.angle)),{angle:zw(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=ke({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 zw(t=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 jw(t,e=0){let 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=zw(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 Hw(t,e=0){let 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=zw(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 Vw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=_w(h),m=vw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);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(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(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 Nw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Ww{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=AM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return kM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Uw{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-Uw.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Uw.bounceIn(2*t):.5*Uw.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*jt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/jt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*jt/e)*.5+1}}static registerFunc(t,e){Uw[t]=e}}function Gw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Uw.quadIn=Uw.getPowIn(2),Uw.quadOut=Uw.getPowOut(2),Uw.quadInOut=Uw.getPowInOut(2),Uw.cubicIn=Uw.getPowIn(3),Uw.cubicOut=Uw.getPowOut(3),Uw.cubicInOut=Uw.getPowInOut(3),Uw.quartIn=Uw.getPowIn(4),Uw.quartOut=Uw.getPowOut(4),Uw.quartInOut=Uw.getPowInOut(4),Uw.quintIn=Uw.getPowIn(5),Uw.quintOut=Uw.getPowOut(5),Uw.quintInOut=Uw.getPowInOut(5),Uw.backIn=Uw.getBackIn(1.7),Uw.backOut=Uw.getBackOut(1.7),Uw.backInOut=Uw.getBackInOut(1.7),Uw.elasticIn=Uw.getElasticIn(1,.3),Uw.elasticOut=Uw.getElasticOut(1,.3),Uw.elasticInOut=Uw.getElasticInOut(1,.3*1.5),Uw.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Uw.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Uw.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Uw[`flicker${t}`]=e=>Gw(e,t);for(let t=2;t<10;t++)Uw[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Yw(t,e,i){return t+(e-t)*i}const Xw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Yw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Yw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Yw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Yw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Yw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Yw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Yw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Yw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Yw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=op(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?hp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=op(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?hp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Yw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Yw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Yw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Yw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Yw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Yw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Yw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Yw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Yw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=qc(e,i,s),r.addUpdateBoundTag()}}};function $w(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Uw[s])&&void 0!==n?n:Uw.linear:Uw.linear,"wait"===t&&(this.onUpdate=Kw),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=Kw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=rp.Get(i,np.Color255),r=rp.Get(s,np.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Xw["fill"===e?"fillPure":"strokePure"])}else Xw[e]?t.push(Xw[e]):t.push($w)}else Xw[e]?t.push(Xw[e]):t.push($w)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Zw extends qw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Jw extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bo.END?this.removeAnimate(t,!0):t.status!==Bo.RUNNING&&t.status!==Bo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const Qw=new Jw;Qw.isGlobal=!0;class tT{constructor(t=Pa.GenAutoIncrementId(),e=Qw,i){this.id=t,this.status=Bo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new qw(Co.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Zw(Co.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new qw(Co.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bo.RUNNING&&(this.status=Bo.PAUSED)}resume(){this.status===Bo.PAUSED&&(this.status=Bo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Bo.END&&this.onEnd(),this.status=Bo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Bo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Bo.END);this.status=Bo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const eT=new yo;class iT{constructor(){this.released=!1}tick(t,e){eT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class sT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===To.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=To.INITIAL,vo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),vo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new iT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==To.INITIAL&&(this.status=To.PAUSE,!0)}resume(){return this.status!==To.INITIAL&&(this.status=To.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===To.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===To.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=To.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=To.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===To.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===To.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}aT.getInstance();class oT{static registerBuiltInAnimate(t,e){oT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:oT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&c(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+d:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:oT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&c(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+d+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=d*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const P=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,E=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;E&&R&&(i=null!==(h=E[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+P;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_;if(e&&i){const d=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=c(h)?h.call(null,null!==(m=d&&(null===(f=d.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,d):h;d.options=y,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:oT.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}oT.builtInAnimateMap={};const lT="appear",hT="disappear",cT="update",dT="highlight",uT="unhighlight";class pT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class gT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=aT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new oT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new oT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([lT],[{name:lT,animation:t}],e)}applyDisappearState(t,e){this.applyState([hT],[{name:hT,animation:t}],e)}applyUpdateState(t,e){this.applyState([cT],[{name:cT,animation:t}],e)}applyHighlightState(t,e){this.applyState([dT],[{name:dT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([uT],[{name:uT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class fT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new gT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new pT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new fT)._getAnimationStateManager(t),t}}class mT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new tT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:Qw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new Jw}createTicker(t){return new sT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new oT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function vT(){U(Ap,fT),U(Ap,mT)}class _T extends qw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class yT extends _T{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class bT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new oT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function xT(t){return new bT(t)}class ST extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kT=1e3,AT="quadInOut",MT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],wT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=op(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},TT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?K_(t):[],n=K_(e);i&&s&&(i.fromTransform&&q_(s,i.fromTransform.clone().getInverse()),q_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},BT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],PT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!BT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?rp.Get(t,np.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class ET extends _T{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;TT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&wT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const RT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=CT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=PT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new ET({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:AT);return c.play(d),c};class OT extends _T{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;TT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&wT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const IT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MT.includes(t))(i)||(e[i]=t[i])})),e},LT=(t,e,i)=>{const s=IT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=vo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},DT=(t,e,i)=>{const s=[],n=i?null:IT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:IT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Tg(t.attribute),n=J_(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(vo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=J_(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=J_(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return Q_(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Q_(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(vo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ty(i)}];const s=[];return iy(i,e,s),s})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return iy(l,e,h),h})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=K_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(vo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&<(t,s,e),s};class zT extends _T{constructor(t,e,i,s,n){super(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(){super.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:Uo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Uo.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:Uo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class jT extends zT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=vo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 HT extends zT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=vo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class VT extends _T{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ie(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Kc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class NT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UT extends NT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class GT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class YT extends NT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class XT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const $T=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class KT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qT extends KT{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$T(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class ZT extends KT{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class JT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Kc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class xC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class SC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class kC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class AC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends AC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class wC extends AC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class TC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class CC extends TC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class BC extends TC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class PC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class EC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=vo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new zl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=vo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=nl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=nl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=of.group({zIndex:999});e.name=dw.axisBreak,e.id=this._getNodeId(`${dw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},fw,s),a=null!==(e=r.size)&&void 0!==e?e:fw.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=of.symbol(Object.assign({x:s.x,y:s.y},o));l.name=dw.axisBreakSymbol;const h=of.symbol(Object.assign({x:n.x,y:n.y},o));h.name=dw.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=of.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=dw.background,n.id=this._getNodeId("background"),n.states=z({},pw,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=LC(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];P(l)||(c.state={line:z({},pw,l),symbol:z({},pw,l)});const d=new hw(c);d.name=dw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return dt(t[0],0)?dt(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:u}=s,p=LC(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),_=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=+E(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=MM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),w=this.getTextBaseline(A,!1);let C=u;if(d(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},pw,c.text),shape:z({},pw,c.shape),panel:z({},pw,c.background)}});return B.angle=T,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return dt(t[1],0)?i=!dt(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 jw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Hw(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(P(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=ne(e)})),Fw(i,t),!Dw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=_w(a),l=vw(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=Nw(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);k(i)&&(c=Ut(c,i))}}else{if(l){const i=Nw(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);k(i)&&(c=Ut(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&&k(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);Vw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&Lw(t,{orient:o,method:m,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(k(c)&&(!k(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=of.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=dw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(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=TM(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=si(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}}DC.defaultAttributes=gw,U(DC,Ww);class FC{isInValidValue(t){const{startAngle:e=JA,endAngle:i=QA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=JA,endAngle:i=QA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return oe(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return xw(t,i,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 zC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=zC(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 VC=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),k(l)&&l>=3){const t=Sw(n,l,c,e,i);h=of.path(Object.assign(Object.assign({},a.style),{path:kw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=of.circle(t)}h.name=dw.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=z({},pw,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:u={}}=a,p=VC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=E(this.attribute.label,"style.fontSize",12)+E(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},pw,u.text),shape:z({},pw,u.shape),panel:z({},pw,u.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(dt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=zC(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&&jC(e,c,i)}else e.AABBBounds.width()>r&&jC(e,r,i)}else o>a.x&&h.x2>n.x2?(jC(e,n.x2-o,i),r&&HC(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return dt(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}}NC.defaultAttributes=gw,U(NC,FC);const WC=t=>t.map(((t,e)=>({index:e,value:t}))),UC=(t,e,i=0)=>{const s=new je(t).expand(i/2),n=new je(e).expand(i/2);return s.intersects(n)},GC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ne(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=wM(a),_=t.range();let y=[];for(let i=0;i{$C[t]=!0}));const QC=t=>-Math.log(-t),tB=t=>-Math.exp(-t),eB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,iB=t=>10===t?eB:t===Math.E?Math.exp:e=>Math.pow(t,e),sB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),nB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),rB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function aB(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 oB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function lB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function hB(t,e,i,s){return 1===i&&(i=0),lB(t,i,s)*(e/(1-i))}function cB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function dB(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]{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 pB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=cB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 gB=Symbol("implicit");class fB extends pB{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=XC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=gB}clone(){const t=(new fB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==gB)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 mB(t,e,r,n)}class _B extends fB{constructor(t){super(),this.type=XC.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=hB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:vB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return vB(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=vt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new _B(!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:yB}=ii;function bB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return xt(t,e);if("string"===i){if(s=Qe.parseColorString(e)){const e=yB(Qe.parseColorString(t),s);return t=>e(t).formatRgb()}return xt(Number(t),Number(e))}return e instanceof ti?yB(t,e):e instanceof Qe?yB(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):xt(Number(t),Number(e))}class xB extends pB{constructor(t=JC,e=JC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=JC,this._piecewise=oB,this._interpolate=bB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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),xt)),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,tt);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=St,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=vt(i[0],i[r-1])),this._piecewise=r>2?dB:oB,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:JC),this.rescale(i)):this._clamp!==JC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const SB=Math.sqrt(50),kB=Math.sqrt(10),AB=Math.sqrt(2),MB=[1,2,5,10],wB=(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=PB(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)),J(0,e).map((t=>n+t*s))):t>0?CB(0,-(e-1)/s,s):CB((e-1)/s,0,s)},TB=gt(((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 wB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return wB(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=CB(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=CB(t,e,l);return n&&r.reverse(),r})),PB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=MB[0];return i>=SB?s=MB[3]:i>=kB?s=MB[2]:i>=AB&&(s=MB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function EB(t,e,i){const s=(e-t)/Math.max(0,i);return PB(s)}function RB(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;e0;){if(s=EB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function IB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const LB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),DB=gt(((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})),FB=gt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=BB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?LB(t,e,n):LB(t,e,uB(n)),h=LB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),zB=gt(((t,e,i,s,n)=>RB(s(t),s(e),i).map((t=>uB(n(t))))));class jB extends xB{constructor(){super(...arguments),this.type=XC.Linear}clone(){var t;const e=new jB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return TB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=BB(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(t=10){const e=this.calculateVisibleDomain(this._range);return RB(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 VB(t){return e=>-t(-e)}function NB(t=Number.EPSILON){return e=>Math.max(e,t)}class WB extends xB{constructor(){super(sB(10),iB(10)),this.type=XC.Log,this._limit=NB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new WB).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=sB(this._base),s=iB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=VB(i),this._pows=VB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=QC,this.untransformer=tB):(this._logs=i,this._pows=s,this._limit=NB(),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 JC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return DB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return zB(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(WB,HB);class UB extends jB{constructor(){super(nB(1),rB(1)),this.type=XC.Symlog,this._const=1}clone(){return(new UB).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=nB(t),this.untransformer=rB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return DB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(UB,HB);class GB{constructor(){this.type=XC.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!d(t)&&k(+t)?this._range[rt(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 GB).domain(this._domain).range(this._range).unknown(this._unknown)}}function YB(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 XB(t,e,i,s,n=!1){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,n,r;if(!KC(t.type))return WC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return WC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=YB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=YB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=YB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=YC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=YC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?KB.greedy:KB.parity;for(;l.length>=3&&Mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Aw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),XB(t,l,a,(e=>Aw(e,t,i))),XB(n,l,o,(e=>Aw(e,n,i)||!(!a||e===t)&&Aw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return WC(m)},KB={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Aw(i,t,e)||(i=t,0))))}},qB=(t,e,i,s)=>{const n=YC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},ZB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,JB=(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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?WC([s[s.length-1]]):WC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=qB(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=tP(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=qB(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!ZB(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?JB(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=wM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=oe({x:0,y:0},i,t),a=bw(r,xw(s,r,e,n));return o=a,l=xw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(dt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 WC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=eP(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=sP(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return WC(d)},sP=(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&&UC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},nP=new Uint32Array(33),rP=new Uint32Array(33);rP[0]=0,nP[0]=~rP[0];for(let t=1;t<=32;++t)rP[t]=rP[t-1]<<1|1,nP[t]=~rP[t];function aP(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&nP[31&o]&rP[1+(31&l)])return!0}else{if(i[h]&nP[31&o])return!0;if(i[c]&rP[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,nP[31&o]&rP[1+(31&l)]);else for(s(h,nP[31&o]),s(c,rP[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,rP[31&a]|nP[1+(31&o)]);else for(n(l,rP[31&a]),n(h,nP[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 oP(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ft(i,-o,t.width+l),d=ft(s,-o,t.width+l),u=ft(n,-a,t.height+h),p=ft(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function lP(t,e,i=!1){return i?oP(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function hP(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=lP(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=oP(t,r)),e.getRange(r)))}function cP(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>u(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return cP(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return cP(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return cP(t,e,n,s,h,d)}return!1}const uP=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],pP=["top","inside-top","inside"];function gP(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const fP={mode:"same-time",duration:300,easing:"linear"};function mP(t){return 3===t||4===t}function vP(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 _P=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 yP(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)}}var bP=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const kP=(t,e)=>Math.ceil(t)>Math.floor(e),AP=([t,e],[i,s])=>s>t&&e>i;function MP(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 wP=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||P(e.states)||(e.addState(eM.hover,!0),uM(this,(t=>{t===e||P(t.states)||t.addState(eM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(uM(this,(t=>{P(t.states)||(t.removeState(eM.hoverReverse),t.removeState(eM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void uM(this,(t=>{P(t.states)||(t.removeState(eM.selectedReverse),t.removeState(eM.selected))}));P(e.states)||(e.addState(eM.selected,!0),uM(this,(t=>{t===e||P(t.states)||t.addState(eM.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)===Uo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Uo.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(be(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[yP(g,f,c,d,a,o),yP(-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=of.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new zl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),c(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(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=c(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&kP(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&kP(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(dt(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(MP([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])&&!AP([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 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},h),{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(lP(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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(lP(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(lP(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{CP[t]=e};var PP=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{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,i,s)}}EP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const RP=()=>{BP("symbol",EP),BP("line-data",EP)};var OP=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{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}}}IP.tag="rect-label",IP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var LP=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};DP.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FP=()=>{BP("line",DP),BP("area",DP)};var zP=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=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ue(h.endAngle-d/2),g=oe(c,h.outerRadius,o),f=oe(c,a+e.line.line1MinLength,o),m=new jP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=oe(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):mP(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=oe(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ut(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=mP(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=mP(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&&(pt(t.pointB.x,this._line2MinLength+h)||ut(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=mP(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?d(h)||"auto"===h?"edge"===c?mP(t.quadrant)?"left":"right":mP(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(mP(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(dt(l/2,u))g=0,f=1,m=-p;else if(dt(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?dt(v[0].y,v[1].y)?ut(t.middleAngle,-Math.PI)&&pt(t.middleAngle,0)||ut(t.middleAngle,Math.PI)&&pt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 WP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=se.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 UP(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=kw(t,!!n),o=kw(r,!!n);const h=se.distancePP(s,l),c=se.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=WP(e,t,!1,!!n),o=WP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=kw(t,!!n),o=kw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}NP.defaultAttributes={pickable:!1};class GP extends $y{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&yw(this._innerView),this.removeAllChild(!0),this._innerView=of.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 bw(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?`${dw.grid}-sub`:`${dw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=kw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=WP(t,o,!1,!!a)}const u=of.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:GP.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=kw(o,!!a),m=Ht(o[0].x-o[1].x),v=Ht(o[0].y-o[1].y),_=of.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Dt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:GP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),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=!dt(a.value,0)&&!dt(l.value,0),d=!dt(a.value,1)&&!dt(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}}GP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},RA(),zA();class YP extends GP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GP.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=JA,endAngle:r=QA}=this.attribute;i=Sw(t,s,se.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(YP,Ww);var XP=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($P,FC);const KP="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",qP={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:KP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:KP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},ZP={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 JP;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(JP||(JP={}));var QP=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=JP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=JP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=JP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=JP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=JP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=rM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===JP.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===JP.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=JP.endHandler):h+=l:this._activeTag===JP.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===JP.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===__.env?__:this.stage,e=rM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===JP.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===JP.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=QP(c,["formatMethod"]),{formatMethod:g}=d,f=QP(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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+m*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==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*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==f?void 0:f.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({},f,{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 ze).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:W}=this.attribute,{start:U,end:G}=this.state,{position:Y,width:X,height:$}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:X,height:$,cursor:N?"crosshair":"auto"},L),{pickable:!W&&(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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y,width:(G-U)*X,height:$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(r=z.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+U*$,width:X,height:(G-U)*$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y-t,width:(G-U)*X,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!W&&(null===(p=null===(u=null===(d=j.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+(U+G)/2*X,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!W&&(null===(m=j.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*X,y:Y.y+$/2,size:$,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},ZP.horizontal),H),{pickable:!W&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*X,y:Y.y+$/2,size:$,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},ZP.horizontal),V),{pickable:!W&&(null===(b=V.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+U*X-t/2,y:Y.y+$/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},ZP.horizontal),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*X-i/2,y:Y.y+$/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},ZP.horizontal),{pickable:!W}),"rect")}else{if(j.visible){const t=(null===(x=j.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+X,y:Y.y+U*$,width:t,height:(G-U)*$},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!W&&(null===(M=null===(A=null===(k=j.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+X+t/2,y:Y.y+(U+G)/2*$,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=j.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},j.icon),{pickable:!W&&(null===(B=null===(C=j.icon)||void 0===C?void 0:C.pickable)||void 0===B||B)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+U*$,size:X,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},ZP.vertical),H),{pickable:!W&&(null===(E=H.pickable)||void 0===E||E)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+G*$,size:X,symbolType:null!==(R=V.symbolType)&&void 0!==R?R:"square"},ZP.vertical),V),{pickable:!W&&(null===(O=V.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+X/2+t/2,y:Y.y+U*$-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},ZP.vertical),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+X/2+i/2,y:Y.y+G*$-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},ZP.vertical),{pickable:!W}),"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 FM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;u(t)&&u(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,...G(a))}setPreviewPointsX(t){c(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._statePointToData=t)}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var iE,sE,nE,rE;function aE(){RA(),LM(),vT()}eE.defaultAttributes=qP,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"}(iE||(iE={})),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"}(sE||(sE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(nE||(nE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(rE||(rE={}));class oE extends $y{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Tw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Cw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=of.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=of.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=of.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 lE(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 hE(t,e,i,s){t&&(lE(t.startSymbol,e,i,s),t.lines.forEach((t=>lE(t,e,i,s))),lE(t.line,e,i,s),lE(t.endSymbol,e,i,s))}function cE(t,e,i,s){t&&(lE(t.getTextShape(),e,i,s),lE(t.getBgRect(),e,i,s))}function dE(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 uE(t,e,i,s){t&&(dE(t.startSymbol,e,i,s),t.lines.forEach((t=>dE(t,e,i,s))),dE(t.line,e,i,s),dE(t.endSymbol,e,i,s))}function pE(t,e,i,s){t&&(dE(t.getTextShape(),e,i,s),dE(t.getBgRect(),e,i,s))}function gE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;lE(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)})),lE(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;lE(t.getTextShape(),e,l,n),lE(t.getBgRect(),e,l,n)}))}function fE(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function mE(t,e,i,s,n){lE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function vE(t,e,i,s,n){lE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function _E(t,e,i,s,n,r){var a;hE(t,n,s,r),lE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cE(i,n,s,r):lE(i,n,s,r)}function yE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;lE(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)})),lE(e,n+o+l,h,r),lE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(lE(i.getTextShape(),n+o+l+h+c,d,r),lE(i.getBgRect(),n+o+l+c,d,r)):lE(i,n+o+l+c,d,r)}function bE(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?gE(t,e,s,r,a):"fadeIn"===i&&fE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?gE(t,e,s,n,a):"fadeIn"===i&&fE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function xE(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&&mE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&mE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){dE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function SE(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&&vE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&vE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){dE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function kE(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?_E(n,r,e,i,s,o):"callIn"===t&&yE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?_E(n,r,e,i,s,a):"callIn"===t&&yE(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;uE(t,n,s,r),dE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?pE(i,n,s,r):dE(i,n,s,r)}(n,r,e,t,i,s)}}const AE={type:"clipIn",duration:500,easing:"linear",delay:0},ME={type:"fadeIn",duration:500,easing:"linear",delay:0},wE={type:"callIn",duration:500,easing:"linear",delay:0},TE={type:"fadeOut",duration:500,easing:"linear",delay:0};class CE{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new FM(Object.assign(Object.assign({},h),{state:{panel:z({},iM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},iM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},iM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},iM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class BE extends oE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=AE,this.defaultExitAnimation=TE}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;IM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(BE,CE);const PE=.001,EE={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:iE.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]}},RE={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"}}},OE={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:{autoRotate:!0,position:nE.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]}},IE={interactive:!0,label:{position:sE.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}},LE={interactive:!0,label:{autoRotate:!0,position:nE.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}},DE={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"}},FE={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"}},zE={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 jE(){HE._animate=bE}aE(),ow(),vT();class HE extends BE{markerAnimate(t){HE._animate&&this._animationConfig&&HE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(gM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return fM(Math.abs(e),Math.PI/2,PE)||fM(Math.abs(e),3*Math.PI/2,PE)?mM(i,e,t):gM(e)?RE.postiveXAxis[t]:RE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new hw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},iM,null==a?void 0:a.line),startSymbol:z({},iM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},iM,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({},iM,null==a?void 0:a.line),startSymbol:z({},iM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},iM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HE.defaultAttributes.label)}}function VE(){NE._animate=xE}HE.defaultAttributes=EE,aE(),HA(),vT();class NE extends oE{markerAnimate(t){NE._animate&&this._animationConfig&&NE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=TE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},FE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;IM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=of.polygon(Object.assign({points:e},i));n.states=z({},iM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",NE.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},iM,null==i?void 0:i.area)),this._updateMarkLabels(NE.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}NE.defaultAttributes=IE,U(NE,CE),aE(),lw(),vT();class WE extends BE{markerAnimate(t){WE._animate&&this._animationConfig&&WE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WE.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case nE.arcInnerStart:l=n;case nE.arcOuterStart:l=n;break;case nE.arcInnerEnd:l=r;case nE.arcOuterEnd:l=r;break;case nE.center:case nE.arcInnerMiddle:case nE.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return DE[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new cw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},iM,null==o?void 0:o.line),startSymbol:z({},iM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},iM,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({},iM,null==o?void 0:o.line),startSymbol:z({},iM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},iM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",WE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(WE.defaultAttributes.label)}}WE.defaultAttributes=OE,aE(),AA(),vT();class UE extends oE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=TE}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case nE.center:h=(s+n)/2,c=(r+a)/2;break;case nE.arcInnerStart:h=s,c=r;break;case nE.arcOuterStart:h=n,c=r;break;case nE.arcInnerEnd:h=s,c=a;break;case nE.arcOuterEnd:h=n,c=a;break;case nE.arcInnerMiddle:h=s,c=(r+a)/2;break;case nE.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},DE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;IM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=of.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},iM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",UE.defaultAttributes.label)}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({},iM,null==o?void 0:o.area)),this._updateMarkLabels(UE.defaultAttributes.label)}isValidPoints(){return!0}}function GE(){YE._animate=kE}UE.defaultAttributes=LE,U(UE,CE),aE(),ow(),lw(),$A(),IA(),DA(),vT();class YE extends oE{markerAnimate(t){YE._animate&&this._animationConfig&&YE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},YE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=TE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return fM(Math.abs(s),Math.PI/2,PE)||fM(Math.abs(s),3*Math.PI/2,PE)?mM(t,s,n):gM(s)?zE.postiveXAxis[n]:zE.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,style:d,position:u=rE.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},iM,null==p?void 0:p.textBackground),text:z({},iM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},iM,null==p?void 0:p.itemContent));const v=gM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=of.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"text"===n?o=new FM(Object.assign(Object.assign({},i),{state:{panel:z({},iM,null==s?void 0:s.textBackground),text:z({},iM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=of.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"image"===n?(o=of.image(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},iM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=fM(c,0,PE)||fM(d,0,PE),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=RM(e-u,t-d),o=RM(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(eR.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(eR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===eR.focus||"focus"===o){const s=a.hasState(QE.focus);a.toggleState(QE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[QE.unSelected,QE.unSelectedHover,QE.focus],t),this._setLegendItemState(e,QE.selected,t)})):(this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[QE.selected,QE.selectedHover,QE.focus],t),this._setLegendItemState(e,QE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(QE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(QE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(tR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[QE.selected,QE.selectedHover],t),this._setLegendItemState(a,QE.unSelected,t)):(this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t))}else this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[QE.selected,QE.selectedHover],t),this._setLegendItemState(e,QE.unSelected,t))}))}this._dispatchLegendEvent(tR.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,QE.selected),this._removeLegendItemState(e,[QE.unSelected,QE.unSelectedHover])):(this._removeLegendItemState(e,[QE.selected,QE.selectedHover]),this._setLegendItemState(e,QE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=qE,spaceRow:l=ZE,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=of.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+E(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";p(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";p(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:p,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),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=si(c);let T;!1===x.visible?(T=of.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,eR.item,t,T)):(T=of.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,eR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?QE.selected:QE.unSelected);const C=of.group({x:0,y:0,pickable:!1});T.add(C);let B,P=0,R=0,O=0;if(v&&!1!==v.visible){const i=E(S,"style.size",10);R=_(i)?i[0]||0:i,O=E(v,"space",8);const s=of.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,eR.itemShape,t,T,S.state),s.addState(e?QE.selected:QE.unSelected),C.add(s)}let I=0;if(p){const e=E(g,"size",10);B=of.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,eR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=PM(Object.assign(Object.assign({x:R/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:y.formatMethod?o:void 0}));this._appendDataToShape(D,eR.itemLabel,t,T,k.state),D.addState(e?QE.selected:QE.unSelected),C.add(D);const F=E(y,"space",8);if(u(l)){const s=E(b,"space",p?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,eR.itemValue,t,T,A.state),r.addState(e?QE.selected:QE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/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]-R-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",P),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.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 KE(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 KE(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 oM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new oM(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",bt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+E(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=qE,spaceRow:o=ZE}=n,l=this._itemsContainer,{space:h=JE,defaultCurrent:c=1}=r,d=rR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=of.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+E(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=qE,spaceRow:a=ZE}=s,o=this._itemsContainer,{space:l=JE,defaultCurrent:h=1}=n,c=rR(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 _=of.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=of.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=[];dt(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),dt(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(QE.selected)?this._setLegendItemState(t,QE.selectedHover,e):this._setLegendItemState(t,QE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===eR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(tR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(QE.unSelectedHover)||t.hasState(QE.selectedHover))&&(i=!0),t.removeState(QE.unSelectedHover),t.removeState(QE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(QE.unSelectedHover)&&!t.hasState(QE.selectedHover)||(i=!0),t.removeState(QE.unSelectedHover),t.removeState(QE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===eR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(tR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(tR.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!==eR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(tR.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!==eR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(tR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(QE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},aR,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(QE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(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 lR;function hR(t){return _(t)?t:[t,t]}function cR(t){return t?"ew-resize":"ns-resize"}oR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:qE,spaceRow:ZE,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:JE,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"}(lR||(lR={})),sR();class dR extends $y{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({},dR.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=rM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=rM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:hR(p)[0],endValue:hR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=of.group({x:0,y:0});f.name=lR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=of.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)),m.name=lR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=of.group({x:g?v:0,y:g?0:v});f.add(_);const y=of.group({x:0,y:0});let b;if(y.name=lR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=of.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=lR.endText,f.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=of.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=lR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=hR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":cR(p)},r));if(v.name=lR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=lR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":cR(p)},r));if(i.name=lR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=lR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=mt(h,i,s);c=t[0],u=t[1]}else c=i,u=ft(h,i,s);const g=this._isHorizontal;e||(c=i);const f=of.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=lR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":cR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=of.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=lR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return of.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":cR(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),of.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=of.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=of.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=rM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===lR.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===lR.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===lR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===lR.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}}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}dR.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}}},nR(),sR();class uR extends iR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function pR(t="bottom"){let 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`}uR.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"}}},nR(),sR(),zA();class gR extends iR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=of.group({x:0,y:0});this._innerView.add(x);const S=new dR({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:pR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=of.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+E(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))}}gR.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)"}},RA(),qA(),UA();let fR=class t extends $y{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:P,maxWidth:E,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=si(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},sM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},sM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(P)&&UE&&(U=E),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};fR.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 mR={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"}}};RA(),qA(),UA();let vR=class extends $y{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},E(mR,n),e.style,{visible:e.visible});a.lineHeight=u(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&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(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 p=TM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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",u(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;G(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 _R extends Sg{constructor(t){super(t)}}var yR,bR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(yR||(yR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(bR||(bR={}));class xR extends $y{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xR.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"},xR.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"},xR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},xR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},xR.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=()=>{d(this._playController)&&(this._playController=new _R(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new _R(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new _R(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(yR.OnPlay)},this.pause=()=>{this._dispatchEvent(yR.OnPause)},this.forward=()=>{this._dispatchEvent(yR.OnForward)},this.backward=()=>{this._dispatchEvent(yR.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()}}xR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},xR.defaultAttributes={[bR.Start]:{},[bR.Pause]:{},[bR.Backward]:{},[bR.Forward]:{}};const SR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},kR=[200,10];var AR,MR;!function(t){t.Default="default",t.Reverse="reverse"}(AR||(AR={})),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"}(MR||(MR={}));const wR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===AR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===AR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),TR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===AR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===AR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),CR=t=>"top"===t||"bottom"===t;class BR extends $y{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BR.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(CR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:kR[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:kR[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 dR(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=CR(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 xR(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=CR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:kR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(CR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:CR(this._orient)?t+s:(this._size.width-r)/2,y:CR(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:CR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:CR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:CR(this._orient)?t+s:(this._size.width-r)/2,y:CR(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 PR(){sR(),RA(),$A()}BR.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({},SR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},SR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},SR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},SR),{key:"backward",position:"start"})}},PR();class ER extends BR{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:AR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(yR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(yR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(yR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(yR.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(MR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||TR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===AR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(MR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(MR.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(MR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(MR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.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(MR.change),this.dispatchCustomEvent(MR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var RR,OR=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())}))};PR();class IR extends BR{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(yR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(yR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(yR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(yR.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(MR.change))},this.play=()=>OR(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(MR.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.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(MR.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(MR.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.brushActive="brushActive",t.brushClear="brushClear"}(RR||(RR={}));const LR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},DR=5;const FR={debounce:yt,throttle:bt};RA(),HA();let zR=class t extends $y{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=LR.updateTrigger,endTrigger:i=LR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:FR[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LR.trigger,resetTrigger:e=LR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(RR.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(RR.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=DR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(RR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(RR.brushActive,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._dispatchBrushEvent(RR.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=DR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LR.updateTrigger,endTrigger:e=LR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=of.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};zR.defaultAttributes=LR;const jR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},HR=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}},VR={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:tM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:tM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:tM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new je).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},NR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];RA(),NA(),$A(),qA(),UA();let WR=class t extends $y{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=si(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:pM(p)&&pM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:pM(p)&&pM(p.value)},HR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:pM(p)&&pM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:pM(p)&&pM(p.value)},HR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},sM),p.value),visible:pM(p)&&pM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=pM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=pM(p)?p.height+p.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(!pM(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 p="right"===c?(o?d:0)+(pM(n.key)?r+n.key.spacing:0)+(pM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(EM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:pM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),EM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(pM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=td(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(pM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},HR(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},HR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},sM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(pM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},HR(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},HR(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=>NR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&pM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=pM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=wM(d),_=wM(u);let y=0;if(pM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(pM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&nu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 jR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return jR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};WR.defaultAttributes=VR;const UR=dt;function GR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function YR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function XR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function $R(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function KR(t,e){const i=$R(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 qR(t,e){const i=ZR(t),s=ZR(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 ZR(t,e={x:0,y:0}){return se.distancePP(t,e)}function JR(t){return k(t.x)&&k(t.y)}function QR(t,e,i){let s=!1;if(e&&c(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 tO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const eO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function sO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&sO(t[i],e)}}var nO,rO,aO;function oO(t){var e,i;const{type:s}=t;return s===rO.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(nO||(nO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(rO||(rO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(aO||(aO={}));const lO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},hO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function cO(t,e){var i;if(!t)return[];const s=vO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?fO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>gO(i)?uO(t,i,e):i)).filter(u)}))):i.map((i=>gO(i)?uO(t,i,e):i)).filter(u):[]}return[]}function dO(t,e){var i,s;return fO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 uO(t,e,i){var s;const n=vO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=lO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=hO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new Qe(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ue(t,i,s),a=We(n,r,e.l),l=new Qe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const pO=(t,e)=>{if(e&&gO(t)){const i=uO(e,t);if(i)return i}return t};function gO(t){return t&&"palette"===t.type&&!!t.key}function fO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function mO(t){return _(t)?{dataScheme:t}:t}function vO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=oO(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 _O extends fB{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(!fO(this._range))return void super.range(this._range);const t=dO(this._range,this._domain);super.range(t)}}const yO={linear:jB,band:_B,point:class extends _B{constructor(t){super(!1),this.type=XC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:fB,threshold:GB,colorOrdinal:_O};function bO(t){const e=yO[t];return e?new e:null}function xO(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 SO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function kO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function AO(t){return!!v(t)&&(!!t.endsWith("%")&&Gy(t.substring(0,t.length-1)))}function MO(t){return!!p(t)&&("percent"in t||"offset"in t)}function wO(t,e,i,s=0){var n,r;return x(t)?t:AO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function TO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=wO(t[s],e.size,i)}))})),o}function CO(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}}function BO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||AO(t)||c(t)||MO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function PO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const EO=(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},RO=[{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"]}];function OO(t,e){return t&&e.key in t?t[e.key]:e.default}function IO(t){return t&&"token"===t.type&&!!t.key}const LO={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%"},DO={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:RO,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"}}},token:LO,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},FO={name:"dark",colorScheme:{default:{dataScheme:RO,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}}}}}},zO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>zO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>zO(t[i],e[i])))),jO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),jO(t[s],e.slice(1),i))},HO=t=>t instanceof Ma||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 VO(t,e=["data"]){return I(t,HO,e)}function NO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=mO(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)})}WO._charts={},WO._series={},WO._components={},WO._graphicComponents={},WO._marks={},WO._regions={},WO._animations={},WO._implements={},WO._chartPlugin={},WO._vChartPlugin={},WO._componentPlugin={},WO.transforms={fields:Ur,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}},WO.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Jr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=zr(ta,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return Zr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t))},WO._layout={},WO._grammarTransforms={},WO._stageEventPlugins={},WO.registerStageEventPlugin=(t,e)=>{WO._stageEventPlugins[t]=e},WO.getStageEventPlugin=t=>WO._stageEventPlugins[t],WO._interactionTriggers={},WO.registerInteractionTrigger=(t,e)=>{WO._interactionTriggers[t]=e},WO._composedEventMap={},WO.registerComposedEvent=(t,e)=>{WO._composedEventMap[t]=e},WO._tooltipProcessors={},WO.registerTooltipProcessor=(t,e)=>{WO._tooltipProcessors[t]=e},WO.createTooltipProcessor=(t,e)=>{const i=WO._tooltipProcessors[t];return i?new i(e):null};const YO=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},XO=YO(),$O={[DO.name]:DO},KO=DO.name,qO=new Map(Object.keys($O).map((t=>[t,$O[t]]))),ZO=new Map,JO=new Map(Object.keys($O).map((t=>[t,t===KO]))),QO=(t,e)=>{if(!t)return;const i=sI(e);qO.set(t,i),JO.set(t,!0)},tI=(t=KO)=>(JO.has(t)&&!JO.get(t)&&QO(t,qO.get(t)),qO.get(t)),eI=t=>qO.delete(t)&&ZO.delete(t)&&JO.delete(t),iI=t=>!!v(t)&&qO.has(t),sI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:KO;return UO({},tI(i),t)};class nI{static registerInstance(t){nI.instances.set(t.id,t)}static unregisterInstance(t){nI.instances.delete(t.id)}static getInstance(t){return nI.instances.get(t)}static instanceExist(t){return nI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return nI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}nI.instances=new Map;class rI{static registerTheme(t,e){QO(t,e)}static getTheme(t,e=!1){return tI(t)}static removeTheme(t){return eI(t)}static themeExist(t){return iI(t)}static getDefaultTheme(){return rI.themes.get(KO)}static setCurrentTheme(t){rI.themeExist(t)&&(rI._currentThemeName=t,nI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return rI.getTheme(rI._currentThemeName,t)}static getCurrentThemeName(){return rI._currentThemeName}}function aI(t){return v(t)?rI.themeExist(t)?rI.getTheme(t):{}:p(t)?t:{}}rI.themes=qO,rI._currentThemeName=KO;const oI=["animationThreshold","colorScheme","name","padding"];function lI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];oI.includes(n)?s[n]=r:f(r)?gO(r)?s[n]=pO(r,e):IO(r)?s[n]=OO(i,r):s[n]=lI(r,e,i):s[n]=r})),s}function hI(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]=hI(t[s],e)}return i}return _(t)?t.map((t=>hI(t,e))):t}function cI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=cI(t[s],e)}return i}return _(t)?t.map((t=>cI(t,e))):t}const dI=(t,e,i,s)=>((t,e,i)=>wM(t,e,i,{fontFamily:LO.fontFamily,fontSize:LO.fontSize}))(e,i,s).measure(t),uI="__VCHART",pI=500,gI=500,fI=`${uI}_MEASURE_CANVAS_ID`,mI=`${uI}_DEFAULT_DATA_INDEX`,vI=`${uI}_DEFAULT_DATA_KEY`,_I=`${uI}_DEFAULT_DATA_SERIES_FIELD`,yI=`${uI}_DEFAULT_SERIES_STYLE_NAME`,bI=`${uI}_STACK_KEY`,xI=`${uI}_STACK_START`,SI=`${uI}_STACK_END`,kI=`${uI}_STACK_START_PERCENT`,AI=`${uI}_STACK_END_PERCENT`,MI=`${uI}_STACK_START_OffsetSilhouette`,wI=`${uI}_STACK_END_OffsetSilhouette`,TI=`${uI}_STACK_TOTAL`,CI=`${uI}_STACK_TOTAL_PERCENT`,BI=`${uI}_STACK_TOTAL_TOP`,PI=`${uI}_STACK_TOTAL_BOTTOM`,EI=`${uI}_MOSAIC_VALUE_START_PERCENT`,RI=`${uI}_MOSAIC_VALUE_END_PERCENT`,OI=`${uI}_MOSAIC_CAT_START_PERCENT`,II=`${uI}_MOSAIC_CAT_END_PERCENT`,LI=`${uI}_SEGMENT_START`,DI=`${uI}_SEGMENT_END`,FI=`${uI}_KEY`;function zI(t,e){for(let i=0;it.key===e))}function HI(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 VI(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:{}},YI(t,a,n[o],l,e,r))})),s?NI(n):n}function NI(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))):NI(t[e].nodes);return t}function WI(t,e){if("values"in t&&t.values.length){const i=XR(t.values,e),s=YR(t.values,AI);t.values.forEach((t=>{t[TI]=i,t[CI]=s}))}else for(const i in t.nodes)WI(t.nodes[i],e)}function UI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][SI]/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)GI(t.nodes[r],e,i,s,n)}function YI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[SI]=function(t){if(k(t))return t;const e=+t;return k(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},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),YI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const XI=(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]=KI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function qI(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>QI(t.style(e,i,s,n)):P(t.style)||(e.style=QI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>QI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=QI(t.state[e]))})),e.state=i}return e}function ZI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>QI(t[i](e,s,n,r)):P(t[i])||(e[i]=QI(t[i]))})),e}function JI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),QI(i)}function QI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ne(t.angle)}):t}const tL=t=>"line"===t||"area"===t,eL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return tL(i)?e:null==e?void 0:e[0]},iL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let sL=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},n=WO.getComposedEvent(t);if(n){const e=new n(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(WO.getComposedEvent(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()}};var nL;!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"}(nL||(nL={}));const rL=["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 aL,oL,lL;!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.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(aL||(aL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(oL||(oL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(lL||(lL={}));const hL=[lL.mark,lL.model,lL.chart,lL.vchart];class cL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(lL.vchart,[]),this._levelNodes.set(lL.chart,[]),this._levelNodes.set(lL.model,[]),this._levelNodes.set(lL.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 dL={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 uL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=E(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>eL(t)))};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)||oL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||oL.chart);o.get(t)||o.set(t,new cL);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)||oL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||oL.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)||oL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||oL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?hL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[oL.chart,oL.window,oL.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(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&E(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 dL[a]&&(a=dL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?lL.model:lL.vchart:lL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=bt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=yt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=oL.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!==lL.model&&s!==lL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=lL.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 oL.chart:return this._viewBubbles;case oL.window:return this._windowBubbles;case oL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case oL.chart:return this._viewListeners;case oL.window:return this._windowListeners;case oL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return rL.includes(t)||Object.values(nL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&WO.hasInteractionTrigger(e)}}function pL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function gL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const fL=new Map;let mL;function vL(){mL||(mL=new Aa,gL(mL,"geojson",_a),gL(mL,"topojson",ba),pL(mL,"simplify",Nr))}function _L(t,e,i={type:"geojson",centroid:!0}){fL.has(t)&&Ly(`map type of '${t}' already exists, will be overwritten.`),vL();const s=new Ma(mL),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"}):p(r)&&s.transform({type:"simplify",options:r}),fL.set(t,s)}function yL(t){fL.has(t)?fL.delete(t):Ly(`map type of '${t}' does not exists.`)}function bL(t,e=!1){let i=e;return t.latestData instanceof Ma&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const xL=(t,e)=>0===t.length?[]:1===t.length?bL(t[0],null==e?void 0:e.deep):t.map((t=>bL(t,null==e?void 0:e.deep)));function SL(t,e,i){pL(e=e instanceof Aa?e:t.dataSet,"copyDataView",xL);const s=new Ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:ML.copyDataView}),s}function kL(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?I(t.parser):{clone:!0},c=I(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 Ly(`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 Ly(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Ly("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 AL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var ML,wL,TL,CL;!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"}(ML||(ML={})),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"}(wL||(wL={})),function(t){t.data="data",t.mark="mark"}(TL||(TL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(CL||(CL={}));const BL=["line","area","trail"];function PL(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:[FI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const EL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function RL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{RL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function IL(t,e,i,s){const n=PL(t,(t=>i(t))),r=PL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 LL{getRootGroup(){return this._rootGroup}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(aL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new R_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Tp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Vy(o))&&!1!==c&&WO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=CL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>RL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>RL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{RL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Iy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===CL.before&&(this._layoutState=CL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=CL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Iy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=OL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=IL(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=IL(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=PL(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=PL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===oL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:eL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===oL.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===oL.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===oL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===oL.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===oL.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{RL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=OL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Hy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return mu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{RL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function DL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Dy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function FL(t){t.crosshair=G(t.crosshair||{}).map((e=>NO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function zL(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ni(l,i.width,i.height);a=t,o=e}else if(h&&Hy(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=ni(t,i.width,i.height);a=e,o=s}else if(Ny(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 jL(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 HL(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}}const VL=9,NL=0,WL=-1;var UL,GL,YL,XL,$L,KL;!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"}(UL||(UL={})),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"}(GL||(GL={})),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"}(YL||(YL={}));class qL{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},qL.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]))))}}qL.defaultMarkInfo={};class ZL{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class JL{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=>NO({},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 QL extends ZL{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=JL,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new qL,this._lastLayoutRect=null,this.id=Uy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new sL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${uI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=WO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return E(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class tD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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=GL.Region,this._willLayoutTag=!0,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){let a=TO(BO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:wO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:wO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:wO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:wO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:wO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:wO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=wO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=wO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=wO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(CO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class eD extends QL{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,this._transformLayoutPadding=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 tD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 iD extends JL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class sD extends eD{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=iD,this.modelType="region",this.specKey="region",this.type=sD.type,this._series=[],this.layoutType="region",this.layoutZIndex=UL.Region,this.seriesDataFilterOver=()=>{this.event.emit(aL.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"}_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._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",UL.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",YL.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:UL.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:UL.Mark+1}))}_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",YL.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",YL.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}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",YL.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",YL.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",YL.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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))&&(!u(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function nD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 rD(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 aD(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 oD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=dD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),aD(d,!0,p,l),s&&rD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function lD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=dD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=dD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),aD(d,!1,p,o),s&&rD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function cD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=dD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=dD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&oD(n,e,i,!1,"left",s),r.length&&oD(r,e,i,!0,"left",s),a.length&&lD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&hD(n,e,i,!1,"top",s),r.length&&hD(r,e,i,!0,"top",s),a.length&&cD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&oD(n,e,i,!1,"right",s),r.length&&oD(r,e,i,!0,"right",s),a.length&&lD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&hD(n,e,i,!1,"bottom",s),r.length&&hD(r,e,i,!0,"bottom",s),a.length&&cD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=dD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=dD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Dy)("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}}}uD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(XL||(XL={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}($L||($L={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(KL||(KL={}));const pD=["linear","radial","conical"],gD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const fD={};Object.values($L).forEach((t=>{fD[t]=!0})),$L.STATE_HOVER,$L.STATE_HOVER_REVERSE,$L.STATE_SELECTED,$L.STATE_SELECTED_REVERSE,$L.STATE_DIMENSION_HOVER,$L.STATE_DIMENSION_HOVER_REVERSE;class mD extends ZL{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class vD extends mD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,BL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!fD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(KC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class _D extends ZL{constructor(){super(...arguments),this.id=Uy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=WO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class yD extends _D{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const bD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,xD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=bD(l.delay,n,a,o),d=bD(l.duration,n,a,o),u=bD(l.oneByOne,n,a,o),p=bD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?DT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:FT)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);RT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?DT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:FT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>CT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>PT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Uo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new ET({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kT,null!==(l=i.easing)&&void 0!==l?l:AT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Uo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new OT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:AT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):RT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},SD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},kD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class AD extends _D{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new yD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Tp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:UL.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new zl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==XL.enter&&t.context.diffState!==XL.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=t,this.model=e.model,this.key=e.key,this.state=new vD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ne)}isUserLevel(t){return[YL.User_Mark,YL.User_Series,YL.User_Chart,YL.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&NO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(qC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=bO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):pD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):qC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",YL.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,YL.User_Mark)}else this.setStyle(i,t,YL.User_Mark)}))}_computeGradientAttr(e){var i,s;const{gradient:n,scale:r,field:a}=e,o=t(e,["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 d=dO(cO(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()),p=Object.assign(Object.assign({},gD[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(p).forEach((s=>{const n=p[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=Qe.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||d[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)pD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=dO(cO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return PL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return WO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[vI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=PL(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{kD(t),s.push(...t.getGraphics())})),e.forEach((t=>{kD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);xD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=SD(e,n),r=SD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===wL.exit?wL.exit:i===wL.update?wL.update:wL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===XL.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===XL.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=XL.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=XL.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=XL.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=wL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=wL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return EL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=EL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=iL(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===$L.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=WO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=WO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===CL.before||(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===XL.exit&&!e.isExiting)if(e.context.animationState===XL.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:XL.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Tp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var MD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(MD||(MD={}));class wD extends AD{constructor(){super(...arguments),this.type=wD.type,this._marks=[],this._diffState=XL.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ly("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?(Ly("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))}getMarkInUserId(t){let e;return RL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===XL.update){const t=this.hasAnimation(),e=iL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=XL.update}render(){this._isCommited&&(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}wD.type="group";const TD={measureText:dI};class CD{static instance(){return CD.instance_||(CD.instance_=new CD),CD.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 BD{constructor(){this.id=Uy(),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))?Ly("不要重复添加相同的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 PD extends BD{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}}const ED={type:"fadeIn"};function RD(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 ED;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const OD={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"}},ID={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},LD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},DD=()=>{WO.registerAnimation("scaleInOut",(()=>ID))},FD=()=>{WO.registerAnimation("fadeInOut",(()=>LD))},zD=(t,e)=>({appear:RD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:VT,duration:OD.update.duration,easing:OD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),jD=()=>{WO.registerAnimation("line",zD)},HD=()=>{oT.registerBuiltInAnimate("growPointsIn",rC),oT.registerBuiltInAnimate("growPointsOut",aC),oT.registerBuiltInAnimate("growPointsXIn",lC),oT.registerBuiltInAnimate("growPointsXOut",hC),oT.registerBuiltInAnimate("growPointsYIn",dC),oT.registerBuiltInAnimate("growPointsYOut",uC),oT.registerBuiltInAnimate("clipIn",UT),oT.registerBuiltInAnimate("clipOut",GT)},VD=()=>{vT(),oT.registerBuiltInAnimate("scaleIn",bC),oT.registerBuiltInAnimate("scaleOut",xC),oT.registerBuiltInAnimate("fadeIn",YT),oT.registerBuiltInAnimate("fadeOut",XT),oT.registerBuiltInAnimate("moveIn",MC),oT.registerBuiltInAnimate("moveOut",wC),oT.registerBuiltInAnimate("rotateIn",CC),oT.registerBuiltInAnimate("rotateOut",BC),oT.registerBuiltInAnimate("update",kC),oT.registerBuiltInAnimate("state",SC),oT.registerBuiltInAnimate("fromTo",PC)},ND=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};$L.STATE_HIGHLIGHT,$L.STATE_BLUR;class WD{constructor(t){this._markSet=new qL,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 UD={highlightState:$L.STATE_HIGHLIGHT,blurState:$L.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class GD extends WD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},UD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}GD.type="element-highlight",GD.defaultOptions=UD;const YD=()=>{WO.registerInteractionTrigger(GD.type,GD)},XD={state:$L.STATE_SELECTED,trigger:"click"};class $D extends WD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},XD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}$D.type="element-select",$D.defaultOptions=XD;const KD=()=>{WO.registerInteractionTrigger($D.type,$D)};class qD extends BD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class ZD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>WO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>WO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>WO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return WO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>WO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){WO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&CD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&CD.instance().unregisterFunction(t)}static getFunction(t){return t?CD.instance().getFunction(t):null}static getFunctionList(){return CD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=WO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=WO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,fL.get(e);var e}static registerSVG(t,e,i){const s=WO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=WO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){nI.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=Uy(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=jL(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?WO.getSeriesBuiltInTheme(e):WO.getComponentBuiltInTheme(e);i=i?NO({},s,i[e]):s}s===t.length-1&&u(i)&&(i=lI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},sO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Hy(_);if(S?tx(fo):"node"===_&&zS(fo),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=rI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:st.Error);nt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new LL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new uL(this,this._compiler),this._event=new sL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),nI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=NO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=hI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;ZD.getFunctionList()&&ZD.getFunctionList().length&&(t=cI(t,ZD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=WO.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=WO.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=WO.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._chartSpecTransformer),this._chart.init(),this._event.emit(aL.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)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(aL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=bt(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 zL(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:pI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gI})}_initDataSet(t){this._dataSet=t instanceof Aa?t:new Aa,gL(this._dataSet,"dataview",xa),gL(this._dataSet,"array",i),pL(this._dataSet,"copyDataView",xL);for(const t in WO.transforms)pL(this._dataSet,t,WO.transforms[t]);for(const t in WO.dataParser)gL(this._dataSet,t,WO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(aL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?wL.none:wL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,nI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,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 e(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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ma?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=kL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.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,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?NO({},t[n][e.index],i):i):t[n]=s?NO({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?NO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?NO({},t[n],i):i)}))}(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=NO({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(aL.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=UO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=aI(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=UO({},aI(this._currentThemeName),aI(n),aI(r));this._currentTheme=o(a,t)}else{const t=UO({},aI(this._currentThemeName),aI(n),aI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(jM.poptip,zM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Hy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return aI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!rI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield DL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Hy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?PO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Ly("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 u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?PO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ly("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return CD.instance().getFunction(t)}registerFunction(t,e){t&&e&&CD.instance().registerFunction(t,e)}unregisterFunction(t){t&&CD.instance().unregisterFunction(t)}getFunctionList(){return CD.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(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.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=WO.getChartPlugins();t.length>0&&(this._chartPlugin=new PD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=WO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new qD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}ZD.InstanceManager=nI,ZD.ThemeManager=rI,ZD.globalConfig={uniqueTooltip:!0},ZD.Utils=TD,ZD.vglobal=__;WO.registerRegion("region",sD),WO.registerLayout("base",uD),YA(),RA(),WO.registerMark(wD.type,wD),WO.registerStageEventPlugin("gesture",kb),YD(),KD(),QO(FO.name,FO);const JD="monotone",QD="linear",tF="bevel";var eF;function iF(t,e){return e("component",t)}function sF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=WO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(eF||(eF={}));const nF=(t,e,i,s)=>{if(d(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},rF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},aF="2.0.6",oF=(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},lF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?E(e,t.field):t,s){const{formatFunc:i,args:r}=sF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},hF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const cF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function dF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=pF(lF(h,r,a,c),p,g),o.value=pF(lF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=lF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function uF(t,e,i,s,n,r,a){if(c(e)){dF(t,e(n,a),i,s,r,a)}else e&&dF(t,e,i,s,r,a)}const pF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=pi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class gF{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:u(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(u(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(u(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=>{uF(a,t,e,i,s,n,r)})):c(t)?uF(a,t,e,i,s,n,r):t&&dF(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=c(e)?e(s,n):e;if(r?d(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:lF(r.visible,t,n),value:pF(lF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:lF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=lF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&cF(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 fF={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}},mF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=zI([],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 vF(a,n,o)},vF=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Gy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Gy(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=fF[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},_F=(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=>{Gy(t[e])||(t[e]=0)}))})),t},yF=`${uI}_HIERARCHY_DEPTH`,bF=`${uI}_HIERARCHY_ROOT`,xF=`${uI}_HIERARCHY_ROOT_INDEX`;function SF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function kF(t,e,i){t&&(i.needDefaultSeriesField&&(t[_I]=i.defaultSeriesField),t[mI]=e,t[vI]=i.getKey(t,e,i))}function AF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function MF(t,e,i,s=0,n,r){void 0===r&&(r=e),kF(t,e,i),t[yF]=s,t[bF]=n||t[i.categoryField],t[xF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>MF(e,s,i,t[yF]+1,t[bF],r)))}const wF={label:{name:"label",type:"text"}},TF=`${uI}_rect_x`,CF=`${uI}_rect_x1`,BF=`${uI}_rect_y`,PF=`${uI}_rect_y1`,EF={data:!0},RF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OF=[...Object.keys(OD),"normal"];function IF(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 jF(n)&&delete n.type,n.oneByOne&&(n=DF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=NO({},o[e],a);return jF(n)&&delete n.type,n.oneByOne&&(n=DF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function LF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(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;const i=["custom","customParameters"];return t=I(t,null,i),HF(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function DF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function FF(t,e){var i;return null!==(i=null==t?void 0:t[mI])&&void 0!==i?i:e.context.graphicIndex}function zF(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 jF(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function HF(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),HF(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),HF(t[s],e,i))}function VF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class NF extends JL{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=oO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=WO.getSeriesMarkMap(o)?function(t,e,i){const s=WO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=NO({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return NO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(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:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=NO({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>NO({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class WF extends QL{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){u(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:`${uI}_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=NF,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=UL.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(aL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=VF(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(aL.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 d(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),u(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)&&(pL(this._rawData.dataSet,"invalidTravel",_F),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=kL(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=SL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=SL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new yD(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=vF(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(){pL(this._dataSet,"dimensionStatistics",mF);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&&zI(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){pL(this._dataSet,"dimensionStatistics",mF);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=zI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&zI(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(pL(this._rawData.dataSet,"addVChartProperty",oF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:SF.bind(this),call:kF}},!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(aL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(aL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(aL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(aL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=IF({},LF(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Vy(i)||Ny(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=NO(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=NO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=ND(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=ND(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:$L.STATE_HOVER_REVERSE,highlightState:$L.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:$L.STATE_SELECTED_REVERSE,state:$L.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=ND(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:_I;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:yI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,yI,YL.User_SeriesStyle)}))}afterInitMark(){this.event.emit(aL.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",YL.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new gF(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)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},EF),RF),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=>RF[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ma||AL(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();VF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:_I,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new _O).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return cO(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:_I}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,NO({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:vI}_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!==SI&&t!==AI&&t!==xI&&t!==kI||(t=this.getStackValueField()),null!==(e=HI(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=>Gy(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:_I]}}function UF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();KC(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 GF(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}}}WF.mark=wF,WF.transformerConstructor=NF;class YF extends WF{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);KC(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:`${uI}_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(SI),this.setFieldX2(xI)):(this.setFieldY(SI),this.setFieldY2(xI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(AI),this.setFieldX2(kI)):(this.setFieldY(AI),this.setFieldY2(kI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(wI),this.setFieldX2(MI)):(this.setFieldY(wI),this.setFieldY2(MI))}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),u(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(),u(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(aL.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)&&(UF("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function XF(t){return"bottom"===t||"top"===t}function $F(t){return"left"===t||"right"===t}function KF(t){return"z"===t}function qF(t,e){return kO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function ZF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function JF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?XF(t)?"linear":"band":XF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const QF=(t,e,i)=>{var s;const n=null!==(s="band"===e?iF("axisBand",i):["linear","log","symlog"].includes(e)?iF("axisLinear",i):{})&&void 0!==s?s:{},r=XF(t)?iF("axisX",i):$F(t)?iF("axisY",i):iF("axisZ",i);return NO({},iF("axis",i),n,r)};class tz{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:Dy)("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:Dy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>ZC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return XF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class ez extends tz{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:oL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const iz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},sz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},nz=(t,e,i,s)=>{var n;const r=e.getScale(),a=ZC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:rz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,az=(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};class oz extends tz{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)=>!iz(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:oL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:oL.canvas}),callback:this.onMouseOut}),Vy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:oL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Vy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var lz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(lz||(lz={}));const hz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class cz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(hz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{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",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.event.on(aL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:tF,curveType:QD,closePath:!0},"normal",YL.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===JD?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",YL.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",YL.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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(hz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:zF(this._spec,hz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ma(this._option.dataSet,{name:`${uI}_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()},{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(lz.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:YL.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$L.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",YL.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",YL.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[hz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(lz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,NO({},this._spec[hz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$L.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",YL.Series),this.event.on(aL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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",YL.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",YL.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const dz=Object.assign(Object.assign({},wF),hz),uz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>uz(t,e[i])));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]))},pz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class gz extends AD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return pz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(qC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?uz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:XL.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[vI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class fz extends gz{constructor(){super(...arguments),this.type=fz.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)===rO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}fz.type="line";const mz=()=>{WO.registerMark(fz.type,fz),YA(),DA(),FP(),RP(),HD(),WO.registerGraphicComponent("line",wg)};class vz extends AD{constructor(){super(...arguments),this.type=vz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}vz.type="symbol";const _z=()=>{WO.registerMark(vz.type,vz),YA(),$A(),RP(),WO.registerGraphicComponent("symbol",kg)};class yz extends NF{_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 bz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function xz(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:!k(o.min),extendable_max:!k(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 Sz(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 kz(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 Az(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 Mz(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 wz=(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=>function(t,e,i,s,n){const r=ee(t,e),a=Math.max(Qt(i),Qt(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return WC(v)};class Tz{constructor(t){this.id=Uy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Cz extends Tz{constructor(){super(Cz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!KC(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(aL.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&&bz(c)&&bz(d)))return;const u=xz(t,c),p=xz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!kz(u,p))return}else if(0===y&&0===b){if(!kz(p,u))return}else if(_||k)if(_&&!k){if(!Sz(u,p))return}else if(k&&!_){if(!Sz(p,u))return}else{if(f===b)return;if(f>b){if(!Az(u,p))return}else if(!Az(p,u))return}else{if(0===f&&0===y){if(!Mz(u,p))return}else if(0===b&&0===g&&!Mz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){pL(e.getOption().dataSet,"tickAlign",wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Cz.pluginType="component",Cz.type="AxisSyncPlugin";const Bz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Pz(t){let e=0;return E(t,"tick.visible")&&(e+=E(t,"tick.tickSize")),E(t,"label.visible")&&(e+=E(t,"label.space")),e}function Ez(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 Rz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Oz=t=>"band"===t||"ordinal"===t||"point"===t;function Iz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Lz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Dz extends BD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Fz=`${uI}_ARC_TRANSFORM_VALUE`,zz=`${uI}_ARC_RATIO`,jz=`${uI}_ARC_START_ANGLE`,Hz=`${uI}_ARC_END_ANGLE`,Vz=`${uI}_ARC_K`,Nz=`${uI}_ARC_MIDDLE_ANGLE`,Wz=`${uI}_ARC_QUADRANT`,Uz=`${uI}_ARC_RADIAN`,Gz=-Math.PI/2,Yz=3*Math.PI/2,Xz=.6,$z=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(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 de(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Kz=(t,e,i)=>{var s;const n=null!==(s="band"===e?iF("axisBand",i):"linear"===e?iF("axisLinear",i):{})&&void 0!==s?s:{},r=iF("angle"===t?"axisAngle":"axisRadius",i);return NO({},iF("axis",i),n,r)};function qz(t,e,i,s){switch(t){case n.cartesianBandAxis:return QF(qF(i,["z"]),"band",e);case n.cartesianLinearAxis:return QF(qF(i,["z"]),"linear",e);case n.cartesianLogAxis:return QF(qF(i,["z"]),"log",e);case n.cartesianSymlogAxis:return QF(qF(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return QF(qF(i),void 0,e);case n.polarBandAxis:return Kz(i.orient,"band",e);case n.polarLinearAxis:return Kz(i.orient,"linear",e);case n.polarAxis:return Kz(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=iF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>XF(t.orient)));let g;g=u(p)?NO({},Oz(p.type)?a:o,l):l;const f=r.find((t=>$F(t.orient)));let m;return m=u(f)?NO({},ZC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=iF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?NO({},Oz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?NO({},ZC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Zz(i,iF(t,e));default:return iF(t,e)}}const Zz=(t,e)=>{var i;const s=NO({},e,e[ZF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Jz extends JL{getTheme(t,e){return qz(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({},BO(e)),{[s]:0}))}}class Qz extends eD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Jz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:oL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Dz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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}}getDatum(t){}}var tj,ej;Qz.transformerConstructor=Jz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(tj||(tj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ej||(ej={}));class ij extends AD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=WO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(nL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}ij.type="component";const sj=()=>{WO.registerMark(ij.type,ij)},nj=t=>t;class rj extends Qz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?tj.circleAxis:tj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),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()?ej.circleAxisGrid:ej.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),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:UL.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==E(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IF(null===(l=WO.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:E(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:E(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:E(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:E(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:E(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:E(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:E(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:E(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:E(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:E(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()),e=new yD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return QR(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?KC(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===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.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 QR(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(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(aL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=tO(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()})),QR(this._regions,(t=>{t.event.on(aL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(aL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(QR(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 e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=qI(s=e.domainLine)).startSymbol=qI(s.startSymbol),s.endSymbol=qI(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return QI(NO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:QI(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>QI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=QI(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return QI(NO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:QI(e.tick.style)),e.tick.state&&(i.tick.state=ZI(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return QI(NO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:QI(e.subTick.style)),e.subTick.state&&(i.subTick.state=ZI(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Bz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ne(p):null,textStyle:NO({},u,QI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:QI(h.style)}),h.state&&(i.title.state.shape=ZI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:QI(o.style)}),o.state&&(i.title.state.background=ZI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=ZI(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=QI(e.background.style)),e.background.state&&(i.panel.state=ZI(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:c(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 QI(NO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:QI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:QI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=sF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){gL(this._option.dataSet,"scale",nj);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)}getDatum(t){var e;return t&&t.name===dw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}rj.specKey="axes";const aj=()=>{sj(),WO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},oj=[Cz];class lj extends rj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=UL.Axis,this.layoutLevel=GL.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),QR(this._regions,(t=>{const e=this.getOrient();XF(e)?Lz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):$F(e)?Lz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):KF(e)&&Lz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=NO({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(NO({x:e.x,y:e.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=XF(this.getOrient()),n=t=>{var e;return(s?!XF(t.getOrient()):XF(t.getOrient()))&&KC(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(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=qF(e,["z"]),KF(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(!Rz(e))return null;const{axisType:t,componentName:s}=JF(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=>$F(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(!Rz(t))return;const{axisType:s,componentName:n}=JF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=WO.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return XF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):KF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(oj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){XF(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!XF(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!KF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;$F(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=wO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=wO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=XF(this.getOrient())?t.fieldX:KF(this.getOrient())?t.fieldZ:t.fieldY,KC(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:KC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(nL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(XF(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=XF(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)}))}collectScale(){const t=[];return QR(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]:XF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:KF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();QR(this._regions,(e=>{XF(t)?Lz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):$F(t)?Lz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):KF(t)&&Lz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(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=XF(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=XF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=NO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new ze).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=XF(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-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Iz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:KC(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(aL.layoutEnd,this._updateAxisLayout),this.event.on(aL.layoutEnd,this._fixAxisOnZero),this.event.on(aL.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}}}}lj.type=n.cartesianAxis,lj.specKey="axes";const hj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function cj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,uj=(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 pj(t,e,i="count"){const s=uj(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const gj=Math.sqrt(50),fj=Math.sqrt(10),mj=Math.sqrt(2);class vj{constructor(){this._extend={},this.niceLabelFormatter=null}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Ez(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=XF(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=k(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(dj),e.sort(dj),{domain:cj(t,e),scope:pj(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=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Ez(this._spec);if(u(e)||u(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>=gj?10:n>=fj?5:n>=mj?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(aL.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(aL.scaleDomainUpdate,{model:this}),this.event.emit(aL.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=>k(+t)?Math.round(+t*s)/s:t}}const _j={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},yj={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}}},bj={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}}},xj={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}}};class Sj extends lj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new jB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(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(!KF(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=XF(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=AO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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]+(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 pL(this._option.dataSet,t,$B),t}}Sj.type=n.cartesianLinearAxis,Sj.specKey="axes",Sj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Sj,vj);const kj=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),aj(),WO.registerComponent(Sj.type,Sj)};class Aj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new yD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(aL.scaleDomainUpdate,{model:this}),this.event.emit(aL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Iz(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=>Iz(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 Mj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class wj extends lj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new _B}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 pL(this._option.dataSet,t,QB),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=hB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),aj(),WO.registerComponent(wj.type,wj,!1)};class Cj extends Sj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),QR(this._regions,(t=>{XF(this.getOrient())?Lz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Lz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=NO({},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 yD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=pi.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=>Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Cj.type=n.cartesianTimeAxis,Cj.specKey="axes",Cj.builtInTheme={axis:xj,axisX:yj,axisY:bj};const Bj=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),aj(),WO.registerComponent(Cj.type,Cj)};class Pj extends Sj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new WB}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 pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Pj.type=n.cartesianLogAxis,Pj.specKey="axes",Pj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Pj,vj);const Ej=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),aj(),WO.registerComponent(Pj.type,Pj)};class Rj extends Sj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new UB}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 pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Rj.type=n.cartesianSymlogAxis,Rj.specKey="axes",Rj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Rj,vj);const Oj=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),aj(),WO.registerComponent(Rj.type,Rj)},Ij=`${uI}_hide_`;function Lj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Dj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Ij]&&(Lj(t,!0),t[Ij]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Ij]=!0,Lj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Fj=()=>{WO.registerGrammarTransform("symbolOverlap",{transform:Dj,runType:"afterEncode"})},zj={min:$,max:X,average:$R,sum:XR};function jj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Hj(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 Vj(t,e,i,s){return Hj(t,e,i,"min",s)}function Nj(t,e,i,s){return Hj(t,e,i,"max",s)}function Wj(t,e,i,s){return Hj(t,e,i,"average",s)}function Uj(t,e,i,s){return Hj(t,e,i,"sum",s)}const Gj=(t,e)=>{let i=c(t.size)?t.size():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=jj;if("min"===n?l=Vj:"max"===n?l=Nj:"average"===n?l=Wj:"sum"===n&&(l=Uj),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[]},Yj=()=>{WO.registerGrammarTransform("dataSampling",{transform:Gj})};class Xj extends YF{constructor(){super(...arguments),this.type=rO.line,this.transformerConstructor=yz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(IF(null===(i=WO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),LF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=GF(this);this._symbolMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Xj.type=rO.line,Xj.mark=dz,Xj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Xj.transformerConstructor=yz,U(Xj,cz);class $j{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)=>{AL(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];Ly(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ly(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Kj{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)=>{Yy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{zI(e,[{key:t,operations:KC(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&&zI(e,[{key:i.field,operations:KC(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?bO("colorOrdinal"):bO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Yy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(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(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Yy(s.domain)?e.reRender=!0:N(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(!Yy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=KC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=KC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;KC(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(KC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=KC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));KC(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class qj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Zj extends ZL{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Uy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pI,height:gI},this._viewRect={width:pI,height:gI},this._viewBox={x1:0,y1:0,x2:pI,y2:gI},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=>u(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=BO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new sL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new $j(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new qj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=WO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=WO.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:UL.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=WO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(aL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(aL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(aL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof QL)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 AD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof AD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&AL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=zL(this._spec,this._option,{width:pI,height:gI})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=cO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Kj(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){jL(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=cO(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(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{jL(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,jL(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):jL(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()];jL(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=TO(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(aL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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($L.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum($L.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState($L.STATE_SELECTED)}clearHovered(){this.clearState($L.STATE_HOVER)}_initEvent(){[aL.dataZoomChange,aL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(nL.AFTER_MARK_RENDER_END,e)};this._event.on(nL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:eL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(tL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===lz.dimensionHover||s===lz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>ZC(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.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(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Jj=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class Qj{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):jO(t,a,c.spec),jO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Jj(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=Jj(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(WO.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(WO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=WO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=WO.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=WO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):nF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=nF(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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class tH extends Qj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),E(i,"trimPadding")&&NO(i,HL(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 eH extends tH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),FL(t)}}const iH=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=VI(t,!0);for(const e in o)for(const i in o[e].nodes)GI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)UI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&WI(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(aL.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 nH{_beforeInit(){this._dataSet&&pL(this._dataSet,"stackSplit",iH)}_initStack(){this._stack=new sH(this),this._stack.init()}}const rH={state:$L.STATE_DIMENSION_HOVER,reverseState:$L.STATE_DIMENSION_HOVER_REVERSE,trigger:lz.dimensionHover};class aH extends WD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},rH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=eL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}aH.type="dimension-hover",aH.defaultOptions=rH;const oH=()=>{WO.registerInteractionTrigger(aH.type,aH)},lH=()=>{WO.registerComposedEvent(lz.dimensionHover,oz),WO.registerComposedEvent(lz.dimensionClick,ez)},hH=t=>t.fieldX[0],cH=t=>t.fieldY[0],dH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},uH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},pH=(t,e)=>t?e?hH:dH:e?cH:uH,gH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=az(t,(t=>XF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=az(t,(t=>$F(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=>{ZC(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=fH(t,i,pH(e,ZC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=fH(t,i,pH(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},fH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:mH(t,s,i)},mH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=nz(e,t,"cartesian",null!=i?i:XF(t.getOrient())?hH:cH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},vH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(ZC(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(KC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Pz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};yH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&_H(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),_H=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=sF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},yH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},bH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=xH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},xH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},SH=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return vH(c,r,e),c.xField.cacheInfo?bH(c.xField):c.yField.cacheInfo?bH(c.yField):void 0},kH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],AH=(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])&&kH.forEach((e=>{u(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(MH(s).every((t=>{var e;return!cF("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},MH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},wH={dom:`${uI}_TOOLTIP_HANDLER_DOM`,canvas:`${uI}_TOOLTIP_HANDLER_CANVAS`},TH={key:"其他",value:"..."};var CH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(CH||(CH={}));class BH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(aL.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:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=AH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[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({},TH),t):TH;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!d(e)&&cF(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 PH extends BH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!ZC(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const EH=()=>{WO.registerTooltipProcessor("dimension",PH)};class RH extends BH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Wo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(eL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const OH=()=>{WO.registerTooltipProcessor("mark",RH)};class IH extends BH{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 LH=()=>{WO.registerTooltipProcessor("group",IH)};class DH extends Zj{constructor(){super(...arguments),this.transformerConstructor=eH,this.type="line",this.seriesType=rO.line}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}DH.type="line",DH.seriesType=rO.line,DH.transformerConstructor=eH,U(DH,nH);const FH=[...pz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class zH extends gz{constructor(){super(...arguments),this.type=zH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return FH}_getIgnoreAttributes(){return[]}}zH.type="area";const jH=()=>{WO.registerMark(zH.type,zH),YA(),wA(),FP(),RP(),HD(),WO.registerGraphicComponent("area",Zg)};class HH extends gF{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")),u(e))return e}return i}}}const VH=Object.assign(Object.assign(Object.assign({},wF),hz),{area:{name:"area",type:"area"}}),NH=()=>{WO.registerAnimation("area",zD),jD(),DD()};class WH extends yz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=NO({},f.style,g.style),l.state=NO({},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 UH extends YF{constructor(){super(...arguments),this.type=rO.area,this.transformerConstructor=WH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(UH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===JD?"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 xO(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",YL.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return xO(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",YL.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[SI]},"normal",YL.Series),this.setMarkStyle(o,{curveType:a},"normal",YL.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(IF(null===(e=WO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),LF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IF(null===(i=WO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),LF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=GF(this);this._symbolMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LF("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 HH(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(){super.onLayoutEnd(),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}}}UH.type=rO.area,UH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},UH.mark=VH,UH.transformerConstructor=WH,U(UH,cz);class GH extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),FL(t)}}class YH extends Zj{constructor(){super(...arguments),this.transformerConstructor=GH,this.type="area",this.seriesType=rO.area}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}YH.type="area",YH.seriesType=rO.area,YH.transformerConstructor=GH,U(YH,nH);function XH(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 $H=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:XH(t,e)}),KH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:XH(t,e)}),qH={type:"fadeIn"},ZH={type:"growCenterIn"};function JH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qH;case"scaleIn":return ZH;default:return $H(t)}}class QH extends AD{constructor(){super(...arguments),this.type=QH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}QH.type="rect";const tV=()=>{YA(),NA(),BP("rect",IP),WO.registerMark(QH.type,QH),oT.registerBuiltInAnimate("growHeightIn",eC),oT.registerBuiltInAnimate("growHeightOut",iC),oT.registerBuiltInAnimate("growWidthIn",_C),oT.registerBuiltInAnimate("growWidthOut",yC),oT.registerBuiltInAnimate("growCenterIn",JT),oT.registerBuiltInAnimate("growCenterOut",QT),WO.registerGraphicComponent("rect",Pg)},eV=Object.assign(Object.assign({},wF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function iV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=EO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[TF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):xO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):xO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=xO(this._dataToPosX(t),e,i),n=xO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):xO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):xO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=xO(this._dataToPosY(t),e,i),n=xO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},rV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:zF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(rV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",YL.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===n.cartesianBandAxis));let r;if(pL(this._option.dataSet,"addVChartProperty",oF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};pL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:SF.bind(this),call:kF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new yD(this._option,r)}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=PF,s=BF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=CF,s=TF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=VI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)iV(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=xO(this[r](t),l,i),u=xO(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",YL.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",YL.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[xI],n=t[SI],r=t[kI],h=t[AI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[xI]:i,[SI]:s}),a?{[kI]:o,[AI]:l}:void 0),d="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(Pg(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,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=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>xO(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",YL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",YL.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>xO(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",YL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",YL.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=d(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",YL.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",YL.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=GF(this);this._barMark.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),LF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=EO(this._spec.barWidth,a)),l&&(c=Math.max(c,EO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,EO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(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=EO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=KC(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}rV.type=rO.bar,rV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},rV.mark=eV,rV.transformerConstructor=nV;const aV=()=>{Yj(),tV(),WO.registerAnimation("bar",((t,e)=>({appear:JH(t,e),enter:$H(t,!1),exit:KH(t,!1),disappear:KH(t)}))),Tj(),kj(),WO.registerSeries(rV.type,rV)};class oV extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),FL(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=p(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 lV extends Zj{constructor(){super(...arguments),this.transformerConstructor=oV,this.type="bar",this.seriesType=rO.bar}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}lV.type="bar",lV.seriesType=rO.bar,lV.transformerConstructor=oV,U(lV,nH);const hV=[10,20],cV=XC.Linear,dV="circle",uV=XC.Ordinal,pV=["circle","square","triangle","diamond","star"],gV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},fV=Object.assign(Object.assign({},wF),{point:{name:"point",type:"symbol"}});class mV extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class vV extends YF{constructor(){super(...arguments),this.type=rO.scatter,this.transformerConstructor=mV,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(c(e))return e;if(_(e)){if(d(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=`${uI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:cV,defaultRange:hV},"size")}getShapeAttribute(t,e){return d(e)?dV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:uV,defaultRange:pV},"shape")}initMark(){this._symbolMark=this._createMark(vV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,vV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=GF(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(IF(null===(i=WO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),LF("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:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:dV},$L.STATE_NORMAL,YL.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$L.STATE_NORMAL,YL.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$L.STATE_NORMAL,YL.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",YL.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",YL.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},$L.STATE_NORMAL,YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$L.STATE_NORMAL,YL.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}vV.type=rO.scatter,vV.mark=fV,vV.builtInTheme={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"}}}}},vV.transformerConstructor=mV;const _V=()=>{_z(),WO.registerAnimation("scatter",((t,e)=>Object.assign({appear:gV(0,e)},ID))),Tj(),kj(),WO.registerSeries(vV.type,vV)};class yV extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class bV extends Zj{constructor(){super(...arguments),this.transformerConstructor=yV,this.type="scatter",this.seriesType=rO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}bV.type="scatter",bV.seriesType=rO.scatter,bV.transformerConstructor=yV,U(bV,nH);const xV=()=>{EH(),OH(),lH(),oH(),_V(),WO.registerChart(bV.type,bV)};class SV extends WF{constructor(){super(...arguments),this.type=rO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${uI}_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 kV=`${uI}_MAP_LOOK_UP_KEY`,AV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[mI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[kV]=e.nameMap[n]:t[kV]=n})),t.features);class MV extends gF{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 wV extends AD{constructor(){super(...arguments),this.type=wV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}wV.type="path";const TV=()=>{WO.registerMark(wV.type,wV),YA(),zA(),WO.registerGraphicComponent("path",$g)},CV=Object.assign(Object.assign({},wF),{area:{name:"area",type:"path"}});class BV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ta[i]?(wa[i]||(wa[i]=Ba(i,Ta[i])),wa[i]):null}(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 PV{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(){}}class EV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 RV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:PV}:Vy(t)||Ny(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:EV}:null}const OV={debounce:yt,throttle:bt};class IV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Vy(this._renderMode)||Ny(this._renderMode),RV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return RV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!xe({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:lL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:lL.chart,consume:!1}];l.on(...c,OV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,OV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||RV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||RV(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 d(r)&&d(a)?s:xe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:lL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:lL.chart,consume:!1}];l.on(...c,OV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,OV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){RV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||RV(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:lL.chart},(t=>{if(!t.event)return;const{event:n}=t;xe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:lL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||RV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:lL.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||RV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:lL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:lL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:lL.chart,source:oL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:lL.chart,source:oL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=OV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=OV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:lL.chart})}));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:lL.chart,source:oL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:lL.chart,source:oL.chart},this._handleDragMouseUp)}))}}function LV(t,e){return`${uI}_${e}_${t}`}class DV extends Qz{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=UL.Mark,this._projectionSpec={name:LV(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(d(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:n.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=NO(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(){var t,e,i;this.event.on(aL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 BV(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===rO.map||e.type===rO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),QR(this._regions,(t=>{var e;if(t.type===rO.map||t.type===rO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ve})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==rO.map&&e.type!==rO.pictogram||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[kV],s=t.getDatumCenter(e);i&&u(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=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}DV.type=n.geoCoordinate,U(DV,IV);const FV=()=>{WO.registerComponent(DV.type,DV)};class zV extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class jV extends SV{constructor(){super(...arguments),this.type=rO.map,this.transformerConstructor=zV,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 !`),fL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),pL(this._dataSet,"copyDataView",xL),pL(this._dataSet,"map",AV),pL(this._dataSet,"lookup",rF);const i=fL.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:ML.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:kV,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 yD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(jV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:zF(this._spec,jV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:_I])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:_I]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",YL.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",YL.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(IF(null===(t=WO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),LF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new MV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[mI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[mI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ve}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ve}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 mI}getActiveMarks(){return[this._pathMark]}}jV.type=rO.map,jV.mark=CV,jV.builtInTheme={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"}}}}},jV.transformerConstructor=zV;const HV=`${uI}_waterfall_default_seriesField`,VV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[BI]=!0:delete t[BI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=NV([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 f=g[0];let{start:m,end:v}=WV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=te(_,e)):(t[c]=+y,y=te(y,e)),t[d]=te(t[c],e),m=te(m,e),b=ee(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=te(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=NV(r,t,n,a,c,h,i,e),a.push(n)})),a};function NV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=WV(t,i,s,n,u);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=te(i.positive,e)):(t[h]=+i.negative,i.negative=te(i.negative,e)),t[c]=te(t[h],e),i.end=te(i.end,e)}i.isTotal=e,(d(p)||p===HV)&&(t[HV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function WV(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&&!d(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?Ly("total.collectCountField error"):n=e[a].start;o<0?Ly("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&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=te(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 UV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>te(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},GV={type:"fadeIn"},YV={type:"growCenterIn"};function XV(t,e){switch(e){case"fadeIn":return GV;case"scaleIn":return YV;default:return $H(t,!1)}}class $V extends AD{constructor(){super(...arguments),this.type=$V.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}$V.type="rule";const KV=()=>{WO.registerMark($V.type,$V),YA(),DA(),WO.registerGraphicComponent("line",wg)},qV=Object.assign(Object.assign({},eV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),ZV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:JV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function JV(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)=>JV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class QV{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 Aa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),pL(e,"dimensionTree",ZV),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 tN extends nV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const eN={rect:oN,symbol:rN,arc:hN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=rN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:cN,line:dN,area:dN,rect3d:oN,arc3d:hN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function iN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=eN[t])&&void 0!==i?i:eN.point;return e.series.type===rO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=nN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(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&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:uN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function sN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==rO.sankey){const{formatFunc:t,args:n}=sF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function nN(t){return c(t)?e=>t(e.data):t}function rN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=nN(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:aN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function aN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function oN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=nN(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:lN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function lN(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 hN(t){var e;const{labelSpec:i}=t,s=null!==(e=nN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function cN(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=sN(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),bg(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 dN(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}))):[{index:0,[_I]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function uN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class pN extends rV{constructor(){super(...arguments),this.type=rO.waterfall,this.transformerConstructor=tN,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 QV(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]],d(this._seriesField)&&(this._seriesField=HV)}getSeriesKeys(){return this._seriesField===HV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),pL(this._dataSet,"waterfallFillTotal",UV),pL(this._dataSet,"waterfall",VV),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=SL(this.getViewData(),this._dataSet,{name:`${uI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new yD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:xI,endAs:SI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=GF(this);this._barMark.setAnimationConfig(IF(null===(i=WO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),LF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("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(){super.initMark();const t=this._createMark(pN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ee(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:ee(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return cN(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?xO(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):xO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",YL.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",YL.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}pN.type=rO.waterfall,pN.mark=qV,pN.builtInTheme={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}}}},pN.transformerConstructor=tN;const gN=()=>{KV(),tV(),WO.registerAnimation("waterfall",((t,e)=>({appear:XV(t,e),enter:$H(t,!1),exit:KH(t,!1),disappear:KH(t,!1)}))),FD(),Tj(),kj(),WO.registerSeries(pN.type,pN)},fN=`${uI}_BOX_PLOT_OUTLIER_VALUE`;var mN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(mN||(mN={}));const vN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[fN]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class _N extends gF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===mN.OUTLIER)return this.series.getOutliersField();if(t===mN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case mN.MIN:return this.series.getMinField();case mN.MAX:return this.series.getMaxField();case mN.MEDIAN:return this.series.getMedianField();case mN.Q1:return this.series.getQ1Field();case mN.Q3:return this.series.getQ3Field();case mN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===mN.OUTLIER)return e[fN];if(t===mN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case mN.MIN:return e[this.series.getMinField()];case mN.MAX:return e[this.series.getMaxField()];case mN.MEDIAN:return e[this.series.getMedianField()];case mN.Q1:return e[this.series.getQ1Field()];case mN.Q3:return e[this.series.getQ3Field()];case mN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[fN])}getDefaultContentList(t){return[{key:this.getContentKey(mN.OUTLIER),value:this.getContentValue(mN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(mN.MAX),value:this.getContentValue(mN.MAX)},{key:this.getContentKey(mN.Q3),value:this.getContentValue(mN.Q3)},{key:this.getContentKey(mN.MEDIAN),value:this.getContentValue(mN.MEDIAN)},{key:this.getContentKey(mN.Q1),value:this.getContentValue(mN.Q1)},{key:this.getContentKey(mN.MIN),value:this.getContentValue(mN.MIN)},{key:this.getContentKey(mN.SERIES_FIELD),value:this.getContentValue(mN.SERIES_FIELD)}]}}class yN extends AD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==XL.enter&&t.context.diffState!==XL.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=WO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const bN=()=>{WO.registerGraphicComponent("glyph",Rg),YA(),PA()},xN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],SN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class kN extends yN{constructor(){super(...arguments),this.type=kN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=xN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=SN,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}kN.type="boxPlot";const AN=Object.assign(Object.assign({},wF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),MN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},wN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},TN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),CN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,P;if("horizontal"===e){w=null===(r=null===(n=(null===(s=TN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=TN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=TN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=TN(t,"box").attribute.width,i=TN(t,"box").attribute.x;B=i,P=i+e}else{w=null===(m=null===(f=(null===(g=TN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=TN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=TN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=TN(t,"box").attribute.height,i=TN(t,"box").attribute.y;B=i,P=i+e}return k(w)?w:k(B)&&k(P)?(B+P)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},BN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=TN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=TN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=TN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=TN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=TN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=TN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=TN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=TN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=TN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=TN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class PN extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return MN(CN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class EN extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return wN(CN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class RN extends PN{computeAttribute(){return MN(BN)(this.target,this.params,this.params.options)}}class ON extends EN{computeAttribute(){return wN(BN)(this.target,this.params,this.params.options)}}class IN extends YF{constructor(){super(...arguments),this.type=rO.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(){this._boxPlotMark=this._createMark(IN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(IN.mark.outlier,{key:mI,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={lineWidth:this._lineWidth,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"};r.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const 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,$L.STATE_NORMAL,YL.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:x(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$L.STATE_NORMAL,YL.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=>xO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>xO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>xO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>xO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>xO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$L.STATE_NORMAL,YL.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=>xO(t(this.getDatumPositionValues(e,fN),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>xO(t(this.getDatumPositionValues(e,fN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$L.STATE_NORMAL,YL.Series)}}initData(){if(super.initData(),!this._data)return;pL(this._dataSet,"foldOutlierData",vN),pL(this._dataSet,"addVChartProperty",oF);const t=new Ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uI}_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:SF.bind(this),call:kF}},!1),this._outlierDataView=new yD(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(){super.onLayoutEnd(),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=GF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=WO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(LF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IF(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(IF(null===(a=WO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new _N(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]}}IN.type=rO.boxPlot,IN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},IN.mark=AN;const LN=()=>{bN(),DA(),NA(),WO.registerGraphicComponent("line",(t=>wg(t))),WO.registerGraphicComponent("rect",(t=>Pg(t))),WO.registerMark(kN.type,kN),_z(),DD(),Tj(),kj(),oT.registerBuiltInAnimate("boxplotScaleIn",PN),oT.registerBuiltInAnimate("boxplotScaleOut",EN),oT.registerBuiltInAnimate("barBoxplotScaleIn",RN),oT.registerBuiltInAnimate("barBoxplotScaleOut",ON),WO.registerSeries(IN.type,IN)};class DN extends AD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=DN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Gg(t):bg(t)}}DN.type="text";const FN=()=>{WO.registerMark(DN.type,DN),YA(),qA(),UA(),WO.registerGraphicComponent("text",bg),WO.registerGraphicComponent("richtext",Gg)};class zN extends gF{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 jN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),HN={type:"fadeIn"},VN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function NN(t,e){return"fadeIn"===e?HN:jN(t)}const WN=Object.assign(Object.assign({},eV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class UN extends nV{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 GN extends rV{constructor(){super(...arguments),this.type=rO.rangeColumn,this._barMarkType="rect",this._barName=rO.bar,this.transformerConstructor=UN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(GN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,GN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(GN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(GN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(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",YL.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=GF(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(IF(null===(i=WO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),LF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IF(null===(n=WO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),LF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new zN(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)}}GN.type=rO.rangeColumn,GN.mark=WN,GN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},GN.transformerConstructor=UN;const YN=()=>{tV(),FN(),WO.registerAnimation("rangeColumn",((t,e)=>({appear:NN(t,e),enter:jN(t),exit:VN(t),disappear:VN(t)}))),FD(),Tj(),kj(),WO.registerSeries(GN.type,GN)};var XN,$N;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(XN||(XN={})),function(t){t.middle="middle",t.start="start",t.end="end"}($N||($N={}));class KN extends gF{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 qN=Object.assign({},VH);class ZN extends UH{constructor(){super(...arguments),this.type=rO.rangeArea}initMark(){this._areaMark=this._createMark(ZN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{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",YL.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",YL.Series),this.setMarkStyle(t,{stroke:!1},"normal",YL.Series))}initTooltip(){this._tooltipHelper=new KN(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))}}ZN.type=rO.rangeArea,ZN.mark=qN;class JN extends WF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Xz,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(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(d(t)||d(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:[]};KC(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:[]};KC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(aL.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)&&UF(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 QN(t){return Gy(t)?Number.parseFloat(t):0}const tW=(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&&eW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ue(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(m.forEach(((t,e)=>{const i=t[Fz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[Fz]*t;v(e,k,i),k+=i}))}if(0!==_&&(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},eW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===QN(t[e])))||!i&&0===t.reduce(((t,i)=>t+QN(i[e])),0)));function iW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const sW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:iW(t,!0,wL.appear)}),nW={type:"fadeIn"},rW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:iW(t,!0,wL.enter)}),aW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:iW(t,!0,wL.exit)}),oW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:iW(t,!0,wL.exit)});function lW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nW;case"growRadius":return sW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class hW extends AD{constructor(t,e){super(t,e),this.type=cW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>oe({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Nz])[t]+s,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 cW extends hW{constructor(){super(...arguments),this.type=cW.type}}cW.type="arc";const dW=()=>{YA(),AA(),BP("arc",HP),oT.registerBuiltInAnimate("growRadiusIn",fC),oT.registerBuiltInAnimate("growRadiusOut",mC),oT.registerBuiltInAnimate("growAngleIn",qT),oT.registerBuiltInAnimate("growAngleOut",ZT),WO.registerGraphicComponent("arc",tf),WO.registerMark(cW.type,cW)},uW=Object.assign(Object.assign({},wF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class pW extends NF{_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=NO({},this._theme,i,t);const n=(t,e)=>NO({},"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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const gW=`${uI}_LABEL_VISIBLE`;class fW extends JN{constructor(){super(...arguments),this.transformerConstructor=pW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:wO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:wO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Gz,this._endAngle=Yz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Nz];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return oe(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=u(t),r=u(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}}(u(this._spec.startAngle)?ne(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ne(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ne(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;pL(this._dataSet,"pie",tW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ne(this._spec.minAngle):0,asStartAngle:jz,asEndAngle:Hz,asRatio:zz,asMiddleAngle:Nz,asRadian:Uz,asQuadrant:Wz,asK:Vz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ma(this._dataSet,{name:`${uI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new yD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},fW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:vI,groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return iO(jz)(t)}endAngleScale(t){return iO(Hz)(t)}_computeLayoutRadius(){return $z((()=>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:SO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:SO(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",YL.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",YL.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,YL.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",YL.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:iO(gW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(aL.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*(d(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[Nz];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return oe(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===wL.appear)return this._startAngle;if(i===wL.disappear)return this._endAngle;const r=[wL.disappear,wL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[mI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Nz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Nz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Nz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Nz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IF(null===(i=WO.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]}}fW.transformerConstructor=pW,fW.mark=uW,fW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class mW extends fW{constructor(){super(...arguments),this.type=rO.pie}}mW.type=rO.pie;const vW=()=>{dW(),WO.registerAnimation("pie",((t,e)=>({appear:lW(t,e),enter:rW(t),exit:aW(t),disappear:oW(t)}))),WO.registerAnimation("emptyCircle",((t,e)=>({appear:lW(t,e)}))),WO.registerSeries(mW.type,mW)};function _W(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const yW=t=>({type:_W(t.growField),options:{overall:!0}}),bW={type:"fadeIn"},xW=t=>({type:_W(t.growField)}),SW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},kW=SW;function AW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return bW;case"growAngle":return yW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return yW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class MW extends JN{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(SI),this.setInnerRadiusField(xI)}setValueFieldToPercent(){this.setRadiusField(AI),this.setInnerRadiusField(kI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const wW=Object.assign(Object.assign({},wF),{rose:{name:"rose",type:"arc"}});class TW extends NF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class CW extends rj{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=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,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:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,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(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=WO.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=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=UL.Axis,this._tick=void 0,this._center=null,this._startAngle=Gz,this._endAngle=Yz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),QR(this._regions,(t=>{"radius"===this.getOrient()?Lz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Lz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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:wO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:wO(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=ne(this._spec.startAngle),this._endAngle=ne(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Pz(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(){QR(this._regions,(t=>{"radius"===this.getOrient()?Lz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Lz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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 KC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:KC(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 oe(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return le(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=>Iz(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",scale:this._scale});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=se.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",scale:this._scale.clone()});(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(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return $z((()=>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=Xz,e=0;const i=this.getChart().getSpec();return QR(this.getRegions(),(s=>{const n=s;if(r=n.type,[rO.rose,rO.radar,rO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(NO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(NO({},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=n.polarAxis,CW.specKey="axes";const BW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},PW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class EW extends CW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new jB}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 pL(this._option.dataSet,t,$B),t}}EW.type=n.polarLinearAxis,EW.specKey="axes",EW.builtInTheme={axis:xj,axisLinear:_j,axisAngle:PW,axisRadius:BW},U(EW,vj);const RW=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),WO.registerGraphicComponent(tj.circleAxis,((t,e)=>new NC(t,e))),WO.registerGraphicComponent(ej.circleAxisGrid,((t,e)=>new $P(t,e))),aj(),WO.registerComponent(EW.type,EW)};class OW extends CW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new _B}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 pL(this._option.dataSet,t,iP),t}transformScaleDomain(){}}OW.type=n.polarBandAxis,OW.specKey="axes",OW.builtInTheme={axis:xj,axisBand:Mj,axisAngle:PW,axisRadius:BW},U(OW,Aj);const IW=()=>{WO.registerGraphicComponent(tj.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new YP(t,e))),WO.registerGraphicComponent(tj.circleAxis,((t,e)=>new NC(t,e))),WO.registerGraphicComponent(ej.circleAxisGrid,((t,e)=>new $P(t,e))),aj(),WO.registerComponent(OW.type,OW)};class LW extends MW{constructor(){super(...arguments),this.type=rO.rose,this.transformerConstructor=TW,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(){this._roseMark=this._createMark(LW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,LW.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=>xO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=xO(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(IF(null===(i=WO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),LF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}LW.type=rO.rose,LW.mark=wW,LW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},LW.transformerConstructor=TW;const DW=()=>{WO.registerSeries(LW.type,LW),dW(),WO.registerAnimation("rose",((t,e)=>({appear:AW(t,e),enter:xW(t),exit:SW(t),disappear:kW(t)}))),IW(),RW()};class FW extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:oe(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=le(this.from,this._prevCenter),{angle:i,radius:s}=le(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,UR(this._fromAngle,this._toAngle)&&UR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=oe({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class zW extends VT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!JR(t)&&!JR(e))return e;const s=le(t,this._prevCenter),n=le(e,this._center);let r=ce(s.angle),a=ce(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return oe({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 ie(s,n,r,a);return o.defined=e.defined,o}}const jW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function HW(t,e,i){return"fadeIn"===e?jW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function VW(t,e,i){return"fadeIn"===e?jW(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 NW=(t,e)=>({custom:jT,customParameters:(i,s)=>{var n;return{group:s,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({},wF),hz),{area:{name:"area",type:"area"}});class UW extends MW{constructor(){super(...arguments),this.type=rO.radar,this.transformerConstructor=yz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(UW.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:QD,closePath:!0},"normal",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.event.on(aL.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:u(this._spec.startAngle)?ne(this._spec.startAngle):Gz},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(IF(null===(s=WO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),LF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=WO.getAnimationInKey(e);t.setAnimationConfig(IF(null==i?void 0:i(n,r),LF(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&&_(a)?a[0]:a}}}UW.type=rO.radar,UW.mark=WW,UW.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},UW.transformerConstructor=yz,U(UW,cz);const GW=()=>{WO.registerSeries(UW.type,UW),jH(),mz(),_z(),WO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:HW(t,e,"in"),enter:HW(t,e,"in"),exit:HW(t,e,"out"),disappear:"clipIn"===e?void 0:HW(t,e,"out"),update:[{channel:["points","center"],custom:zW,customParameters:t,duration:OD.update.duration,easing:OD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),WO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:VW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:VW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:FW,customParameters:t,duration:OD.update.duration,easing:OD.update.easing}]}))),WO.registerAnimation("radarGroup",((t,e)=>({appear:NW(t,"in"),disappear:NW(t,"out")}))),AA(),IW(),RW()};class YW extends gF{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=>pi.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 XW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(uI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[mI]:r,[vI]:`${s}_${e}`})),r++}))})),n},$W={fill:"#bbb",fillOpacity:.2},KW=Object.assign(Object.assign({},wF),{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 qW extends YF{constructor(){super(...arguments),this.type=rO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),pL(this._option.dataSet,"objFlat",XW),pL(this._option.dataSet,"copyDataView",xL),gL(this._option.dataSet,"dataview",xa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:ML.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(NO($W,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(qW.mark.group),this._containerMark=this._createMark(qW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(qW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(qW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(qW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(qW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(qW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(qW.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",YL.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",YL.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",YL.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",YL.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",YL.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",YL.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",YL.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",YL.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",YL.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:_I}}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 _O).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:_I}}initTooltip(){this._tooltipHelper=new YW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}qW.type=rO.dot,qW.mark=KW,qW.builtInTheme={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"}}}}};class ZW extends gF{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=>pi.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 JW=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),QW=(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 tU extends YF{constructor(){super(...arguments),this.type=rO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),pL(this._option.dataSet,"linkDotInfo",QW),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:ML.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(tU.mark.group),this._containerMark=this._createMark(tU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(tU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(tU.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",YL.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",YL.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",YL.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",YL.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:_I}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new ZW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}tU.type=rO.link,tU.mark=JW,tU.builtInTheme={link:{arrow:{style:{size:10}}}};const eU=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"}});class iU extends JN{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()?xI:LI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle);let o;if(u(s)){const t=at(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 d(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()?SI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle),o=at(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=u(n)?ne(n):Gz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ne(r):Yz,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)||u(null==s?void 0:s.startAngle)||u(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=xO(this.angleAxisHelper.dataToPosition([t[xI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=xO(this.angleAxisHelper.dataToPosition([t[SI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?xO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(iU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",YL.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ne(a),o=ne(r)/2;return tf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 aU=()=>{WO.registerAnimation("circularProgress",((t,e)=>({appear:rU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class oU extends NF{constructor(){super(...arguments),this._supportStack=!0}}class lU extends iU{constructor(){super(...arguments),this.type=rO.circularProgress,this.transformerConstructor=oU,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(k(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(k(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(){return this._progressMark=this._createMark(lU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:zF(this._spec,"progress")}),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",YL.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(lU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?xI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?SI: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",YL.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(IF(null===(i=WO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),LF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}lU.type=rO.circularProgress,lU.mark=sU,lU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},lU.transformerConstructor=oU;const hU=()=>{WO.registerSeries(lU.type,lU),dW(),aU(),FD(),IW(),RW()};function cU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const dU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:cU(t)}),uU={type:"fadeIn"};function pU(t,e="grow"){return!1===e?{}:"fadeIn"===e?uU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:cU(t)}))(t)}class gU extends gF{enableByType(t){return"dimension"!==t}}const fU=Object.assign(Object.assign({},wF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class mU extends YF{constructor(){super(...arguments),this.type=rO.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=u(e.width)?e.width:e.x1-e.x,o=u(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;return this._progressMark=this._createMark(mU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape: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 xO(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 xO(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?xO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",YL.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 xO(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 xO(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,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?xO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",YL.Series)}}_initTrackMark(){return this._trackMark=this._createMark(mU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return xO(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",YL.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return xO(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",YL.Series))}getInteractionTriggers(){const t=[];return 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(IF(null===(i=WO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),LF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}mU.type=rO.linearProgress,mU.mark=fU,mU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const vU=()=>{tV(),WO.registerAnimation("linearProgress",((t,e)=>({appear:pU(t,e),enter:pU(t),disappear:dU(t)}))),FD(),WO.registerSeries(mU.type,mU)},_U=[0],yU=[20,40],bU=[200,500],xU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],kU=`${uI}_WORD_CLOUD_TEXT`,AU=Object.assign(Object.assign({},wF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),MU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class wU extends WF{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){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=yU}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:bU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:_U,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)?kU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Hy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_U,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!SU.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;this._wordMark=this._createMark(wU.mark.word,{key:vI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(wU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:UL.Mark-1}))}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",YL.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",YL.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",YL.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(IF(WO.getAnimationInKey("wordCloud")(n,s),LF("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 _O).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:_I])}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 jB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new jB).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[mI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,aL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:vI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:cf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:zg,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(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:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}wU.mark=AU,wU.builtInTheme={wordCloud:MU};function TU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||OD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;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===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=CU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},BU=(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=BU(t.children,e,t,n))})),s},PU=(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=PU(t.children,e,t,n)),n=e(t,s,i,n)})),n},EU=(t,e=[],i)=>{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):EU(t.children,e,i)))})),e};function RU(t,e){let i,s;if(LU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function LU(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*B,y:n+A+M*B,radius:B}}function jU(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 HU(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 VU(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 NU(t){return{_:t,next:null,prev:null}}function WU(t,e){const i=(t=G(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];jU(n,s,r);let a,o,l,h,c,d,u,p=NU(s),g=NU(n),f=NU(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=CU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:XU.defaultOpionts.nodeSort;BU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)BU([o],UU(h)),PU([o],GU(this._getPadding,.5,a)),BU([o],YU(1,this._maxDepth));else{const t=Math.min(s.width,s.height);BU([o],UU(XU.defaultOpionts.setRadius)),PU([o],GU(Pt,1,a)),d&&PU([o],GU(this._getPadding,o.radius/t,a)),BU([o],YU(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}XU.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const $U=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=$U(t.children):t.value=0),e+=Math.abs(t.value)})),e};function KU(t){return t.depth}function qU(t,e){return e-1-t.endDepth}const ZU=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),JU=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},QU={left:KU,right:qU,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?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:KU,end:qU},tG=vt(0,1);class eG{constructor(t){this._ascendingSourceBreadth=(t,e)=>ZU(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>ZU(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},eG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._logger=nt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):QU[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===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=[];$U(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=d(t.value)?0:kt(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=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=kt(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=!d(r.source),l=!d(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&&d(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=[JU(s[t.source]),JU(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=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,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*tG(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)}d(this.options.nodeSortBy)&&n.sort(ZU),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(ZU),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];iG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),sG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},nG.defaultOpionts,t):Object.assign({},nG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Bt(t,n))):Bt(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Bt(t,n))):Bt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Bt(r,n),i=(u-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-(_(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=CU(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=oe({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)}}}function rG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:iG,slice:rG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?rG:iG)(t,e,i,s,n)}};class lG{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=_(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=_(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=_(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=_(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({},lG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Ct(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?aG(this.options.aspectRatio):null!==(e=oG[this.options.splitType])&&void 0!==e?e:oG.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=CU(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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function hG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+oi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return nt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=hG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Mi(o.map(Mi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rAt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=cG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&nt.getInstance().error("Area "+r+" not represented on screen")}return i}function vG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ci((function(i){return-1*_G({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},bG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:G(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||uG,s=e.lossFunction||dG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];li(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rse.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:yG(l),arcs:l})}))},xG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:SG,triangle:SG,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 SG(){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 kG(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 AG=t=>xG[t]?xG[t]():xG.circle(),MG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function wG(t){return c(t)?t:function(){return t}}class TG{constructor(t){var e,i;switch(this.options=z({},TG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=AG(this.options.shape),this.getText=null!==(e=wG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=wG(this.options.fontWeight),this.getTextFontSize=wG(this.options.fontSize),this.getTextFontStyle=wG(this.options.fontStyle),this.getTextFontFamily=wG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>MG(10,50);break;case"random-light":this.getTextColor=()=>MG(50,90);break;default:this.getTextColor=wG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return ne(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():At(e);return ne(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&&!d(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 BG extends TG{constructor(t){var e;super(z({},BG.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<=BG.defaultOptions.minFontSize&&(this.options.minFontSize=BG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=CG[this.options.spiral])&&void 0!==e?e:CG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=wG(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}=kG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(OG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(RG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}OG(p,this._size)&&(p=IG(p,this._size))}else if(OG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||EG(p,i))&&(!i||!PG(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 PG(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 EG(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,OG=(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 IG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},DG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>oe(t,e,i+r*n)))},FG=(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()},zG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=kG(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=AG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return oe(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)FG(n,DG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)FG(n,DG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)FG(n,DG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)FG(n,DG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)FG(n,DG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=DG({x:l,y:h},o,-Math.PI/2,5),e=DG({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]);FG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let HG=class t extends CG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),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 B=[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]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:B,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(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(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?DG(t,o,l.width,l.height,h):"geometric"===t.type&&jG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=AG(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()}};HG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class VG extends CG{constructor(t){super(z({},VG.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)}VG.defaultOptions={enlarge:!1};const WG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},UG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return nt.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?GG(t.fontFamily):"sans-serif",d=t.fontStyle?GG(t.fontStyle):"normal",u=t.fontWeight?GG(t.fontWeight):"normal",p=t.rotate?GG(t.rotate):0,g=GG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?GG(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},WG),t.as):WG,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?GG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=XG($G(t,l),C);T=i=>e(t(i))}let B=PG;"fast"===t.layoutType?B=VG:"grid"===t.layoutType&&(B=HG);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},GG=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],YG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),XG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=YG(t[0]),n=YG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(YG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},$G=(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 KG(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{UO.registerGrammarTransform("wordcloud",{transform:UG}),zN(),UO.registerAnimation("wordCloud",((t,e)=>({appear:CU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),UO.registerSeries(qG.type,qG)},JG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},QG=(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},tY=`${pI}_FUNNEL_TRANSFORM_RATIO`,eY=`${pI}_FUNNEL_REACH_RATIO`,iY=`${pI}_FUNNEL_HEIGHT_RATIO`,sY=`${pI}_FUNNEL_VALUE_RATIO`,nY=`${pI}_FUNNEL_LAST_VALUE_RATIO`,rY=`${pI}_FUNNEL_NEXT_VALUE_RATIO`,aY=`${pI}_FUNNEL_LAST_VALUE`,oY=`${pI}_FUNNEL_CURRENT_VALUE`,lY=`${pI}_FUNNEL_NEXT_VALUE`,hY=`${pI}_FUNNEL_TRANSFORM_LEVEL`;class cY extends fF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[eY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class dY extends MD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class uY extends dY{constructor(){super(...arguments),this.type=uY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}uY.type="polygon";const pY=()=>{UO.registerMark(uY.type,uY),XA(),VA(),lT.registerBuiltInAnimate("growPointsOut",oC),UO.registerGraphicComponent("polygon",sf)},gY=Object.assign(Object.assign({},TF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class fY extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class mY extends UF{constructor(){super(...arguments),this.type=aO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=fY,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;gL(this._dataSet,"funnel",JG),gL(this._dataSet,"funnelTransform",QG);const t=new Ma(this._dataSet,{name:`${pI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new bD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:oY,asTransformRatio:tY,asReachRatio:eY,asHeightRatio:iY,asValueRatio:sY,asNextValueRatio:rY,asLastValueRatio:nY,asLastValue:aY,asNextValue:lY,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:hY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},mY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:jF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},mY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(mY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(mY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new cY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",XL.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",XL.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{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",XL.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",XL.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",XL.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===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",XL.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Iy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*sO(eY).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",XL.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(LF(null===(s=UO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),DF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(LF(UO.getAnimationInKey("fadeInOut")(),DF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(LF(UO.getAnimationInKey("funnel")({},o),DF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(LF(null===(a=UO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),DF("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[nY])/2:this._getSecondaryAxisLength(t[sY])/2,n=this._getSecondaryAxisLength(t[sY])/2):(s=this._getSecondaryAxisLength(t[sY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[rY])/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[hY])}_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 u(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[_I]===t[_I]));if(!u(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(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{pY(),zN(),qV(),UO.registerSeries(mY.type,mY),UO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},DD))),UO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:VT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:VT,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),zD()},_Y=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},yY=t=>{const e=t.filter((t=>t.context.diffState===$L.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},bY=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},xY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=yY(i.parent.children),a=bY(r,s,n);return _Y(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=yY(i.parent.children),a=bY(r,s,n);return _Y(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),SY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},kY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=yY(i.parent.children),a=SY(r);return _Y(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=yY(i.parent.children),a=SY(r);return _Y(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),AY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},MY=(t,e={})=>{if(!t)return[];const i=[];return RU(t,i,e),i},wY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new rG(i).layout(t,{width:s,height:n})};class TY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var CY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(CY||(CY={}));const BY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===CY.DrillDown){return G($I(t,n,s,"children"))}if(i.type===CY.DrillUp){const e=KI(t,n,s,"children");if(e)return G(e)}return t};class PY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=OV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;gL(t,"drillFilter",BY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||P(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:CY.DrillDown},e().reRunAllTransform(),i.emit(oL.drill,{value:{path:t,type:CY.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(!_(n)||P(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:CY.DrillUp},i().reRunAllTransform(),s.emit(oL.drill,{value:{path:n,type:CY.DrillUp},model:this}),n}}const EY=Object.assign(Object.assign({},TF),{sunburst:{name:"sunburst",type:"arc"}}),RY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:bF,operations:["max","min","values"]}),t.push({key:xF,operations:["values"]}),t),OY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class IY extends QN{constructor(){super(...arguments),this.type=aO.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:xF),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:_I},getRawData:()=>this.getRawData()}),this._startAngle=ne(this._spec.startAngle),this._endAngle=ne(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),gL(this._dataSet,"sunburstLayout",wY),gL(this._dataSet,"flatten",MY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 RY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(gL(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:wF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(IY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},KL.STATE_NORMAL,XL.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(IY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},KL.STATE_NORMAL,XL.Series)}initTooltip(){this._tooltipHelper=new TY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(LF(null===(e=UO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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}}IY.type=aO.sunburst,IY.mark=EY,IY.builtInTheme={sunburst:OY},U(IY,PY);const LY=()=>{UO.registerSeries(IY.type,IY),uW(),zN(),zD(),UO.registerAnimation("sunburst",((t,e)=>({appear:AY(0,e),enter:xY(t),exit:kY(t),disappear:kY(t)})))},DY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new $U(i).layout(t,{width:s,height:n})};class FY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const zY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},jY=Object.assign(Object.assign({},TF),{circlePacking:{name:"circlePacking",type:"arc"}});class HY extends XF{constructor(){super(...arguments),this.type=aO.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:xF),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:_I},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),gL(this._dataSet,"circlePackingLayout",DY),gL(this._dataSet,"flatten",MY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(gL(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:wF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(HY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},KL.STATE_NORMAL,XL.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(HY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},KL.STATE_NORMAL,XL.Series)}getStatisticFields(){return RY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new FY(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(LF(null===(i=UO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=aO.circlePacking,HY.mark=jY,HY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(HY,PY);const VY=()=>{UO.registerSeries(HY.type,HY),uW(),zN(),FD(),UO.registerAnimation("circlePacking",((t,e)=>({appear:zY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},NY=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&NY(t,e.children,i)}))},WY=t=>{var e;if(!t||!_(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},UY=(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 iG(e),r=[];return r.push(n.layout(s,i)),r},GY=t=>{var e,i;return t&&_(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:[]},YY=t=>{var e,i;return t&&_(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 XY extends fF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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 $Y=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),KY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:$Y(t),qY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class ZY extends yT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class JY extends yT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const QY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},tX=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class eX extends bN{constructor(){super(...arguments),this.type=eX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?tX:QY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}eX.type="linkPath";const iX=Object.assign(Object.assign({},TF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class sX extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const nX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class rX extends XF{constructor(){super(...arguments),this.type=aO.sankey,this.transformerConstructor=sX,this._nodeLayoutZIndex=GL.Node,this._labelLayoutZIndex=GL.Label,this._viewBox=new ze,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(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=iL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=iL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=iL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),nX(e,KL.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(KL.STATE_SANKEY_EMPHASIS),e.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=iL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=iL(n[0]))||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=iL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=iL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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=iL(s),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(KL.STATE_SANKEY_EMPHASIS_REVERSE),void nX(s,KL.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(KL.STATE_SANKEY_EMPHASIS_REVERSE),void nX(s,KL.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(KL.STATE_SANKEY_EMPHASIS),s.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(iL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=iL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=iL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void nX(t,KL.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void nX(t,KL.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void nX(t,KL.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,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){gL(this._dataSet,"sankeyLayout",UY),gL(this._dataSet,"sankeyFormat",WY),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:wL.sankeyLayout});const{dataSet:a}=this._option;gL(a,"sankeyNodes",GY),gL(a,"flatten",MY);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:kF.bind(this),call:AF}},!1),this._nodesSeriesData=o,gL(a,"sankeyLinks",YY);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:kF.bind(this),call:AF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(rX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(rX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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},KL.STATE_NORMAL,XL.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",XL.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},KL.STATE_NORMAL,XL.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",XL.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=nF(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(LF(null===(i=UO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),DF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),DF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:hL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([KL.STATE_SANKEY_EMPHASIS_REVERSE,KL.STATE_SANKEY_EMPHASIS]),e.includes(iL(t).key)?t.addState(KL.STATE_SANKEY_EMPHASIS,!0):t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new XY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new yO;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=>{u(t[i])&&e.add(t[i]),u(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 NY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}rX.type=aO.sankey,rX.transformerConstructor=sX,rX.mark=iX,rX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const aX=()=>{eV(),xN(),jA(),UO.registerGraphicComponent("path",(t=>Xg(t))),UO.registerMark(eX.type,eX),zN(),UO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:KY(t,e)},DD))),UO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:qY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lT.registerBuiltInAnimate("linkPathGrowOut",JY),lT.registerBuiltInAnimate("linkPathGrowIn",ZY),zD(),UO.registerSeries(rX.type,rX)},oX=(t,e)=>{let i={},s=e.fields;if(c(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=MY(n);return i=vF([{latestData:r}],e),i};class lX extends fF{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 hX=Object.assign(Object.assign({},TF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),cX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class dX extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const uX=(t,e)=>{if(e.getViewBox()){const i=new hG(e).layout(t,e.getViewBox()),s=[];return RU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[xF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class pX extends XF{constructor(){super(...arguments),this.type=aO.treemap,this.transformerConstructor=dX,this._categoryField="name",this._valueField="value",this._viewBox=new ze,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:xF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ve),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:_I},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),gL(this._dataSet,"treemap",uX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(gL(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:wF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=oX([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){gL(this._dataSet,"hierarchyDimensionStatistics",oX),gL(this._dataSet,"flatten",MY);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 RY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(pX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(pX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},KL.STATE_NORMAL,XL.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()},KL.STATE_NORMAL,XL.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.Series),this._initRichStyleOfLabelMark(t))}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},KL.STATE_NORMAL,XL.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),DF(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 lX(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(rL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(rL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}pX.type=aO.treemap,pX.mark=hX,pX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},pX.transformerConstructor=dX,U(pX,PY),U(pX,LV);const gX=()=>{UO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),UO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),eV(),zN(),UO.registerAnimation("treemap",((t,e)=>({appear:cX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),zD(),UO.registerSeries(pX.type,pX)},fX=Object.assign(Object.assign({},iU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),mX=Object.assign(Object.assign({},TF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),vX={type:"fadeIn"};function _X(t,e){return"fadeIn"===e?vX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class yX extends WF{constructor(){super(...arguments),this._supportStack=!1}}class bX extends fF{enableByType(t){return"dimension"!==t}}const xX="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",SX={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:xX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xX,fill:"#ddd"}}};class kX extends sU{constructor(){super(...arguments),this.type=aO.gaugePointer,this.transformerConstructor=yX,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(kX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},kX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(kX.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 bX(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 u(this.radiusAxisHelper)&&u(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=$(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(LF(null===(i=UO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}kX.type=aO.gaugePointer,kX.mark=mX,kX.builtInTheme={gaugePointer:SX},kX.transformerConstructor=yX;const AX=()=>{UO.registerSeries(kX.type,kX),CV(),eV(),UO.registerAnimation("gaugePointer",((t,e)=>{const i=_X(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),LW(),OW()};class MX extends WF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class wX extends sU{constructor(){super(...arguments),this.type=aO.gauge,this.transformerConstructor=MX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ne(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();gL(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[FI]=t[this._angleField[0]],t[DI]=e>0?i[e-1][FI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(wX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(wX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,XL.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?SO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?SO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[DI])?this.angleAxisHelper.dataToPosition([t[DI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FI]])}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(LF(null===(i=UO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}wX.type=aO.gauge,wX.mark=fX,wX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},wX.transformerConstructor=MX;class TX extends MD{constructor(){super(...arguments),this.type=TX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Sg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}TX.type="cell";function CX(t){return!1===t?{}:{type:"fadeIn"}}class BX extends fF{enableByType(t){return"dimension"!==t}}const PX=Object.assign(Object.assign({},TF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class EX extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class RX extends XF{constructor(){super(...arguments),this.type=aO.heatmap,this.transformerConstructor=EX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(RX.mark.cell,{isSeriesMark:!0},{morph:jF(this._spec,RX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(RX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",XL.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=si(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",XL.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=YF(this);this._cellMark.setAnimationConfig(LF(null===(i=UO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),DF("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 BX(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]}}RX.type=aO.heatmap,RX.mark=PX,RX.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},RX.transformerConstructor=EX;const OX=()=>{zN(),UO.registerMark(TX.type,TX),UO.registerGraphicComponent("symbol",Sg),XA(),KA(),OP(),UO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},DD),{appear:CX(e)}))),Cj(),Aj(),UO.registerSeries(RX.type,RX)},IX=Object.assign(Object.assign({},TF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),LX=`${pI}_CORRELATION_X`,DX=`${pI}_CORRELATION_Y`,FX=`${pI}_CORRELATION_SIZE`,zX=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=ne(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=ne(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Bt(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Bt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Ct(e.field),C=t.map(T),[B,P]=Et(C),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),R=d(e.radiusField)?T:Ct(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Et(t.map(R)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=jX(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=E(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),HX({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,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},HX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[vI]:null==n?void 0:n[vI],[yI]:null==n?void 0:n[yI]}};class NX extends bN{constructor(){super(...arguments),this.type=NX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=ft(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}NX.type="ripple";const WX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class UX extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class GX extends QN{constructor(){super(...arguments),this.type=aO.correlation,this.transformerConstructor=UX,this._viewBox=new ze}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;gL(this._dataSet,"correlation",zX);const s=new Aa;fL(s,"dataview",xa),gL(s,"correlationCenter",VX);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 bD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(GX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:vI});t&&(t.setMarkConfig({zIndex:GL.Node}),this._nodePointMark=t);const e=this._createMark(GX.mark.ripplePoint,{key:vI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(GX.mark.centerPoint,{key:vI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:GL.Node}),this._centerPointMark=i)}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[LX],y:t=>t[DX],size:t=>t[FX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.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)},KL.STATE_NORMAL,XL.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),DF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}GX.type=aO.correlation,GX.mark=IX,GX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},GX.transformerConstructor=UX;const YX=()=>{yz(),xN(),KA(),UO.registerMark(NX.type,NX),UO.registerGraphicComponent("symbol",(t=>Sg(t))),UO.registerSeries(GX.type,GX),UO.registerAnimation("correlation",((t,e)=>Object.assign({appear:WX(0,e)},LD)))},XX=Object.assign(Object.assign({},TF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class $X extends bN{constructor(){super(...arguments),this.type=$X.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}$X.type="liquid";const KX=(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 qX extends fF{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 ZX extends UF{constructor(){super(...arguments),this.type=aO.liquid,this.transformerConstructor=bz,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Bg({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=Sg({x:s,y:n,size:r,symbolType:KX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=PO(this._spec.outlineMargin),this._paddingSpec=PO(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=Wt(...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(ZX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(ZX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(ZX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(ZX.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",XL.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",XL.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",XL.Series)}initTooltip(){this._tooltipHelper=new qX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(LF(null===(i=UO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),DF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(LF(null===(s=UO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),DF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(oL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=yM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}ZX.type=aO.liquid,ZX.mark=XX,ZX.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},ZX.transformerConstructor=bz;const JX=t=>G(t).join(",");class QX extends fF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>JX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>JX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const t$=Object.assign(Object.assign({},TF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class e$ extends WF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const i$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?xG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class s$ extends UF{constructor(){super(...arguments),this.type=aO.venn,this.transformerConstructor=e$,this._viewBox=new ze}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:_I)}initData(){var t;super.initData(),gL(this._dataSet,"venn",i$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(s$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(s$.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()},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},KL.STATE_HOVER,XL.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>JX(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)}},KL.STATE_NORMAL,XL.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>JX(t.sets)},KL.STATE_NORMAL,XL.Series))}initTooltip(){this._tooltipHelper=new QX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:JX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return JX(i)}legendSelectedFilter(t,e){if(t.type===n.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[JX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(JX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(LF(null===(e=UO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}}s$.type=aO.venn,s$.mark=t$,s$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},s$.transformerConstructor=e$;class n$ extends aV{constructor(){super(...arguments),this.type=aO.mosaic,this.transformerConstructor=rV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(OI),this.setFieldX2(RI)),this.setFieldY(LI),this.setFieldY2(II)):(t&&(this.setFieldY(OI),this.setFieldY2(RI)),this.setFieldX(LI),this.setFieldX2(II)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}n$.type=aO.mosaic,n$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},n$.transformerConstructor=rV;class r$ extends tH{_isValidSeries(t){return t===aO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class a$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=r$,this.type="map",this.seriesType=aO.map}}a$.type="map",a$.seriesType=aO.map,a$.transformerConstructor=r$;const o$=()=>{IH(),zV(),CV(),UO.registerSeries(HV.type,HV),UO.registerImplement("registerMap",yL),UO.registerImplement("unregisterMap",bL),zD(),UO.registerChart(a$.type,a$)};class l$ extends tH{_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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class h$ extends l${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=Rz(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,WO({},s,l)),n&&Object.assign(o,WO({},n,o))}}class c$ extends l${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class d$ extends l${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class u$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=d$}}u$.transformerConstructor=d$;class p$ extends u${constructor(){super(...arguments),this.transformerConstructor=d$,this.type="pie",this.seriesType=aO.pie}}p$.type="pie",p$.seriesType=aO.pie,p$.transformerConstructor=d$;class g$ extends c${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:$z,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:$z,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>WO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const f$=(t,e)=>{if(!t)return null;const i=oz(t,(t=>"angle"===t.getOrient()),e),s=oz(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&&JC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=ZR({x:1,y:0},u);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=JR(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=rz(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&&JC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=ZR({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=JR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=rz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class m$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=g$,this.type="rose",this.seriesType=aO.rose}_setModelOption(){this._modelOption.getDimensionInfo=f$}}m$.type="rose",m$.seriesType=aO.rose,m$.transformerConstructor=g$,U(m$,rH);const v$=()=>{RH(),IH(),hH(),lH(),FW(),UO.registerChart(m$.type,m$)};class _$ extends c${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=WO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>WO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class y$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=_$,this.type="radar",this.seriesType=aO.radar}_setModelOption(){this._modelOption.getDimensionInfo=f$}}y$.type="radar",y$.seriesType=aO.radar,y$.transformerConstructor=_$,U(y$,rH);const b$=()=>{RH(),IH(),DH(),hH(),lH(),YW(),UO.registerChart(y$.type,y$)};class x$ extends tH{_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=p(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=>{E(e,"trimPadding")&&WO(e,VL(this.type,t))})),this._transformAxisSpec(t)}}class S$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=x$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=fH(t,e,i))&&void 0!==s?s:[],...null!==(n=f$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}S$.type="common",S$.transformerConstructor=x$,U(S$,rH);class k$ extends eH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class A$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=k$}}A$.transformerConstructor=k$,U(A$,rH);class M$ extends k${transformSpec(t){super.transformSpec(t),zL(t)}}class w$ extends A${constructor(){super(...arguments),this.transformerConstructor=M$,this.type="histogram",this.seriesType=aO.bar}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}w$.type="histogram",w$.seriesType=aO.bar,w$.transformerConstructor=M$;const T$=()=>{RH(),IH(),DH(),hH(),lH(),oV(),UO.registerChart(w$.type,w$)};class C$ extends h${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class B$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=C$,this.type="circularProgress",this.seriesType=aO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=f$}}B$.type="circularProgress",B$.seriesType=aO.circularProgress,B$.transformerConstructor=C$,U(B$,rH);const P$=()=>{RH(),IH(),hH(),lH(),cU(),UO.registerChart(B$.type,B$)};class E$ extends h${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=aO.circularProgress,e}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===aO.gauge||t.type===aO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(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===aO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:GL.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)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=GL.Region+50)}}class R$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=E$,this.type="gauge",this.seriesType=aO.gaugePointer}}R$.type="gauge",R$.seriesType=aO.gaugePointer,R$.transformerConstructor=E$;const O$=()=>{IH(),AX(),UO.registerSeries(wX.type,wX),uW(),oU(),OW(),cU(),UO.registerChart(R$.type,R$)};class I$ extends tH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class L$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="wordCloud",this.seriesType=aO.wordCloud}}L$.transformerConstructor=I$;class D$ extends L${constructor(){super(...arguments),this.transformerConstructor=I$,this.type="wordCloud",this.seriesType=aO.wordCloud}}D$.type="wordCloud",D$.seriesType=aO.wordCloud,D$.transformerConstructor=I$;const F$=()=>{IH(),ZG(),UO.registerChart(D$.type,D$)};class z$ extends tH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class j$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=z$,this.type="funnel",this.seriesType=aO.funnel}}j$.type="funnel",j$.seriesType=aO.funnel,j$.transformerConstructor=z$;const H$=()=>{IH(),vY(),UO.registerChart(j$.type,j$)};class V$ extends eH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=Rz(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=Rz(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class N$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="linearProgress",this.seriesType=aO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}N$.type="linearProgress",N$.seriesType=aO.linearProgress,N$.transformerConstructor=V$,U(N$,rH);const W$=()=>{RH(),IH(),hH(),lH(),_U(),UO.registerChart(N$.type,N$)};class U$ extends eH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),zL(t)}}class G$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="rangeColumn",this.seriesType=aO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}G$.type="rangeColumn",G$.seriesType=aO.rangeColumn,G$.transformerConstructor=U$;const Y$=()=>{RH(),IH(),hH(),lH(),XN(),UO.registerChart(G$.type,G$)};class X$ extends tH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+re(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="sunburst",this.seriesType=aO.sunburst}}$$.type="sunburst",$$.seriesType=aO.sunburst,$$.transformerConstructor=X$;const K$=()=>{IH(),LY(),UO.registerChart($$.type,$$)};class q$ extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Z$ extends Jj{constructor(){super(...arguments),this.transformerConstructor=q$,this.type="circlePacking",this.seriesType=aO.circlePacking}}Z$.type="circlePacking",Z$.seriesType=aO.circlePacking,Z$.transformerConstructor=q$;const J$=()=>{IH(),VY(),UO.registerChart(Z$.type,Z$)};class Q$ extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class tK extends Jj{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="treemap",this.seriesType=aO.treemap}}tK.type="treemap",tK.seriesType=aO.treemap,tK.transformerConstructor=Q$;const eK=()=>{IH(),gX(),UO.registerChart(tK.type,tK)};class iK extends lV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),zL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class sK extends hV{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="waterfall",this.seriesType=aO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}sK.type="waterfall",sK.seriesType=aO.waterfall,sK.transformerConstructor=iK;const nK=()=>{RH(),IH(),DH(),hH(),lH(),fN(),UO.registerChart(sK.type,sK)};class rK extends eH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),zL(t)}}class aK extends Jj{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="boxPlot",this.seriesType=aO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}aK.type="boxPlot",aK.seriesType=aO.boxPlot,aK.transformerConstructor=rK;const oK=()=>{RH(),IH(),hH(),lH(),DN(),UO.registerChart(aK.type,aK)};class lK extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hK extends Jj{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="sankey",this.seriesType=aO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=iL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}hK.type="sankey",hK.seriesType=aO.sankey,hK.transformerConstructor=lK;const cK=()=>{IH(),Ch.load(uM),aX(),UO.registerChart(hK.type,hK)};class dK extends eH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),zL(t)}}class uK extends Jj{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="rangeArea",this.seriesType=aO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=kH}}uK.type="rangeArea",uK.seriesType=aO.rangeArea,uK.transformerConstructor=dK;const pK=()=>{RH(),IH(),DH(),hH(),lH(),HH(),Cj(),Aj(),UO.registerSeries(JN.type,JN),UO.registerChart(uK.type,uK)};class gK extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class fK extends Jj{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=aO.heatmap}}fK.type="heatmap",fK.seriesType=aO.heatmap,fK.transformerConstructor=gK;const mK=()=>{IH(),OX(),UO.registerChart(fK.type,fK)};class vK extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _K extends Jj{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="correlation",this.seriesType=aO.correlation}}_K.type="correlation",_K.seriesType=aO.correlation,_K.transformerConstructor=vK;const yK=()=>{IH(),YX(),UO.registerChart(_K.type,_K)};function bK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=tL(t.style)),P(t.textStyle)||WO(s.textStyle,tL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&tL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&tL(s.background.style),s}const xK=(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},SK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:yI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class kK extends tj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=GL.Legend,this.layoutLevel=YL.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),tO(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=AO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new bD(this._option,t),this._initSelectedData(),tO(this._regions,(t=>{t.event.on(oL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(tO(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(oL.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;k(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)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(WO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(WO({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(WO({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(oL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}kK.specKey="legends";class AK extends kK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return rF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),tO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:wL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){gL(this._option.dataSet,"discreteLegendFilter",SK),gL(this._option.dataSet,"discreteLegendDataMake",xK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return tO(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!Xy(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 c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=VI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:p,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:_,padding:y}=e,b=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?b.title=bK(s):b.title={visible:!1},P(n.focusIconStyle)||tL(n.focusIconStyle),n.shape&&(n.shape=ZI(n.shape)),n.label&&(n.label=ZI(n.label)),n.value&&(n.value=ZI(n.value)),n.background&&(n.background=ZI(n.background)),MO(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),MO(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),MO(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||tL(r.railStyle),P(r.sliderStyle)||tL(r.sliderStyle)):(P(r.textStyle)||tL(r.textStyle),r.handler&&ZI(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(WO(b,a.style),u(a.padding)&&(b.padding=a.padding)),b}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return lR}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(eR.legendItemClick,(e=>{const i=E(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(oL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(eR.legendItemHover,(t=>{const e=E(t,"detail");this.event.emit(oL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(eR.legendItemUnHover,(t=>{const e=E(t,"detail");this.event.emit(oL.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:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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 c(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}=nF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=nF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}AK.specKey="legends",AK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},AK.type=n.discreteLegend;const MK=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},wK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?qI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const TK={color:pR,size:fR},CK={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}},BK=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({},CK),{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"}}}})},PK={horizontal:BK(!0),vertical:BK(!1)},EK=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({},CK),{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"}}}})},RK={horizontal:EK(!0),vertical:EK(!1)},OK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],IK=[2,10];class LK extends kK{static getSpecInfo(t){const e=rF(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?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),tO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:wL.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(){gL(this._option.dataSet,"continuousLegendFilter",wK),gL(this._option.dataSet,"continuousLegendDataMake",MK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>eO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=VI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=VI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),P(a)&&(a="color"===this._legendType?OK:IK);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(e){const i=WO({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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=bK(s):T.title={visible:!1},T.showHandler=!1!==n.visible,P(n.style)||(T.handlerStyle=tL(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),P(r.style)||(T.railStyle=tL(r.style)),P(a.style)||(T.trackStyle=tL(a.style)),T.startText=ZI(o),T.endText=ZI(l),T.handlerText=ZI(h),P(c)||(T.sizeBackground=tL(c)),d.visible&&!P(d.style)&&(WO(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return TK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",yt((e=>{const i=E(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(oL.legendFilter,{model:this,value:i,event:e})}),30))}}}LK.specKey="legends",LK.builtInTheme={colorLegend:PK,sizeLegend:RK},LK.type=n.continuousLegend;const DK=()=>{UO.registerComponent(LK.type,LK)},FK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,zK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),jK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function HK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(u(a.regionId)?[a.regionId]:void 0,u(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=VK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",p=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=>zK(i,s)(t)&&zK(n,r)(t)&&(d(a)||zK([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:p.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:p.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:[]}}))}];u(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:lL.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return JD.globalConfig.uniqueTooltip&&JD.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:lL.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return JD.globalConfig.uniqueTooltip&&JD.hideTooltip(l.id),c}return"none"}const VK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=FK(c,t);let _=FK(p,t);const y=jK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(zK(c,v));if(!y&&(_=FK(p,i),!jK(_)))return;const n=e.type===aO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=JC(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])=>d(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(zK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=FK(p,o),!jK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(zK(c,n));if(!y&&(_=FK(p,r),!jK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===aO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(zK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=FK(p,i),!jK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},NK=t=>u(t)&&!_(t),WK=t=>u(t)&&_(t);class UK extends Qz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=WO({},this._theme,r.style),r.offset=WO({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(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:Wy(this._option.mode)||!Vy(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,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=__.getElementById(t.parentElement)):Vy(this._option.mode)&&(t.parentElement=null==Hy?void 0:Hy.body)}}const GK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class YK extends tj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=UK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Vy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&NK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!d(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&&JD.globalConfig.uniqueTooltip&&l&&JD.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(oL.tooltipHide,Object.assign(Object.assign({},t),{source:lL.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=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:lL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(oL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(oL.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?TH.canvas:TH.dom,n=UO.getComponentPluginInType(t);n||Fy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=UO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Ny(s)||Wy(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))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(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=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,bt(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=HK(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(d(this._cacheInfo)||d(t))return!1;if(WK(t)){if(NK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>sz(t,e[i])))}if(WK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}YK.type=n.tooltip,YK.transformerConstructor=UK,YK.builtInTheme={tooltip:GK},YK.specKey="tooltip";var XK,$K;!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"}($K||($K={}));const KK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class qK extends tj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=GL.CrossHair_Grid,this.labelZIndex=GL.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),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=bt((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(p(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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{JC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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:hL.chart}:{source:lL.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Ny(t)||Wy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.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:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(oL.tooltipHide,{source:lL.chart},this._handleTooltipHideOrRelease),this.event.on(oL.tooltipShow,{source:lL.chart},this._handleTooltipShow),this.event.on(oL.tooltipRelease,{source:lL.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=E(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{KK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=E(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=E(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:E(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}qK.specKey="crosshair";const ZK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class JK extends qK{static getSpecInfo(t){return rF(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=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=$F(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){$F(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:KF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=iO(this._regions,"cartesian");e&&(_H(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=xH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new sw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new nw(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}JK.specKey="crosshair",JK.builtInTheme={crosshair:ZK},JK.type=n.cartesianCrosshair;class QK extends qK{static getSpecInfo(t){return rF(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=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=iO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Ez(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=nF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:oe(d,a.getInnerRadius(),o),end:oe(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=he(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=oe(t,o,r),d=oe(t,o,h),m=fe([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=ft(se.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new sw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new aw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new ow(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new rw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ce(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}}(u):function(t){let e="center",i="middle";return e=(t=ce(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?oe(e,p[1]+m.offset,u):oe(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}QK.specKey="crosshair",QK.builtInTheme={crosshair:ZK},QK.type=n.polarCrosshair;const tq=()=>{UO.registerComponent(QK.type,QK)},eq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},iq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},sq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let u=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&(u=!0,r.domain.forEach((t=>{d(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),d(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=u?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class nq extends tj{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),tO(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=ft(this._start+f,0,1),_=ft(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ht(s/n)>=.5:Ht(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=ZF(t),this._isHorizontal="horizontal"===JF(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(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!qC(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(qC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(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?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];let s;if(this._relatedAxisComponent){const n={};tO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?G(u.xField):G(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?G(u.yField):G(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,qC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;qC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else tO(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:n}=this._option;fL(n,"dataview",xa),gL(n,"dataFilterComputeDomain",sq);const r=new Ma(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new bD(this._option,r),r.reRunAllTransform(),n.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(qC(e.type))return this._isReverse()?i[0]+(Y(i)-i[0])*(1-t):i[0]+(Y(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(Y(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&&qC(e.type)&&(s=s.slice().reverse()),(i-s[0])/(Y(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&u(this._spec.start)||"value"===e&&u(this._spec.startValue):"percent"===e&&u(this._spec.end)||"value"===e&&u(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,qC(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(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=qC(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new yB,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||(gL(this._option.dataSet,"dataFilterWithNewDomain",iq),gL(this._option.dataSet,"lockStatisticsFilter",eq),tO(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:()=>qC(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:()=>qC(this._stateScale.type)},level:wL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}_parseDomainFromState(t,e){if(qC(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,o;const l={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=bt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}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]:XL.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=this._getAxisBandSize(h);if(!this._dataUpdating&&JC(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,JC(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}clear(){this._throttledHide=null}}U(nq,LV);class rq extends Qz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=WO({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const aq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),oq={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:aq(!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:aq(!0)};class lq extends nq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=rq,this.specKey="dataZoom",this.layoutZIndex=GL.DataZoom,this.layoutLevel=YL.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,c;super.setAttrFromSpec(),h(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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new HB;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?[$(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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(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(!qC(t.type)||e[0]!==Y(e))&&(!JC(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(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:u(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 iE(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);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(oL.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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:tL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:tL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:tL(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:tL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:tL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:tL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:tL(g.style)},selectedBackgroundStyle:tL(this._spec.selectedBackground.style),dragMaskStyle:tL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:WO(tL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},tL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:WO(tL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},tL(null===(d=m.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}=nF(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()}}lq.type=n.dataZoom,lq.transformerConstructor=rq,lq.builtInTheme={dataZoom:oq},lq.specKey="dataZoom";const hq=()=>{UO.registerComponent(lq.type,lq)},cq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class dq extends nq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=GL.DataZoom,this.layoutLevel=YL.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),h(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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return x(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:u(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 lM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=GR(this._start,t)&&GR(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this.statePointToData(t),n=this.statePointToData(e);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this.statePointToData(t),this.statePointToData(e)))&&this.event.emit(oL.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()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=tL(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=tL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}dq.type=n.scrollBar,dq.builtInTheme={scrollBar:cq},dq.specKey="scrollBar";const uq=()=>{UO.registerComponent(dq.type,dq)},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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},gq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),fq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:gq("l1FontSize","primaryFontColor")},content:{visible:!0,style:gq("l2FontSize","tertiaryFontColor")}};class mq extends tj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=GL.Indicator,this.layoutLevel=YL.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return rF(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=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(iL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(iL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){gL(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 bD(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 e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=WO({},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({},QI(j(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?RO(l,this._computeLayoutRadius()):0,dy:h?RO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(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({},QI(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_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)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new _R(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]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}mq.type=n.indicator,mq.builtInTheme={indicator:fq},mq.specKey="indicator";const vq=()=>{UO.registerComponent(mq.type,mq)},_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=$(s),r=X(s);return er}function bq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(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=MO(t.x)?Aq(t.x,n)+r.x:Mq(l.getXAxisHelper(),[t.x])+r.x,h}function xq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(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=MO(t.y)?Aq(t.y,n)+r.y:Mq(l.getYAxisHelper(),[t.y])+r.y,h}function Sq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(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)),Mq(a.angleAxisHelper,[t.angle])}function kq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(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)),Mq(a.radiusAxisHelper,[t.radius])}function Aq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Mq(t,e){const i=t.getScale(0);return qC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function wq(t){return _q.includes(t)}function Tq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=bq(t,_,n,p,c,o),r=xq(t,y,n,p,d,o),Cq(s,b,S,g.length),Cq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=bq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);Cq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=xq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);Cq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function Cq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(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 Pq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=MO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=MO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(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===S.length&&x(S[0])&&yq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:Mq(d.getXAxisHelper(),b)+p.x+m,y:Mq(d.getYAxisHelper(),S)+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=G(t.angle),u=G(t.radius);1===d.length&&x(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&&x(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:Mq(l.angleAxisHelper,d),radius:Mq(l.radiusAxisHelper,u)})})),s}function Rq(t,e,i){let{x:s,y:n}=t;return MO(s)&&(s=Aq(s,e)),MO(n)&&(n=Aq(n,i)),{x:s,y:n}}function Oq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(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}=Rq(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=>Rq(t,n,r)))}function Iq(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 Lq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},tL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Fq(tL(n.style),i,s)),u(n.padding)&&(t.padding=si(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Fq(tL(r),i,s)),t}return{visible:!1}}function Dq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function Fq(t,e,i){return c(t)?t(e,i):t}function zq(t,e){return c(t)?t(e):t}function jq(t,e,i){return u(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 Hq(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function Vq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Hq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Nq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Hq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Wq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function Uq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(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;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&wq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&wq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&wq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&wq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>Yq(i,e,t))):i.x=Yq(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>Yq(i,e,t))):i.y=Yq(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>Yq(i,e,t))):i.angle=Yq(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>Yq(i,e,t))):i.radius=Yq(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=Yq(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const Gq={min:(t,e)=>YR(t[0].latestData,e.field),max:(t,e)=>XR(t[0].latestData,e.field),sum:function(t,e){return $R(t[0].latestData,e.field)},average:function(t,e){return KR(t[0].latestData,e.field)},variance:function(t,e){return qR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(qR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return lt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Yq(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Gq[i](e,{field:s})}return t}function Xq(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 tj{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 rF(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 v(e)&&wq(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=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Aa;return e.registerParser("array",i),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(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=iO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=TO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=TO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();gL(this._option.dataSet,"markerAggregation",Uq),gL(this._option.dataSet,"markerFilter",Xq);const i=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Kq(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=YR(t,e),r=XR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class qq extends $q{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=GL.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Vq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Fq(tL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Lq(t,this._markerData,this._markAttributeContext))),state:{line:Dq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:Dq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:Dq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return Dq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return Dq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Fq(tL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Fq(tL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Iq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Vq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;gL(this._option.dataSet,"markerAggregation",Uq),gL(this._option.dataSet,"markerRegression",Kq),gL(this._option.dataSet,"markerFilter",Xq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ma(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}qq.specKey="markLine";const Zq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Jq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Qq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Zq(!1),endSymbol:Zq(!0),label:Jq};class tZ extends qq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new VE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Vq(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=Tq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Pq(i,r,d,e.coordinatesOffset):c&&(y=Oq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(MO(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:p}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&u(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=G(n.label),_=G(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:p,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=Vq(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&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}tZ.type=n.markLine,tZ.coordinateType="cartesian",tZ.builtInTheme={markLine:Qq};const eZ=()=>{UO.registerComponent(tZ.type,tZ),HE()};class iZ extends qq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Vq(this._spec);return e||i?new UE(t):new VE(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}=Vq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Bq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>oe(f,t.radius,t.angle)))}}else u&&(p=Eq(i,r,a),g={points:p.map((t=>oe(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Vq(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}}}iZ.type=n.polarMarkLine,iZ.coordinateType="polar",iZ.builtInTheme={polarMarkLine:Qq};const sZ=()=>{UO.registerComponent(iZ.type,iZ),UE._animate=xE,HE()};class nZ extends tj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=GL.Title,this.layoutLevel=YL.Title,this._orient="top",this._orient=AO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return rF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=TO(this._spec.width,l.width,null,l.width),c=TO(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),p=Object.assign(Object.assign({},j(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 u(this._spec.width)&&(p.textStyle.width=Math.max(h,l.width),p.subtextStyle.width=p.textStyle.width),p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new mR(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}}nZ.type=n.title,nZ.specKey=n.title,nZ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const rZ=()=>{UO.registerComponent(nZ.type,nZ)};class aZ extends $q{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=GL.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Nq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Fq(tL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Lq(t,this._markerData,this._markAttributeContext))),state:{area:Dq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>Dq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return Dq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Iq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Nq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}aZ.specKey="markArea";const oZ={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class lZ extends aZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new WE(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Nq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=Tq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=Tq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=Pq(s,a,p,i.coordinatesOffset):d&&(f=Oq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Nq(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}}}lZ.type=n.markArea,lZ.coordinateType="cartesian",lZ.builtInTheme={markArea:oZ};const hZ=()=>{UO.registerComponent(lZ.type,lZ),NE()};class cZ extends aZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Nq(this._spec);return i||e||s?new GE(t):new WE(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}=Nq(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=Bq(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=>oe(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Nq(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}}}cZ.type=n.polarMarkArea,cZ.coordinateType="polar",cZ.builtInTheme={polarMarkArea:oZ};const dZ=()=>{UO.registerComponent(cZ.type,cZ),GE._animate=kE,NE()},uZ=t=>tL(Object.assign({},t)),pZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},tL(t.style))}),gZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=uZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=uZ(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:{},tL(Object.assign({},y)));var y;const b=pZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=pZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=pZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=pZ(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},fZ=t=>"left"===t||"right"===t,mZ=t=>"top"===t||"bottom"===t,vZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class _Z extends tj{constructor(){super(...arguments),this.layoutZIndex=GL.Player,this.layoutLevel=YL.Player,this.specKey="player",this.type=n.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({},gZ(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({},gZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new RR(t):this._playerComponent=new LR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=fZ(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=fZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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(oL.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(wR.end,(()=>{var t;this.event.emit(oL.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(wR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(wR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.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),k(t.x)){const e=fZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=mZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):fZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):mZ(this._orient)?this._maxSize():t.height}_computeDx(t){return fZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return mZ(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];this._option.globalInstance.updateFullData(e.data),this.event.emit(oL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}_Z.builtInTheme={player:vZ},_Z.specKey="player",_Z.type=n.player;const yZ=()=>{UO.registerComponent(_Z.type,_Z)};class bZ extends tj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=GL.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=gO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==$L.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}bZ.type=n.label;class xZ extends FN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}xZ.type="text",xZ.constructorType="label";const SZ=()=>{zN(),UO.registerMark(xZ.constructorType,xZ)};class kZ extends Qz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class AZ extends bZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=kZ,this.layoutZIndex=GL.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(oL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(rL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(rL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),tO(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{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),c(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",XL.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=WO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},sN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[EI])):t=>t.filter((t=>t.data[PI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?nN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}AZ.type=n.label,AZ.specKey="label",AZ.transformerConstructor=kZ;class MZ extends bZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=GL.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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[CI]},"normal",XL.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return WO({textStyle:{pickable:!0===this._spec.interactive},position:wZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[EI]:t.data[PI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>nN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function wZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}MZ.type=n.totalLabel,MZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},MZ.specKey="totalLabel";const TZ=()=>{UO.registerGraphicComponent(MZ.type,(t=>new WP(t))),SZ(),nj(),UO.registerComponent(MZ.type,MZ,!0)};class CZ extends $q{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=GL.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Wq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R;const{itemContent:O={},itemLine:I={},targetSymbol:L={}}=this._spec,D=O,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:X,customMarkStyle:$,style:K={},state:q={}}=D,Z=t(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(e=null==j?void 0:j.state)&&void 0!==e?e:q,tt={dx:0,dy:0},Q=Lq(z(tt,null!==(i=null!=j?j:U)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=Fq(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:X)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=tL(Fq(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=Fq(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=Fq(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:$)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:zq(O.offsetX,this._relativeSeries.getRegion()),offsetY:zq(O.offsetX,this._relativeSeries.getRegion())},Z),{style:Fq(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=L.offset)&&void 0!==y?y:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:Fq(L.style,this._markerData,this._markAttributeContext)},state:{line:Dq(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:Dq(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:Dq(null!==(T=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),itemContent:Dq(J,this._markerData,this._markAttributeContext),textBackground:Dq(null===(B=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:Dq(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=t(I,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:tL(st.style)}):{visible:!1};return new XE(et)}_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}=Iq([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:jq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:jq(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}=Wq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}CZ.specKey="markPoint";const BZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class PZ extends CZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=Tq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=Pq(n,r,h,s.coordinatesOffset)[0]:l&&(c=Oq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Wq(t),i=u(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}}}PZ.type=n.markPoint,PZ.coordinateType="cartesian",PZ.builtInTheme={markPoint:BZ};const EZ=()=>{UO.registerComponent(PZ.type,PZ),YE()};class RZ extends CZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Bq(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:oe({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}])]}}}RZ.type=n.polarMarkPoint,RZ.coordinateType="polar",RZ.builtInTheme={polarMarkPoint:BZ};const OZ=()=>{UO.registerComponent(RZ.type,RZ),YE()};class IZ extends CZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}IZ.type=n.geoMarkPoint,IZ.coordinateType="geo",IZ.builtInTheme={geoMarkPoint:BZ};const LZ=()=>{UO.registerComponent(IZ.type,IZ),YE()},DZ="inBrush",FZ="outOfBrush";class zZ extends tj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=GL.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return rF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),DZ,XL.Series),i.setMarkStyle(s,Object.assign({},e),FZ,XL.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new jR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:tL(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),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(OR.brushActive,(i=>{this._initMarkBrushState(e,FZ),this._emitEvent(oL.brushActive,t)})),r.addEventListener(OR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(oL.brushStart,t)})),r.addEventListener(OR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(oL.brushStart,t)})),r.addEventListener(OR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(oL.brushChange,t)})),r.addEventListener(OR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(oL.brushChange,t)})),r.addEventListener(OR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(oL.brushClear,t)})),r.addEventListener(OR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(oL.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(oL.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(oL.brushEnd,t)}})),r.addEventListener(OR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(oL.brushEnd,t)}))}_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]}}_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({},tL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(DZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(DZ),i.addState(FZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(DZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(DZ),i.addState(FZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ce(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(DZ),s.removeState(FZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}zZ.type=n.brush,zZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},zZ.specKey="brush";const jZ=()=>{UO.registerComponent(zZ.type,zZ)};class HZ extends tj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=GL.CustomMark,this.layoutLevel=YL.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${pI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=LF({},DF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(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 N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ze).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ze;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}HZ.type=n.customMark,HZ.specKey="customMark";const VZ=()=>{UO.registerComponent(HZ.type,HZ)};class NZ{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||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>WZ(t))),a=n.filter((t=>!WZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>WZ(t))),h=o.filter((t=>!WZ(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function WZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}NZ.type="grid";const UZ=()=>{UO.registerLayout(NZ.type,NZ)},GZ=()=>{Ch.load(ew)},YZ="vchart-tooltip",XZ=`${YZ}-container`,$Z=`${YZ}-title`,KZ=`${YZ}-content-box`,qZ={offsetX:10,offsetY:10},ZZ="99999999999999";function JZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const QZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,tJ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?JZ(t):"",eJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},iJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},sJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=iJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class nJ extends Cz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=cF(null==w?void 0:w.position,b,e),C=null!==(r=cF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.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:gI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:fI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Vy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!E){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=QZ(e,F),V=QZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(sJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=eJ(t,_),U.top=eJ(i,_),U.right=eJ(e,_),U.bottom=eJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=eJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?O:I,n="x"===t?A:M,r=sJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",aJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=rJ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=rJ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},oJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?TO(e,t.fontSize):0},lJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=si(r),a.padding=rJ(o)),{panelStyle:a,panelPadding:o}};function hJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const cJ=t=>{UO.registerComponentPlugin(t.type,t)};class dJ extends nJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(dJ.type),this.type=TH.dom,this._tooltipContainer=null==Hy?void 0:Hy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Hy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=lJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:rJ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=aJ(h),x=aJ(u),S=aJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=rJ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=rJ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=rJ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(oJ(p),oJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes($Z))),l=a.find((t=>t.className.includes(KZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add($Z),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(hJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${YZ}-column`),e.classList.add(`${YZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(KZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];hJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));hJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${YZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=tJ(e.key),e.keyStyle&&aJ(e.keyStyle,l)):"value"===i?(o.innerHTML=tJ(e.value),e.valueStyle&&aJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?JZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?JZ(c):m,y=g,b=t=>new xg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ze));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=hh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?JZ(u):"currentColor",`\n \n \n \n `;const T=w?hh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),hJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(KZ))),h=[...o.children].find((t=>t.className.includes($Z)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes($Z)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=TO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,hJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{cJ(dJ)},pJ={fontFamily:DO.fontFamily,spacing:10,wordBreak:"break-word"},gJ=(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},lf||(lf=af.CreateGraphic("richtext",{})),lf.setAttributes(a),lf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function fJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:pJ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const mJ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class vJ extends nJ{constructor(){super(vJ.type),this.type=TH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new UR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=si(d.padding),b=PO(d.padding),x=fJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=fJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=fJ(m,i),A={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},M={panel:mJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!T.length;let R=0,O=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=WO({},S,fJ(b,void 0,{})),{width:s,height:n,text:r}=gJ(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(u(m)){const t=WO({},k,fJ(x,void 0,{})),{width:e,height:s,text:n}=gJ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=WO({},x,fJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=gJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(E?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=P||D:C+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}vJ.type=TH.canvas;const _J=()=>{cJ(vJ)},yJ=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(aO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=UO.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=UO.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},bJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=yJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):jO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=WO({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:WO(f,m),hasChanged:!0};const i=WO({},t,m);HO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},xJ=t=>{UO.registerChartPlugin(t.type,t)};class SJ extends Cz{constructor(){super(SJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[SJ.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[SJ.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=NO(this._option.globalInstance.getSpec(),["data",SJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=NO(this._baseChartSpec,["data",SJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=bJ(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=NO(i,["data",SJ.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()}}SJ.pluginType="chart",SJ.specKey="media",SJ.type="MediaQueryPlugin";const kJ=()=>{xJ(SJ)},AJ=/\{([^}]+)\}/,MJ=/\{([^}]+)\}/g,wJ=/:/;class TJ extends Cz{constructor(){super(TJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:pi.getInstance().timeUTCFormat,local:pi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=xi.getInstance().format,this._numericSpecifier=xi.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[TJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),UO.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=AJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(MJ,((t,i)=>{if(!wJ.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(_i.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}}TJ.pluginType="chart",TJ.specKey="formatter",TJ.type="formatterPlugin";const CJ=()=>{xJ(TJ)};JD.useRegisters([()=>{RH(),IH(),DH(),hH(),lH(),Xj(),zj(),vz(),yz(),HD(),FD(),Cj(),Aj(),UO.registerSeries($j.type,$j),UO.registerChart(FH.type,FH)},()=>{RH(),IH(),DH(),lH(),Xj(),zj(),vz(),HH(),yz(),WH(),Cj(),Aj(),UO.registerSeries(GH.type,GH),hH(),UO.registerChart(XH.type,XH)},()=>{RH(),IH(),DH(),lH(),oV(),hH(),UO.registerChart(hV.type,hV)},()=>{IH(),_W(),UO.registerChart(p$.type,p$)},()=>{RH(),IH(),DH(),hH(),UO.registerChart(S$.type,S$),lH()},Aj,Cj,()=>{UO.registerComponent(AK.type,AK)},()=>{UO.registerComponent(YK.type,YK)},()=>{UO.registerComponent(JK.type,JK)},()=>{UO.registerGraphicComponent(AZ.type,(t=>new WP(t))),SZ(),nj(),UO.registerComponent(AZ.type,AZ,!0,1/0)},_J]),JD.useRegisters([()=>{ik(Ch)}]);export{XL as AttributeLevel,Bz as AxisSyncPlugin,vJ as CanvasTooltipHandler,oL as ChartEvent,fI as DEFAULT_CHART_HEIGHT,gI as DEFAULT_CHART_WIDTH,eF as DEFAULT_CLOSE_STROKE_JOIN,vI as DEFAULT_DATA_INDEX,_I as DEFAULT_DATA_KEY,yI as DEFAULT_DATA_SERIES_FIELD,zI as DEFAULT_KEY,WL as DEFAULT_LAYOUT_RECT_LEVEL,UL as DEFAULT_LAYOUT_RECT_LEVEL_MIN,tF as DEFAULT_LINEAR_INTERPOLATE,mI as DEFAULT_MEASURE_CANVAS_ID,bI as DEFAULT_SERIES_STYLE_NAME,QD as DEFAULT_SMOOTH_INTERPOLATE,nT as DefaultTicker,iF as Direction,dJ as DomTooltipHandler,UO as Factory,TJ as FormatterPlugin,YL as LayoutLevel,GL as LayoutZIndex,LI as MOSAIC_CAT_END_PERCENT,II as MOSAIC_CAT_START_PERCENT,OI as MOSAIC_VALUE_END_PERCENT,RI as MOSAIC_VALUE_START_PERCENT,aT as ManualTicker,SJ as MediaQuery,pI as PREFIX,s as RenderModeEnum,FI as SEGMENT_FIELD_END,DI as SEGMENT_FIELD_START,kI as STACK_FIELD_END,TI as STACK_FIELD_END_OffsetSilhouette,MI as STACK_FIELD_END_PERCENT,xI as STACK_FIELD_KEY,SI as STACK_FIELD_START,wI as STACK_FIELD_START_OffsetSilhouette,AI as STACK_FIELD_START_PERCENT,CI as STACK_FIELD_TOTAL,EI as STACK_FIELD_TOTAL_BOTTOM,BI as STACK_FIELD_TOTAL_PERCENT,PI as STACK_FIELD_TOTAL_TOP,KL as STATE_VALUE_ENUM,RC as StreamLight,aI as ThemeManager,wL as TransformLevel,NL as USER_LAYOUT_RECT_LEVEL,JD as VChart,BO as boundsInRect,KO as builtinThemes,TO as calcLayoutNumber,CO as calcPadding,uO as computeActualDataScheme,EO as convertPoint,Qg as createArc,qg as createArea,wp as createGroup,Mg as createLine,Bg as createRect,Ug as createRichText,Sg as createSymbol,yg as createText,zO as darkTheme,OO as dataScheme,JD as default,qO as defaultThemeName,gO as getActualColor,RO as getActualNumValue,_O as getColorSchemeBySeries,dO as getDataScheme,XO as getFunnelTheme,nI as getMergedTheme,rF as getSpecInfo,eI as getTheme,QO as hasThemeMerged,fO as isColorKey,MO as isPercent,wO as isPercentOffset,mO as isProgressiveDataColorScheme,LO as isTokenKey,AO as isValidOrient,FO as lightTheme,aF as lookup,uI as measureText,PO as normalizeLayoutPaddingSpec,pO as queryColorFromColorScheme,IO as queryToken,ND as registerAnimate,oK as registerBoxplotChart,jZ as registerBrush,_J as registerCanvasTooltipHandler,Rj as registerCartesianLogAxis,Ij as registerCartesianSymlogAxis,Pj as registerCartesianTimeAxis,xJ as registerChartPlugin,J$ as registerCirclePackingChart,P$ as registerCircularProgressChart,DK as registerContinuousLegend,yK as registerCorrelationChart,VZ as registerCustomMark,fL as registerDataSetInstanceParser,gL as registerDataSetInstanceTransform,hq as registerDataZoom,uJ as registerDomTooltipHandler,XD as registerElementHighlight,qD as registerElementSelect,CJ as registerFormatPlugin,H$ as registerFunnelChart,O$ as registerGaugeChart,zV as registerGeoCoordinate,LZ as registerGeoMarkPoint,UZ as registerGridLayout,mK as registerHeatmapChart,T$ as registerHistogramChart,vq as registerIndicator,W$ as registerLinearProgressChart,o$ as registerMapChart,hZ as registerMarkArea,eZ as registerMarkLine,EZ as registerMarkPoint,kJ as registerMediaQuery,yZ as registerPlayer,LW as registerPolarBandAxis,tq as registerPolarCrossHair,OW as registerPolarLinearAxis,dZ as registerPolarMarkArea,sZ as registerPolarMarkLine,OZ as registerPolarMarkPoint,GZ as registerPoptip,b$ as registerRadarChart,pK as registerRangeAreaChart,Y$ as registerRangeColumnChart,v$ as registerRoseChart,cK as registerSankeyChart,SV as registerScatterChart,uq as registerScrollBar,K$ as registerSunburstChart,tI as registerTheme,rZ as registerTitle,TZ as registerTotalLabel,eK as registerTreemapChart,nK as registerWaterfallChart,F$ as registerWordCloudChart,iI as removeTheme,sI as themeExist,ZO as themes,DO as token,vO as transformColorSchemeToStandardStruct,tL as transformToGraphic,oF as version,__ as vglobal,Dy as warn}; +let jG=class t extends TG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),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 B=[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]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:B,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(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(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?LG(t,o,l.width,l.height,h):"geometric"===t.type&&zG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=kG(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()}};jG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class HG extends TG{constructor(t){super(z({},HG.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)}HG.defaultOptions={enlarge:!1};const NG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},WG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return nt.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?UG(t.fontFamily):"sans-serif",d=t.fontStyle?UG(t.fontStyle):"normal",u=t.fontWeight?UG(t.fontWeight):"normal",p=t.rotate?UG(t.rotate):0,g=UG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?UG(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},NG),t.as):NG,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?UG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=YG(XG(t,l),C);T=i=>e(t(i))}let B=BG;"fast"===t.layoutType?B=HG:"grid"===t.layoutType&&(B=jG);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},UG=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],GG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),YG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=GG(t[0]),n=GG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(GG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},XG=(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 $G(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{WO.registerGrammarTransform("wordcloud",{transform:WG}),FN(),WO.registerAnimation("wordCloud",((t,e)=>({appear:TU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),WO.registerSeries(KG.type,KG)},ZG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},JG=(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},QG=`${uI}_FUNNEL_TRANSFORM_RATIO`,tY=`${uI}_FUNNEL_REACH_RATIO`,eY=`${uI}_FUNNEL_HEIGHT_RATIO`,iY=`${uI}_FUNNEL_VALUE_RATIO`,sY=`${uI}_FUNNEL_LAST_VALUE_RATIO`,nY=`${uI}_FUNNEL_NEXT_VALUE_RATIO`,rY=`${uI}_FUNNEL_LAST_VALUE`,aY=`${uI}_FUNNEL_CURRENT_VALUE`,oY=`${uI}_FUNNEL_NEXT_VALUE`,lY=`${uI}_FUNNEL_TRANSFORM_LEVEL`;class hY extends gF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[tY])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class cY extends AD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class dY extends cY{constructor(){super(...arguments),this.type=dY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}dY.type="polygon";const uY=()=>{WO.registerMark(dY.type,dY),YA(),HA(),oT.registerBuiltInAnimate("growPointsOut",aC),WO.registerGraphicComponent("polygon",nf)},pY=Object.assign(Object.assign({},wF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class gY extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class fY extends WF{constructor(){super(...arguments),this.type=rO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=gY,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;pL(this._dataSet,"funnel",ZG),pL(this._dataSet,"funnelTransform",JG);const t=new Ma(this._dataSet,{name:`${uI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new yD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:aY,asTransformRatio:QG,asReachRatio:tY,asHeightRatio:eY,asValueRatio:iY,asNextValueRatio:nY,asLastValueRatio:sY,asLastValue:rY,asNextValue:oY,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:lY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},fY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:zF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},fY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(fY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(fY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new hY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",YL.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",YL.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{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",YL.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",YL.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",YL.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===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",YL.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Oy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Oy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*iO(tY).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",YL.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(IF(null===(s=WO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),LF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IF(WO.getAnimationInKey("fadeInOut")(),LF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IF(WO.getAnimationInKey("funnel")({},o),LF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IF(null===(a=WO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),LF("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[sY])/2:this._getSecondaryAxisLength(t[iY])/2,n=this._getSecondaryAxisLength(t[iY])/2):(s=this._getSecondaryAxisLength(t[iY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[nY])/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[lY])}_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 u(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[vI]===t[vI]));if(!u(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(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{uY(),FN(),KV(),WO.registerSeries(fY.type,fY),WO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},LD))),WO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:HT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:HT,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),FD()},vY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},_Y=t=>{const e=t.filter((t=>t.context.diffState===XL.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},yY=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},bY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=_Y(i.parent.children),a=yY(r,s,n);return vY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=_Y(i.parent.children),a=yY(r,s,n);return vY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),xY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},SY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=_Y(i.parent.children),a=xY(r);return vY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=_Y(i.parent.children),a=xY(r);return vY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),kY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},AY=(t,e={})=>{if(!t)return[];const i=[];return EU(t,i,e),i},MY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new nG(i).layout(t,{width:s,height:n})};class wY extends gF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var TY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(TY||(TY={}));const CY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===TY.DrillDown){return G(XI(t,n,s,"children"))}if(i.type===TY.DrillUp){const e=$I(t,n,s,"children");if(e)return G(e)}return t};class BY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=RV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;pL(t,"drillFilter",CY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||P(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:TY.DrillDown},e().reRunAllTransform(),i.emit(aL.drill,{value:{path:t,type:TY.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(!_(n)||P(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:TY.DrillUp},i().reRunAllTransform(),s.emit(aL.drill,{value:{path:n,type:TY.DrillUp},model:this}),n}}const PY=Object.assign(Object.assign({},wF),{sunburst:{name:"sunburst",type:"arc"}}),EY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:yF,operations:["max","min","values"]}),t.push({key:bF,operations:["values"]}),t),RY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class OY extends JN{constructor(){super(...arguments),this.type=rO.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:bF),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:vI},getRawData:()=>this.getRawData()}),this._startAngle=ne(this._spec.startAngle),this._endAngle=ne(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),pL(this._dataSet,"sunburstLayout",MY),pL(this._dataSet,"flatten",AY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 EY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(pL(t.dataSet,"addVChartProperty",oF),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(OY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$L.STATE_NORMAL,YL.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(OY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},$L.STATE_NORMAL,YL.Series)}initTooltip(){this._tooltipHelper=new wY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(IF(null===(e=WO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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}}OY.type=rO.sunburst,OY.mark=PY,OY.builtInTheme={sunburst:RY},U(OY,BY);const IY=()=>{WO.registerSeries(OY.type,OY),dW(),FN(),FD(),WO.registerAnimation("sunburst",((t,e)=>({appear:kY(0,e),enter:bY(t),exit:SY(t),disappear:SY(t)})))},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new XU(i).layout(t,{width:s,height:n})};class DY extends gF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},zY=Object.assign(Object.assign({},wF),{circlePacking:{name:"circlePacking",type:"arc"}});class jY extends YF{constructor(){super(...arguments),this.type=rO.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:bF),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:vI},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),pL(this._dataSet,"circlePackingLayout",LY),pL(this._dataSet,"flatten",AY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(pL(t.dataSet,"addVChartProperty",oF),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(jY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$L.STATE_NORMAL,YL.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(jY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$L.STATE_NORMAL,YL.Series)}getStatisticFields(){return EY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new DY(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(IF(null===(i=WO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}jY.type=rO.circlePacking,jY.mark=zY,jY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(jY,BY);const HY=()=>{WO.registerSeries(jY.type,jY),dW(),FN(),DD(),WO.registerAnimation("circlePacking",((t,e)=>({appear:FY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},VY=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&VY(t,e.children,i)}))},NY=t=>{var e;if(!t||!_(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},WY=(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 eG(e),r=[];return r.push(n.layout(s,i)),r},UY=t=>{var e,i;return t&&_(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:[]},GY=t=>{var e,i;return t&&_(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 YY extends gF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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 XY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),$Y=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:XY(t),KY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class qY extends _T{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class ZY extends _T{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const JY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},QY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class tX extends yN{constructor(){super(...arguments),this.type=tX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?QY:JY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}tX.type="linkPath";const eX=Object.assign(Object.assign({},wF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class iX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const sX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class nX extends YF{constructor(){super(...arguments),this.type=rO.sankey,this.transformerConstructor=iX,this._nodeLayoutZIndex=UL.Node,this._labelLayoutZIndex=UL.Label,this._viewBox=new ze,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(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=eL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=eL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):(t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=eL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),sX(e,$L.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($L.STATE_SANKEY_EMPHASIS),e.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=eL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=eL(n[0]))||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=eL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=eL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):(t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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=eL(s),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($L.STATE_SANKEY_EMPHASIS_REVERSE),void sX(s,$L.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($L.STATE_SANKEY_EMPHASIS_REVERSE),void sX(s,$L.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($L.STATE_SANKEY_EMPHASIS),s.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(eL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=eL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=eL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void sX(t,$L.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void sX(t,$L.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void sX(t,$L.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,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){pL(this._dataSet,"sankeyLayout",WY),pL(this._dataSet,"sankeyFormat",NY),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:ML.sankeyLayout});const{dataSet:a}=this._option;pL(a,"sankeyNodes",UY),pL(a,"flatten",AY);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:SF.bind(this),call:kF}},!1),this._nodesSeriesData=o,pL(a,"sankeyLinks",GY);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:SF.bind(this),call:kF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(nX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(nX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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},$L.STATE_NORMAL,YL.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",YL.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},$L.STATE_NORMAL,YL.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",YL.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=sF(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(IF(null===(i=WO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),LF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),LF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:lL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$L.STATE_SANKEY_EMPHASIS_REVERSE,$L.STATE_SANKEY_EMPHASIS]),e.includes(eL(t).key)?t.addState($L.STATE_SANKEY_EMPHASIS,!0):t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new YY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new _O;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=>{u(t[i])&&e.add(t[i]),u(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 VY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}nX.type=rO.sankey,nX.transformerConstructor=iX,nX.mark=eX,nX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const rX=()=>{tV(),bN(),zA(),WO.registerGraphicComponent("path",(t=>$g(t))),WO.registerMark(tX.type,tX),FN(),WO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:$Y(t,e)},LD))),WO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:KY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),oT.registerBuiltInAnimate("linkPathGrowOut",ZY),oT.registerBuiltInAnimate("linkPathGrowIn",qY),FD(),WO.registerSeries(nX.type,nX)},aX=(t,e)=>{let i={},s=e.fields;if(c(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=AY(n);return i=mF([{latestData:r}],e),i};class oX extends gF{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 lX=Object.assign(Object.assign({},wF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),hX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class cX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const dX=(t,e)=>{if(e.getViewBox()){const i=new lG(e).layout(t,e.getViewBox()),s=[];return EU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[bF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class uX extends YF{constructor(){super(...arguments),this.type=rO.treemap,this.transformerConstructor=cX,this._categoryField="name",this._valueField="value",this._viewBox=new ze,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:bF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ve),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:vI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),pL(this._dataSet,"treemap",dX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(pL(this._rawData.dataSet,"addVChartProperty",oF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=aX([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){pL(this._dataSet,"hierarchyDimensionStatistics",aX),pL(this._dataSet,"flatten",AY);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 EY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(uX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(uX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$L.STATE_NORMAL,YL.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()},$L.STATE_NORMAL,YL.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.Series),this._initRichStyleOfLabelMark(t))}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},$L.STATE_NORMAL,YL.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),LF(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 oX(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(nL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(nL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}uX.type=rO.treemap,uX.mark=lX,uX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},uX.transformerConstructor=cX,U(uX,BY),U(uX,IV);const pX=()=>{WO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),WO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),tV(),FN(),WO.registerAnimation("treemap",((t,e)=>({appear:hX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),FD(),WO.registerSeries(uX.type,uX)},gX=Object.assign(Object.assign({},eU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),fX=Object.assign(Object.assign({},wF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),mX={type:"fadeIn"};function vX(t,e){return"fadeIn"===e?mX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class _X extends NF{constructor(){super(...arguments),this._supportStack=!1}}class yX extends gF{enableByType(t){return"dimension"!==t}}const bX="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",xX={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:bX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:bX,fill:"#ddd"}}};class SX extends iU{constructor(){super(...arguments),this.type=rO.gaugePointer,this.transformerConstructor=_X,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(SX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},SX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(SX.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 yX(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 u(this.radiusAxisHelper)&&u(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=$(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(IF(null===(i=WO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}SX.type=rO.gaugePointer,SX.mark=fX,SX.builtInTheme={gaugePointer:xX},SX.transformerConstructor=_X;const kX=()=>{WO.registerSeries(SX.type,SX),TV(),tV(),WO.registerAnimation("gaugePointer",((t,e)=>{const i=vX(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),IW(),RW()};class AX extends NF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class MX extends iU{constructor(){super(...arguments),this.type=rO.gauge,this.transformerConstructor=AX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ne(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();pL(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[DI]=t[this._angleField[0]],t[LI]=e>0?i[e-1][DI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(MX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(MX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,YL.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?xO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?xO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[LI])?this.angleAxisHelper.dataToPosition([t[LI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[DI]])}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(IF(null===(i=WO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}MX.type=rO.gauge,MX.mark=gX,MX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},MX.transformerConstructor=AX;class wX extends AD{constructor(){super(...arguments),this.type=wX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}wX.type="cell";function TX(t){return!1===t?{}:{type:"fadeIn"}}class CX extends gF{enableByType(t){return"dimension"!==t}}const BX=Object.assign(Object.assign({},wF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class PX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class EX extends YF{constructor(){super(...arguments),this.type=rO.heatmap,this.transformerConstructor=PX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(EX.mark.cell,{isSeriesMark:!0},{morph:zF(this._spec,EX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(EX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",YL.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=si(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",YL.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=GF(this);this._cellMark.setAnimationConfig(IF(null===(i=WO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),LF("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 CX(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]}}EX.type=rO.heatmap,EX.mark=BX,EX.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},EX.transformerConstructor=PX;const RX=()=>{FN(),WO.registerMark(wX.type,wX),WO.registerGraphicComponent("symbol",kg),YA(),$A(),RP(),WO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},LD),{appear:TX(e)}))),Tj(),kj(),WO.registerSeries(EX.type,EX)},OX=Object.assign(Object.assign({},wF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),IX=`${uI}_CORRELATION_X`,LX=`${uI}_CORRELATION_Y`,DX=`${uI}_CORRELATION_SIZE`,FX=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=ne(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=ne(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Bt(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Bt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Ct(e.field),C=t.map(T),[B,P]=Et(C),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),R=d(e.radiusField)?T:Ct(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Et(t.map(R)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=zX(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=E(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),jX({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,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},jX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[mI]:null==n?void 0:n[mI],[_I]:null==n?void 0:n[_I]}};class VX extends yN{constructor(){super(...arguments),this.type=VX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=ft(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}VX.type="ripple";const NX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class WX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class UX extends JN{constructor(){super(...arguments),this.type=rO.correlation,this.transformerConstructor=WX,this._viewBox=new ze}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;pL(this._dataSet,"correlation",FX);const s=new Aa;gL(s,"dataview",xa),pL(s,"correlationCenter",HX);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 yD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(UX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:mI});t&&(t.setMarkConfig({zIndex:UL.Node}),this._nodePointMark=t);const e=this._createMark(UX.mark.ripplePoint,{key:mI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(UX.mark.centerPoint,{key:mI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:UL.Node}),this._centerPointMark=i)}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[IX],y:t=>t[LX],size:t=>t[DX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.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)},$L.STATE_NORMAL,YL.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),LF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}UX.type=rO.correlation,UX.mark=OX,UX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},UX.transformerConstructor=WX;const GX=()=>{_z(),bN(),$A(),WO.registerMark(VX.type,VX),WO.registerGraphicComponent("symbol",(t=>kg(t))),WO.registerSeries(UX.type,UX),WO.registerAnimation("correlation",((t,e)=>Object.assign({appear:NX(0,e)},ID)))},YX=Object.assign(Object.assign({},wF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class XX extends yN{constructor(){super(...arguments),this.type=XX.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}XX.type="liquid";const $X=(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 KX extends gF{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 qX extends WF{constructor(){super(...arguments),this.type=rO.liquid,this.transformerConstructor=yz,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:$X(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=BO(this._spec.outlineMargin),this._paddingSpec=BO(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=Wt(...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(qX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(qX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(qX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(qX.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",YL.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",YL.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",YL.Series)}initTooltip(){this._tooltipHelper=new KX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IF(null===(i=WO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),LF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IF(null===(s=WO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),LF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(aL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=_M(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}qX.type=rO.liquid,qX.mark=YX,qX.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},qX.transformerConstructor=yz;const ZX=t=>G(t).join(",");class JX extends gF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>ZX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>ZX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const QX=Object.assign(Object.assign({},wF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class t$ extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const e$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?bG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class i$ extends WF{constructor(){super(...arguments),this.type=rO.venn,this.transformerConstructor=t$,this._viewBox=new ze}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:vI)}initData(){var t;super.initData(),pL(this._dataSet,"venn",e$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(i$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(i$.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()},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$L.STATE_HOVER,YL.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>ZX(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)}},$L.STATE_NORMAL,YL.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>ZX(t.sets)},$L.STATE_NORMAL,YL.Series))}initTooltip(){this._tooltipHelper=new JX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:ZX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return ZX(i)}legendSelectedFilter(t,e){if(t.type===n.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[ZX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(ZX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=WO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}}i$.type=rO.venn,i$.mark=QX,i$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},i$.transformerConstructor=t$;class s$ extends rV{constructor(){super(...arguments),this.type=rO.mosaic,this.transformerConstructor=nV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(RI),this.setFieldX2(EI)),this.setFieldY(II),this.setFieldY2(OI)):(t&&(this.setFieldY(RI),this.setFieldY2(EI)),this.setFieldX(II),this.setFieldX2(OI)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}s$.type=rO.mosaic,s$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},s$.transformerConstructor=nV;class n$ extends Qj{_isValidSeries(t){return t===rO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class r$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=n$,this.type="map",this.seriesType=rO.map}}r$.type="map",r$.seriesType=rO.map,r$.transformerConstructor=n$;const a$=()=>{OH(),FV(),TV(),WO.registerSeries(jV.type,jV),WO.registerImplement("registerMap",_L),WO.registerImplement("unregisterMap",yL),FD(),WO.registerChart(r$.type,r$)};class o$ extends Qj{_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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class l$ extends o${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=Ez(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,NO({},s,l)),n&&Object.assign(o,NO({},n,o))}}class h$ extends o${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class c$ extends o${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class d$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=c$}}d$.transformerConstructor=c$;class u$ extends d${constructor(){super(...arguments),this.transformerConstructor=c$,this.type="pie",this.seriesType=rO.pie}}u$.type="pie",u$.seriesType=rO.pie,u$.transformerConstructor=c$;class p$ extends h${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Xz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Xz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>NO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const g$=(t,e)=>{if(!t)return null;const i=az(t,(t=>"angle"===t.getOrient()),e),s=az(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&&ZC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=qR({x:1,y:0},u);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=ZR(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=nz(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&&ZC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=qR({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=ZR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=nz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class f$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=p$,this.type="rose",this.seriesType=rO.rose}_setModelOption(){this._modelOption.getDimensionInfo=g$}}f$.type="rose",f$.seriesType=rO.rose,f$.transformerConstructor=p$,U(f$,nH);const m$=()=>{EH(),OH(),lH(),oH(),DW(),WO.registerChart(f$.type,f$)};class v$ extends h${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=NO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>NO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class _$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=v$,this.type="radar",this.seriesType=rO.radar}_setModelOption(){this._modelOption.getDimensionInfo=g$}}_$.type="radar",_$.seriesType=rO.radar,_$.transformerConstructor=v$,U(_$,nH);const y$=()=>{EH(),OH(),LH(),lH(),oH(),GW(),WO.registerChart(_$.type,_$)};class b$ extends Qj{_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=p(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=>{E(e,"trimPadding")&&NO(e,HL(this.type,t))})),this._transformAxisSpec(t)}}class x$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=b$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=gH(t,e,i))&&void 0!==s?s:[],...null!==(n=g$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}x$.type="common",x$.transformerConstructor=b$,U(x$,nH);class S$ extends tH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class k$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=S$}}k$.transformerConstructor=S$,U(k$,nH);class A$ extends S${transformSpec(t){super.transformSpec(t),FL(t)}}class M$ extends k${constructor(){super(...arguments),this.transformerConstructor=A$,this.type="histogram",this.seriesType=rO.bar}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}M$.type="histogram",M$.seriesType=rO.bar,M$.transformerConstructor=A$;const w$=()=>{EH(),OH(),LH(),lH(),oH(),aV(),WO.registerChart(M$.type,M$)};class T$ extends l${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class C$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=T$,this.type="circularProgress",this.seriesType=rO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=g$}}C$.type="circularProgress",C$.seriesType=rO.circularProgress,C$.transformerConstructor=T$,U(C$,nH);const B$=()=>{EH(),OH(),lH(),oH(),hU(),WO.registerChart(C$.type,C$)};class P$ extends l${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=rO.circularProgress,e}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===rO.gauge||t.type===rO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(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===rO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:UL.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)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=UL.Region+50)}}class E$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=P$,this.type="gauge",this.seriesType=rO.gaugePointer}}E$.type="gauge",E$.seriesType=rO.gaugePointer,E$.transformerConstructor=P$;const R$=()=>{OH(),kX(),WO.registerSeries(MX.type,MX),dW(),aU(),RW(),hU(),WO.registerChart(E$.type,E$)};class O$ extends Qj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class I$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=rO.wordCloud}}I$.transformerConstructor=O$;class L$ extends I${constructor(){super(...arguments),this.transformerConstructor=O$,this.type="wordCloud",this.seriesType=rO.wordCloud}}L$.type="wordCloud",L$.seriesType=rO.wordCloud,L$.transformerConstructor=O$;const D$=()=>{OH(),qG(),WO.registerChart(L$.type,L$)};class F$ extends Qj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class z$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="funnel",this.seriesType=rO.funnel}}z$.type="funnel",z$.seriesType=rO.funnel,z$.transformerConstructor=F$;const j$=()=>{OH(),mY(),WO.registerChart(z$.type,z$)};class H$ extends tH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=Ez(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=Ez(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class V$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="linearProgress",this.seriesType=rO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}V$.type="linearProgress",V$.seriesType=rO.linearProgress,V$.transformerConstructor=H$,U(V$,nH);const N$=()=>{EH(),OH(),lH(),oH(),vU(),WO.registerChart(V$.type,V$)};class W$ extends tH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),FL(t)}}class U$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="rangeColumn",this.seriesType=rO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}U$.type="rangeColumn",U$.seriesType=rO.rangeColumn,U$.transformerConstructor=W$;const G$=()=>{EH(),OH(),lH(),oH(),YN(),WO.registerChart(U$.type,U$)};class Y$ extends Qj{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+re(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class X$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="sunburst",this.seriesType=rO.sunburst}}X$.type="sunburst",X$.seriesType=rO.sunburst,X$.transformerConstructor=Y$;const $$=()=>{OH(),IY(),WO.registerChart(X$.type,X$)};class K$ extends Qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class q$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="circlePacking",this.seriesType=rO.circlePacking}}q$.type="circlePacking",q$.seriesType=rO.circlePacking,q$.transformerConstructor=K$;const Z$=()=>{OH(),HY(),WO.registerChart(q$.type,q$)};class J$ extends Qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class Q$ extends Zj{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="treemap",this.seriesType=rO.treemap}}Q$.type="treemap",Q$.seriesType=rO.treemap,Q$.transformerConstructor=J$;const tK=()=>{OH(),pX(),WO.registerChart(Q$.type,Q$)};class eK extends oV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),FL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class iK extends lV{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="waterfall",this.seriesType=rO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}iK.type="waterfall",iK.seriesType=rO.waterfall,iK.transformerConstructor=eK;const sK=()=>{EH(),OH(),LH(),lH(),oH(),gN(),WO.registerChart(iK.type,iK)};class nK extends tH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),FL(t)}}class rK extends Zj{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="boxPlot",this.seriesType=rO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}rK.type="boxPlot",rK.seriesType=rO.boxPlot,rK.transformerConstructor=nK;const aK=()=>{EH(),OH(),lH(),oH(),LN(),WO.registerChart(rK.type,rK)};class oK extends Qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class lK extends Zj{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="sankey",this.seriesType=rO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=eL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}lK.type="sankey",lK.seriesType=rO.sankey,lK.transformerConstructor=oK;const hK=()=>{OH(),fo.load(dM),rX(),WO.registerChart(lK.type,lK)};class cK extends tH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),FL(t)}}class dK extends Zj{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="rangeArea",this.seriesType=rO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=gH,this._modelOption.getDimensionInfoByValue=mH,this._modelOption.getRectByDimensionData=SH}}dK.type="rangeArea",dK.seriesType=rO.rangeArea,dK.transformerConstructor=cK;const uK=()=>{EH(),OH(),LH(),lH(),oH(),jH(),Tj(),kj(),WO.registerSeries(ZN.type,ZN),WO.registerChart(dK.type,dK)};class pK extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class gK extends Zj{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="heatmap",this.seriesType=rO.heatmap}}gK.type="heatmap",gK.seriesType=rO.heatmap,gK.transformerConstructor=pK;const fK=()=>{OH(),RX(),WO.registerChart(gK.type,gK)};class mK extends Qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends Zj{constructor(){super(...arguments),this.transformerConstructor=mK,this.type="correlation",this.seriesType=rO.correlation}}vK.type="correlation",vK.seriesType=rO.correlation,vK.transformerConstructor=mK;const _K=()=>{OH(),GX(),WO.registerChart(vK.type,vK)};function yK(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=QI(t.style)),P(t.textStyle)||NO(s.textStyle,QI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&QI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&QI(s.background.style),s}const bK=(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},xK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:_I;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class SK extends Qz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=UL.Legend,this.layoutLevel=GL.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),QR(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=kO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new yD(this._option,t),this._initSelectedData(),QR(this._regions,(t=>{t.event.on(aL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(QR(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(aL.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;k(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)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(NO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(NO({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(NO({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(aL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}SK.specKey="legends";class kK extends SK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return nF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),QR(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:ML.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){pL(this._option.dataSet,"discreteLegendFilter",xK),pL(this._option.dataSet,"discreteLegendDataMake",bK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return QR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!Yy(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 c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=HI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:p,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:_,padding:y}=e,b=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?b.title=yK(s):b.title={visible:!1},P(n.focusIconStyle)||QI(n.focusIconStyle),n.shape&&(n.shape=qI(n.shape)),n.label&&(n.label=qI(n.label)),n.value&&(n.value=qI(n.value)),n.background&&(n.background=qI(n.background)),AO(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),AO(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),AO(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||QI(r.railStyle),P(r.sliderStyle)||QI(r.sliderStyle)):(P(r.textStyle)||QI(r.textStyle),r.handler&&qI(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(NO(b,a.style),u(a.padding)&&(b.padding=a.padding)),b}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return oR}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(tR.legendItemClick,(e=>{const i=E(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(aL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(tR.legendItemHover,(t=>{const e=E(t,"detail");this.event.emit(aL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(tR.legendItemUnHover,(t=>{const e=E(t,"detail");this.event.emit(aL.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:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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 c(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}=sF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=sF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}kK.specKey="legends",kK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},kK.type=n.discreteLegend;const AK=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},MK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?KI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const wK={color:uR,size:gR},TK={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}},CK=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({},TK),{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"}}}})},BK={horizontal:CK(!0),vertical:CK(!1)},PK=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({},TK),{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"}}}})},EK={horizontal:PK(!0),vertical:PK(!1)},RK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],OK=[2,10];class IK extends SK{static getSpecInfo(t){const e=nF(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?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),QR(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:ML.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(){pL(this._option.dataSet,"continuousLegendFilter",MK),pL(this._option.dataSet,"continuousLegendDataMake",AK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>tO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=HI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Yy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=HI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),P(a)&&(a="color"===this._legendType?RK:OK);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(e){const i=NO({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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=yK(s):T.title={visible:!1},T.showHandler=!1!==n.visible,P(n.style)||(T.handlerStyle=QI(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),P(r.style)||(T.railStyle=QI(r.style)),P(a.style)||(T.trackStyle=QI(a.style)),T.startText=qI(o),T.endText=qI(l),T.handlerText=qI(h),P(c)||(T.sizeBackground=QI(c)),d.visible&&!P(d.style)&&(NO(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return wK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",yt((e=>{const i=E(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(aL.legendFilter,{model:this,value:i,event:e})}),30))}}}IK.specKey="legends",IK.builtInTheme={colorLegend:BK,sizeLegend:EK},IK.type=n.continuousLegend;const LK=()=>{WO.registerComponent(IK.type,IK)},DK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,FK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),zK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function jK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(u(a.regionId)?[a.regionId]:void 0,u(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=HK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",p=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=>FK(i,s)(t)&&FK(n,r)(t)&&(d(a)||FK([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:p.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:p.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:[]}}))}];u(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:oL.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return ZD.globalConfig.uniqueTooltip&&ZD.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:oL.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return ZD.globalConfig.uniqueTooltip&&ZD.hideTooltip(l.id),c}return"none"}const HK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=DK(c,t);let _=DK(p,t);const y=zK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(FK(c,v));if(!y&&(_=DK(p,i),!zK(_)))return;const n=e.type===rO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=ZC(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])=>d(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(FK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=DK(p,o),!zK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(FK(c,n));if(!y&&(_=DK(p,r),!zK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===rO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(FK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=DK(p,i),!zK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},VK=t=>u(t)&&!_(t),NK=t=>u(t)&&_(t);class WK extends Jz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=NO({},this._theme,r.style),r.offset=NO({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(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:Ny(this._option.mode)||!Hy(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,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=__.getElementById(t.parentElement)):Hy(this._option.mode)&&(t.parentElement=null==jy?void 0:jy.body)}}const UK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class GK extends Qz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=WK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Hy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&VK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!d(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&&ZD.globalConfig.uniqueTooltip&&l&&ZD.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(aL.tooltipHide,Object.assign(Object.assign({},t),{source:oL.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=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:oL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(aL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(aL.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?wH.canvas:wH.dom,n=WO.getComponentPluginInType(t);n||Dy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=WO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Vy(s)||Ny(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))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(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=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,bt(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=jK(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(d(this._cacheInfo)||d(t))return!1;if(NK(t)){if(VK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>iz(t,e[i])))}if(NK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}GK.type=n.tooltip,GK.transformerConstructor=WK,GK.builtInTheme={tooltip:UK},GK.specKey="tooltip";var YK,XK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(YK||(YK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(XK||(XK={}));const $K={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class KK extends Qz{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=UL.CrossHair_Grid,this.labelZIndex=UL.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),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=bt((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(p(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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{ZC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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:lL.chart}:{source:oL.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Vy(t)||Ny(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.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:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(aL.tooltipHide,{source:oL.chart},this._handleTooltipHideOrRelease),this.event.on(aL.tooltipShow,{source:oL.chart},this._handleTooltipShow),this.event.on(aL.tooltipRelease,{source:oL.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=E(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{$K[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=E(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=E(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:E(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}KK.specKey="crosshair";const qK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class ZK extends KK{static getSpecInfo(t){return nF(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=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=XF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){XF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:$F(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=eO(this._regions,"cartesian");e&&(vH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=bH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new iw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new sw(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}ZK.specKey="crosshair",ZK.builtInTheme={crosshair:qK},ZK.type=n.cartesianCrosshair;class JK extends KK{static getSpecInfo(t){return nF(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=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=eO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Pz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=sF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:oe(d,a.getInnerRadius(),o),end:oe(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=he(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=oe(t,o,r),d=oe(t,o,h),m=fe([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=ft(se.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new iw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new rw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new nw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ce(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}}(u):function(t){let e="center",i="middle";return e=(t=ce(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?oe(e,p[1]+m.offset,u):oe(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}JK.specKey="crosshair",JK.builtInTheme={crosshair:qK},JK.type=n.polarCrosshair;const QK=()=>{WO.registerComponent(JK.type,JK)},tq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},eq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},iq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let u=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&(u=!0,r.domain.forEach((t=>{d(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),d(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=u?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class sq extends Qz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),QR(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=ft(this._start+f,0,1),_=ft(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ht(s/n)>=.5:Ht(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=qF(t),this._isHorizontal="horizontal"===ZF(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(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!KC(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(KC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(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?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];let s;if(this._relatedAxisComponent){const n={};QR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?G(u.xField):G(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?G(u.yField):G(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,KC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;KC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else QR(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:n}=this._option;gL(n,"dataview",xa),pL(n,"dataFilterComputeDomain",iq);const r=new Ma(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new yD(this._option,r),r.reRunAllTransform(),n.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(KC(e.type))return this._isReverse()?i[0]+(Y(i)-i[0])*(1-t):i[0]+(Y(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(Y(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&&KC(e.type)&&(s=s.slice().reverse()),(i-s[0])/(Y(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&u(this._spec.start)||"value"===e&&u(this._spec.startValue):"percent"===e&&u(this._spec.end)||"value"===e&&u(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,KC(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(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=KC(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new _B,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||(pL(this._option.dataSet,"dataFilterWithNewDomain",eq),pL(this._option.dataSet,"lockStatisticsFilter",tq),QR(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:()=>KC(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:()=>KC(this._stateScale.type)},level:ML.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}_parseDomainFromState(t,e){if(KC(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,o;const l={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=bt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}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]:YL.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=this._getAxisBandSize(h);if(!this._dataUpdating&&ZC(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,ZC(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}clear(){this._throttledHide=null}}U(sq,IV);class nq extends Jz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=NO({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const rq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),aq={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:rq(!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:rq(!0)};class oq extends sq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=nq,this.specKey="dataZoom",this.layoutZIndex=UL.DataZoom,this.layoutLevel=GL.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,c;super.setAttrFromSpec(),h(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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new jB;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?[$(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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(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(!KC(t.type)||e[0]!==Y(e))&&(!ZC(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(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:u(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 eE(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);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(aL.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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:QI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:QI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:QI(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:QI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:QI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:QI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:QI(g.style)},selectedBackgroundStyle:QI(this._spec.selectedBackground.style),dragMaskStyle:QI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:NO(QI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:NO(QI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QI(null===(d=m.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}=sF(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()}}oq.type=n.dataZoom,oq.transformerConstructor=nq,oq.builtInTheme={dataZoom:aq},oq.specKey="dataZoom";const lq=()=>{WO.registerComponent(oq.type,oq)},hq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class cq extends sq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=UL.DataZoom,this.layoutLevel=GL.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),h(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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return x(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:u(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 oM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=UR(this._start,t)&&UR(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this.statePointToData(t),n=this.statePointToData(e);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this.statePointToData(t),this.statePointToData(e)))&&this.event.emit(aL.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()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=QI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=QI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}cq.type=n.scrollBar,cq.builtInTheme={scrollBar:hq},cq.specKey="scrollBar";const dq=()=>{WO.registerComponent(cq.type,cq)},uq=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},pq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),gq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:pq("l1FontSize","primaryFontColor")},content:{visible:!0,style:pq("l2FontSize","tertiaryFontColor")}};class fq extends Qz{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=UL.Indicator,this.layoutLevel=GL.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return nF(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=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){pL(this._option.dataSet,"indicatorFilter",uq);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 yD(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 e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=NO({},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({},JI(j(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?EO(l,this._computeLayoutRadius()):0,dy:h?EO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(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({},JI(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_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)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new vR(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]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}fq.type=n.indicator,fq.builtInTheme={indicator:gq},fq.specKey="indicator";const mq=()=>{WO.registerComponent(fq.type,fq)},vq=["sum","average","min","max","variance","standardDeviation","median"];function _q(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function yq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&_q(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=AO(t.x)?kq(t.x,n)+r.x:Aq(l.getXAxisHelper(),[t.x])+r.x,h}function bq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&_q(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=AO(t.y)?kq(t.y,n)+r.y:Aq(l.getYAxisHelper(),[t.y])+r.y,h}function xq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&_q(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)),Aq(a.angleAxisHelper,[t.angle])}function Sq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&_q(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)),Aq(a.radiusAxisHelper,[t.radius])}function kq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Aq(t,e){const i=t.getScale(0);return KC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function Mq(t){return vq.includes(t)}function wq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=yq(t,_,n,p,c,o),r=bq(t,y,n,p,d,o),Tq(s,b,S,g.length),Tq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=yq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);Tq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=bq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);Tq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function Tq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=xq(t,l,n,r),i=Sq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=xq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=Sq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Bq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=AO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=AO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&_q(_,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===S.length&&x(S[0])&&_q(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:Aq(d.getXAxisHelper(),b)+p.x+m,y:Aq(d.getYAxisHelper(),S)+p.y+v})})),n}function Pq(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&_q(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&&x(u[0])&&_q(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:Aq(l.angleAxisHelper,d),radius:Aq(l.radiusAxisHelper,u)})})),s}function Eq(t,e,i){let{x:s,y:n}=t;return AO(s)&&(s=kq(s,e)),AO(n)&&(n=kq(n,i)),{x:s,y:n}}function Rq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(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}=Eq(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=>Eq(t,n,r)))}function Oq(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(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},QI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Dq(QI(n.style),i,s)),u(n.padding)&&(t.padding=si(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Dq(QI(r),i,s)),t}return{visible:!1}}function Lq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function Dq(t,e,i){return c(t)?t(e,i):t}function Fq(t,e){return c(t)?t(e):t}function zq(t,e,i){return u(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){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function Hq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=jq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function Vq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=jq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Nq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function Wq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(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;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&Mq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&Mq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&Mq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&Mq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>Gq(i,e,t))):i.x=Gq(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>Gq(i,e,t))):i.y=Gq(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>Gq(i,e,t))):i.angle=Gq(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>Gq(i,e,t))):i.radius=Gq(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=Gq(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const Uq={min:(t,e)=>GR(t[0].latestData,e.field),max:(t,e)=>YR(t[0].latestData,e.field),sum:function(t,e){return XR(t[0].latestData,e.field)},average:function(t,e){return $R(t[0].latestData,e.field)},variance:function(t,e){return KR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(KR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return lt(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Uq[i](e,{field:s})}return t}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 Xq extends Qz{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 nF(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 v(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=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Aa;return e.registerParser("array",i),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(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=eO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=wO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=wO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();pL(this._option.dataSet,"markerAggregation",Wq),pL(this._option.dataSet,"markerFilter",Yq);const i=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function $q(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=GR(t,e),r=YR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Kq extends Xq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=UL.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Hq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Dq(QI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Iq(t,this._markerData,this._markAttributeContext))),state:{line:Lq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:Lq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:Lq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return Lq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return Lq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Dq(QI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Dq(QI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Oq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Hq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;pL(this._option.dataSet,"markerAggregation",Wq),pL(this._option.dataSet,"markerRegression",$q),pL(this._option.dataSet,"markerFilter",Yq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ma(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Kq.specKey="markLine";const qq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Zq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Jq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:qq(!1),endSymbol:qq(!0),label:Zq};class Qq extends Kq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new HE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Hq(e);let y=[];if(p||f||g||m||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=Bq(i,r,d,e.coordinatesOffset):c&&(y=Rq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(AO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Hq(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&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Qq.type=n.markLine,Qq.coordinateType="cartesian",Qq.builtInTheme={markLine:Jq};const tZ=()=>{WO.registerComponent(Qq.type,Qq),jE()};class eZ extends Kq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Hq(this._spec);return e||i?new WE(t):new HE(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}=Hq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Cq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>oe(f,t.radius,t.angle)))}}else u&&(p=Pq(i,r,a),g={points:p.map((t=>oe(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Hq(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}}}eZ.type=n.polarMarkLine,eZ.coordinateType="polar",eZ.builtInTheme={polarMarkLine:Jq};const iZ=()=>{WO.registerComponent(eZ.type,eZ),WE._animate=bE,jE()};class sZ extends Qz{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=UL.Title,this.layoutLevel=GL.Title,this._orient="top",this._orient=kO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return nF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=wO(this._spec.width,l.width,null,l.width),c=wO(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),p=Object.assign(Object.assign({},j(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 u(this._spec.width)&&(p.textStyle.width=Math.max(h,l.width),p.subtextStyle.width=p.textStyle.width),p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new fR(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}}sZ.type=n.title,sZ.specKey=n.title,sZ.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};const nZ=()=>{WO.registerComponent(sZ.type,sZ)};class rZ extends Xq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=UL.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Vq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Dq(QI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Iq(t,this._markerData,this._markAttributeContext))),state:{area:Lq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>Lq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return Lq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Oq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Vq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}rZ.specKey="markArea";const aZ={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class oZ extends rZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new NE(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Vq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=wq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=wq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=Bq(s,a,p,i.coordinatesOffset):d&&(f=Rq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Vq(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}}}oZ.type=n.markArea,oZ.coordinateType="cartesian",oZ.builtInTheme={markArea:aZ};const lZ=()=>{WO.registerComponent(oZ.type,oZ),VE()};class hZ extends rZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Vq(this._spec);return i||e||s?new UE(t):new NE(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}=Vq(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=Cq(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=Pq(i,r,c),u={points:d.map((t=>oe(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Vq(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}}}hZ.type=n.polarMarkArea,hZ.coordinateType="polar",hZ.builtInTheme={polarMarkArea:aZ};const cZ=()=>{WO.registerComponent(hZ.type,hZ),UE._animate=SE,VE()},dZ=t=>QI(Object.assign({},t)),uZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},QI(t.style))}),pZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=dZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=dZ(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:{},QI(Object.assign({},y)));var y;const b=uZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=uZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=uZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=uZ(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},gZ=t=>"left"===t||"right"===t,fZ=t=>"top"===t||"bottom"===t,mZ={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class vZ extends Qz{constructor(){super(...arguments),this.layoutZIndex=UL.Player,this.layoutLevel=GL.Player,this.specKey="player",this.type=n.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({},pZ(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({},pZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new ER(t):this._playerComponent=new IR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=gZ(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=gZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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(aL.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(MR.end,(()=>{var t;this.event.emit(aL.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(MR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(MR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.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),k(t.x)){const e=gZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=fZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):gZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):fZ(this._orient)?this._maxSize():t.height}_computeDx(t){return gZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return fZ(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];this._option.globalInstance.updateFullData(e.data),this.event.emit(aL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}vZ.builtInTheme={player:mZ},vZ.specKey="player",vZ.type=n.player;const _Z=()=>{WO.registerComponent(vZ.type,vZ)};class yZ extends Qz{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=UL.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=pO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==XL.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}yZ.type=n.label;class bZ extends DN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}bZ.type="text",bZ.constructorType="label";const xZ=()=>{FN(),WO.registerMark(bZ.constructorType,bZ)};class SZ extends Jz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kZ extends yZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=SZ,this.layoutZIndex=UL.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(aL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(nL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(nL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),QR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{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),c(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",YL.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=NO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},iN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[PI])):t=>t.filter((t=>t.data[BI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?sN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}kZ.type=n.label,kZ.specKey="label",kZ.transformerConstructor=SZ;class AZ extends yZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=UL.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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[TI]},"normal",YL.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return NO({textStyle:{pickable:!0===this._spec.interactive},position:MZ(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[PI]:t.data[BI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>sN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function MZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}AZ.type=n.totalLabel,AZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},AZ.specKey="totalLabel";const wZ=()=>{WO.registerGraphicComponent(AZ.type,(t=>new NP(t))),xZ(),sj(),WO.registerComponent(AZ.type,AZ,!0)};class TZ extends Xq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=UL.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Nq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R;const{itemContent:O={},itemLine:I={},targetSymbol:L={}}=this._spec,D=O,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:X,customMarkStyle:$,style:K={},state:q={}}=D,Z=t(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(e=null==j?void 0:j.state)&&void 0!==e?e:q,tt={dx:0,dy:0},Q=Iq(z(tt,null!==(i=null!=j?j:U)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=Dq(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:X)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=QI(Dq(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=Dq(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=Dq(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:$)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:Fq(O.offsetX,this._relativeSeries.getRegion()),offsetY:Fq(O.offsetX,this._relativeSeries.getRegion())},Z),{style:Dq(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=L.offset)&&void 0!==y?y:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:Dq(L.style,this._markerData,this._markAttributeContext)},state:{line:Lq(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:Lq(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:Lq(null!==(T=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),itemContent:Lq(J,this._markerData,this._markAttributeContext),textBackground:Lq(null===(B=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:Lq(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=t(I,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:QI(st.style)}):{visible:!1};return new YE(et)}_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}=Oq([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:zq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:zq(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}=Nq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}TZ.specKey="markPoint";const CZ={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class BZ extends TZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=wq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=Bq(n,r,h,s.coordinatesOffset)[0]:l&&(c=Rq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Nq(t),i=u(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}}}BZ.type=n.markPoint,BZ.coordinateType="cartesian",BZ.builtInTheme={markPoint:CZ};const PZ=()=>{WO.registerComponent(BZ.type,BZ),GE()};class EZ extends TZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Cq(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:oe({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}])]}}}EZ.type=n.polarMarkPoint,EZ.coordinateType="polar",EZ.builtInTheme={polarMarkPoint:CZ};const RZ=()=>{WO.registerComponent(EZ.type,EZ),GE()};class OZ extends TZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}OZ.type=n.geoMarkPoint,OZ.coordinateType="geo",OZ.builtInTheme={geoMarkPoint:CZ};const IZ=()=>{WO.registerComponent(OZ.type,OZ),GE()},LZ="inBrush",DZ="outOfBrush";class FZ extends Qz{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=UL.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return nF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),LZ,YL.Series),i.setMarkStyle(s,Object.assign({},e),DZ,YL.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new zR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:QI(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),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(RR.brushActive,(i=>{this._initMarkBrushState(e,DZ),this._emitEvent(aL.brushActive,t)})),r.addEventListener(RR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(aL.brushStart,t)})),r.addEventListener(RR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(aL.brushStart,t)})),r.addEventListener(RR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(aL.brushChange,t)})),r.addEventListener(RR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(aL.brushChange,t)})),r.addEventListener(RR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(aL.brushClear,t)})),r.addEventListener(RR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(aL.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(aL.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(aL.brushEnd,t)}})),r.addEventListener(RR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(aL.brushEnd,t)}))}_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]}}_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({},QI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(LZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(LZ),i.addState(DZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(LZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(LZ),i.addState(DZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ce(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(LZ),s.removeState(DZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}FZ.type=n.brush,FZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},FZ.specKey="brush";const zZ=()=>{WO.registerComponent(FZ.type,FZ)};class jZ extends Qz{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=UL.CustomMark,this.layoutLevel=GL.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${uI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IF({},LF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(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 N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ze).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ze;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}jZ.type=n.customMark,jZ.specKey="customMark";const HZ=()=>{WO.registerComponent(jZ.type,jZ)};class VZ{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||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>NZ(t))),a=n.filter((t=>!NZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>NZ(t))),h=o.filter((t=>!NZ(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function NZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}VZ.type="grid";const WZ=()=>{WO.registerLayout(VZ.type,VZ)},UZ=()=>{fo.load(tw)},GZ="vchart-tooltip",YZ=`${GZ}-container`,XZ=`${GZ}-title`,$Z=`${GZ}-content-box`,KZ={offsetX:10,offsetY:10},qZ="99999999999999";function ZZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const JZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,QZ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?ZZ(t):"",tJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},eJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},iJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=eJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class sJ extends Tz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=hF(null==w?void 0:w.position,b,e),C=null!==(r=hF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.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:pI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:gI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Hy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!E){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=JZ(e,F),V=JZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(iJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=tJ(t,_),U.top=tJ(i,_),U.right=tJ(e,_),U.bottom=tJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=tJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?O:I,n="x"===t?A:M,r=iJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",rJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=nJ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=nJ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},aJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?wO(e,t.fontSize):0},oJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=si(r),a.padding=nJ(o)),{panelStyle:a,panelPadding:o}};function lJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const hJ=t=>{WO.registerComponentPlugin(t.type,t)};class cJ extends sJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(cJ.type),this.type=wH.dom,this._tooltipContainer=null==jy?void 0:jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(jy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=oJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:nJ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=rJ(h),x=rJ(u),S=rJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=nJ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=nJ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=nJ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(aJ(p),aJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(XZ))),l=a.find((t=>t.className.includes($Z)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(XZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(lJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${GZ}-column`),e.classList.add(`${GZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add($Z),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];lJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));lJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${GZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=QZ(e.key),e.keyStyle&&rJ(e.keyStyle,l)):"value"===i?(o.innerHTML=QZ(e.value),e.valueStyle&&rJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?ZZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?ZZ(c):m,y=g,b=t=>new Sg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ze));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=dh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?ZZ(u):"currentColor",`\n \n \n \n `;const T=w?dh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),lJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes($Z))),h=[...o.children].find((t=>t.className.includes(XZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(XZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=wO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,lJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{hJ(cJ)},uJ={fontFamily:LO.fontFamily,spacing:10,wordBreak:"break-word"},pJ=(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},hf||(hf=of.CreateGraphic("richtext",{})),hf.setAttributes(a),hf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function gJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:uJ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const fJ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class mJ extends sJ{constructor(){super(mJ.type),this.type=wH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new WR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=si(d.padding),b=BO(d.padding),x=gJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=gJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=gJ(m,i),A={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},M={panel:fJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!T.length;let R=0,O=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=NO({},S,gJ(b,void 0,{})),{width:s,height:n,text:r}=pJ(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(u(m)){const t=NO({},k,gJ(x,void 0,{})),{width:e,height:s,text:n}=pJ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=NO({},x,gJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=pJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(E?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=P||D:C+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}mJ.type=wH.canvas;const vJ=()=>{hJ(mJ)},_J=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(rO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=WO.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=WO.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},yJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=_J(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):zO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=NO({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:NO(f,m),hasChanged:!0};const i=NO({},t,m);jO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},bJ=t=>{WO.registerChartPlugin(t.type,t)};class xJ extends Tz{constructor(){super(xJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[xJ.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[xJ.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=VO(this._option.globalInstance.getSpec(),["data",xJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=VO(this._baseChartSpec,["data",xJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=yJ(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=VO(i,["data",xJ.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()}}xJ.pluginType="chart",xJ.specKey="media",xJ.type="MediaQueryPlugin";const SJ=()=>{bJ(xJ)},kJ=/\{([^}]+)\}/,AJ=/\{([^}]+)\}/g,MJ=/:/;class wJ extends Tz{constructor(){super(wJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:pi.getInstance().timeUTCFormat,local:pi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=xi.getInstance().format,this._numericSpecifier=xi.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[wJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),WO.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=kJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(AJ,((t,i)=>{if(!MJ.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(_i.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}wJ.pluginType="chart",wJ.specKey="formatter",wJ.type="formatterPlugin";const TJ=()=>{bJ(wJ)};ZD.useRegisters([()=>{EH(),OH(),LH(),lH(),oH(),Yj(),Fj(),mz(),_z(),jD(),DD(),Tj(),kj(),WO.registerSeries(Xj.type,Xj),WO.registerChart(DH.type,DH)},()=>{EH(),OH(),LH(),oH(),Yj(),Fj(),mz(),jH(),_z(),NH(),Tj(),kj(),WO.registerSeries(UH.type,UH),lH(),WO.registerChart(YH.type,YH)},()=>{EH(),OH(),LH(),oH(),aV(),lH(),WO.registerChart(lV.type,lV)},()=>{OH(),vW(),WO.registerChart(u$.type,u$)},()=>{EH(),OH(),LH(),lH(),WO.registerChart(x$.type,x$),oH()},kj,Tj,()=>{WO.registerComponent(kK.type,kK)},()=>{WO.registerComponent(GK.type,GK)},()=>{WO.registerComponent(ZK.type,ZK)},()=>{WO.registerGraphicComponent(kZ.type,(t=>new NP(t))),xZ(),sj(),WO.registerComponent(kZ.type,kZ,!0,1/0)},vJ]),ZD.useRegisters([()=>{ek(fo)}]);export{YL as AttributeLevel,Cz as AxisSyncPlugin,mJ as CanvasTooltipHandler,aL as ChartEvent,gI as DEFAULT_CHART_HEIGHT,pI as DEFAULT_CHART_WIDTH,tF as DEFAULT_CLOSE_STROKE_JOIN,mI as DEFAULT_DATA_INDEX,vI as DEFAULT_DATA_KEY,_I as DEFAULT_DATA_SERIES_FIELD,FI as DEFAULT_KEY,NL as DEFAULT_LAYOUT_RECT_LEVEL,WL as DEFAULT_LAYOUT_RECT_LEVEL_MIN,QD as DEFAULT_LINEAR_INTERPOLATE,fI as DEFAULT_MEASURE_CANVAS_ID,yI as DEFAULT_SERIES_STYLE_NAME,JD as DEFAULT_SMOOTH_INTERPOLATE,sT as DefaultTicker,eF as Direction,cJ as DomTooltipHandler,WO as Factory,wJ as FormatterPlugin,GL as LayoutLevel,UL as LayoutZIndex,II as MOSAIC_CAT_END_PERCENT,OI as MOSAIC_CAT_START_PERCENT,RI as MOSAIC_VALUE_END_PERCENT,EI as MOSAIC_VALUE_START_PERCENT,rT as ManualTicker,xJ as MediaQuery,uI as PREFIX,s as RenderModeEnum,DI as SEGMENT_FIELD_END,LI as SEGMENT_FIELD_START,SI as STACK_FIELD_END,wI as STACK_FIELD_END_OffsetSilhouette,AI as STACK_FIELD_END_PERCENT,bI as STACK_FIELD_KEY,xI as STACK_FIELD_START,MI as STACK_FIELD_START_OffsetSilhouette,kI as STACK_FIELD_START_PERCENT,TI as STACK_FIELD_TOTAL,PI as STACK_FIELD_TOTAL_BOTTOM,CI as STACK_FIELD_TOTAL_PERCENT,BI as STACK_FIELD_TOTAL_TOP,$L as STATE_VALUE_ENUM,EC as StreamLight,rI as ThemeManager,ML as TransformLevel,VL as USER_LAYOUT_RECT_LEVEL,ZD as VChart,CO as boundsInRect,$O as builtinThemes,wO as calcLayoutNumber,TO as calcPadding,dO as computeActualDataScheme,PO as convertPoint,tf as createArc,Zg as createArea,Tp as createGroup,wg as createLine,Pg as createRect,Gg as createRichText,kg as createSymbol,bg as createText,FO as darkTheme,RO as dataScheme,ZD as default,KO as defaultThemeName,pO as getActualColor,EO as getActualNumValue,vO as getColorSchemeBySeries,cO as getDataScheme,YO as getFunnelTheme,sI as getMergedTheme,nF as getSpecInfo,tI as getTheme,JO as hasThemeMerged,gO as isColorKey,AO as isPercent,MO as isPercentOffset,fO as isProgressiveDataColorScheme,IO as isTokenKey,kO as isValidOrient,DO as lightTheme,rF as lookup,dI as measureText,BO as normalizeLayoutPaddingSpec,uO as queryColorFromColorScheme,OO as queryToken,VD as registerAnimate,aK as registerBoxplotChart,zZ as registerBrush,vJ as registerCanvasTooltipHandler,Ej as registerCartesianLogAxis,Oj as registerCartesianSymlogAxis,Bj as registerCartesianTimeAxis,bJ as registerChartPlugin,Z$ as registerCirclePackingChart,B$ as registerCircularProgressChart,LK as registerContinuousLegend,_K as registerCorrelationChart,HZ as registerCustomMark,gL as registerDataSetInstanceParser,pL as registerDataSetInstanceTransform,lq as registerDataZoom,dJ as registerDomTooltipHandler,YD as registerElementHighlight,KD as registerElementSelect,TJ as registerFormatPlugin,j$ as registerFunnelChart,R$ as registerGaugeChart,FV as registerGeoCoordinate,IZ as registerGeoMarkPoint,WZ as registerGridLayout,fK as registerHeatmapChart,w$ as registerHistogramChart,mq as registerIndicator,N$ as registerLinearProgressChart,a$ as registerMapChart,lZ as registerMarkArea,tZ as registerMarkLine,PZ as registerMarkPoint,SJ as registerMediaQuery,_Z as registerPlayer,IW as registerPolarBandAxis,QK as registerPolarCrossHair,RW as registerPolarLinearAxis,cZ as registerPolarMarkArea,iZ as registerPolarMarkLine,RZ as registerPolarMarkPoint,UZ as registerPoptip,y$ as registerRadarChart,uK as registerRangeAreaChart,G$ as registerRangeColumnChart,m$ as registerRoseChart,hK as registerSankeyChart,xV as registerScatterChart,dq as registerScrollBar,$$ as registerSunburstChart,QO as registerTheme,nZ as registerTitle,wZ as registerTotalLabel,tK as registerTreemapChart,sK as registerWaterfallChart,D$ as registerWordCloudChart,eI as removeTheme,iI as themeExist,qO as themes,LO as token,mO as transformColorSchemeToStandardStruct,QI as transformToGraphic,aF as version,__ as vglobal,Ly as warn}; diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js index 8779a13331..2ab526851a 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js @@ -12,7 +12,7 @@ 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 t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function P(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var E=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(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];!u(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,s=!1,n=!1){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(y(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=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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(!N(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(!N(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;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 tt(t){return Number(t)}const et="undefined"!=typeof console;function it(t,e,i){const s=[e].concat([].slice.call(i));et&&console[t].apply(console,s)}var st;!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"}(st||(st={}));class nt{static getInstance(t,e){return nt._instance&&x(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=st.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=st.Info}canLogDebug(){return this._level>=st.Debug}canLogError(){return this._level>=st.Error}canLogWarn(){return this._level>=st.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=st.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):it(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=st.Warn&&it(this._method||"warn","WARN",t),this}info(...t){return this._level>=st.Info&&it(this._method||"log","INFO",t),this}debug(...t){return this._level>=st.Debug&&it(this._method||"log","DEBUG",t),this}}function rt(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}nt._instance=null;const at=(t,e)=>ot(0,t.length,(i=>e(t[i]))),ot=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},lt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),function(t,e,i=tt){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)},ht=1e-10,ct=1e-10;function dt(t,e,i=ct,s=ht){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ut(t,e,i,s){return t>e&&!dt(t,e,i,s)}function pt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ft=function(t,e,i){return ti?i:t};var mt=(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 vt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let _t=!1;try{_t="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){_t=!1}function yt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&_t;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 g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function bt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),yt(t,e,{leading:s,trailing:n,maxWait:e})}function xt(t,e){return i=>t*(1-i)+e*i}function St(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function At(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}_t=!1;const Mt=4294967296;const wt=t=>e=>E(e,t),Tt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||wt)(i)},Ct=(t,e={})=>{if(_(t)){const i=t.map((t=>Tt(t,e)));return t=>i.map((e=>e(t)))}return Tt(t,e)},Bt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Et=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!d(n)&&(n=+n)>=n&&!d(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Lt=1e-12,Dt=Math.PI,Ft=Dt/2,zt=2*Dt,jt=2*Math.PI,Ht=Math.abs,Vt=Math.atan2,Nt=Math.cos,Wt=Math.max,Ut=Math.min,Gt=Math.sin,Yt=Math.sqrt,Xt=Math.pow;function $t(t){return t>=1?Ft:t<=-1?-Ft:Math.asin(t)}function Kt(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 qt(t,e){return t[0]*e[1]-t[1]*e[0]}function Zt(t,e){let i=0;for(let s=0;s0?i:0}function te(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))}function ee(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))}class ie{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ie(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 se{static distancePP(t,e){return Yt(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Yt(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return Yt(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new ie((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ae=(t=0)=>{if(t<0)for(;t<-zt;)t+=zt;else if(t>0)for(;t>zt;)t-=zt;return t};function oe(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 le(t,e={x:0,y:0},i=0,s=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 he(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ce(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function de(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=ce(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 ue(t){return(t=ce(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 pe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ge(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 me(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}=_e(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 ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const _e=(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 ye(t,e,i){if(!t||!e)return ve.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=_e(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 Se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ne(t.angle):t.angle,s=Ae(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Ae(t),Ae(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ne(t.angle):t.angle;let u=i?ne(90-t.angle):t.angle+Ft;const p=i?ne(e.angle):e.angle;let g=i?ne(90-e.angle):e.angle+Ft;u>jt&&(u-=jt),g>jt&&(g-=jt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Se(n,i)+Se(n,s))/2>Se(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Te=1e-8;function Ce(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ee(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Oe(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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(v(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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const Le=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),De=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Fe(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 je extends ze{}class He extends ze{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new He(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ve{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ve,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 Ve;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ve(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=re(r.rotateDeg),r}}class Ne{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 We(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 Ue(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 Ge=/^#([0-9a-f]{3,8})$/,Ye={transparent:4294967040},Xe={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 $e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ke(t){return x(t)?new ti(t>>16,t>>8&255,255&t,1):_(t)?new ti(t[0],t[1],t[2]):new ti(255,255,255)}function qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ze(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Je=(t,e)=>{const i=Ge.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ti((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ke(t):8===e?new ti(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Qe{static Brighter(t,e=1){return 1===e?t:new Qe(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Qe(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Qe?t:new Qe(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Ye[t]))return function(t){return x(t)?new ti(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ti(t[0],t[1],t[2],t[3]):new ti(255,255,255,1)}(Ye[t]);if(u(Xe[t]))return Ke(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Je(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 ti(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ti(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Qe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ti(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=Ue(this.color.r,this.color.g,this.color.b),r=We(d(t)?n.h:ft(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ti(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Je(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Qe(this.color.toString())}copyGammaToLinear(t,e=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,e=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=qe(t.color.r),this.color.g=qe(t.color.g),this.color.b=qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ti{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${$e(this.r)+$e(this.g)+$e(this.b)+(1===this.opacity?"":$e(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}=Ue(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ei(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 ti(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:Ue});function si(t){if(k(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(p(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 ni(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ri(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 ai(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}const oi=1e-10;function li(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+oi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=ui(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=se.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=hi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-oi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function hi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ci(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return hi(t,t-(i*i-e*e+t*t)/(2*i))+hi(e,s)}function di(t,e){const i=se.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function ui(t){const e={x:0,y:0};for(let i=0;ithis.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 fi;function mi(t,e){const i=gi(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 vi{constructor(t={}){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 _i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yi(t){let e;if(e=_i.exec(t))return new vi({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]});nt.getInstance().error("invalid format: "+t)}const bi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class xi{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 xi.instance||(xi.instance=new xi),xi.instance}newFormat(t){const e=yi(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"):Si[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=Si[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:_,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)?m: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?bi[8+fi/3]:"")+k+(t&&"("===n?")":""),f)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=yi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=gi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=bi[8+n/3];return function(t){return s(r*t)+a}}}const Si={"%":(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)=>mi(100*t,e),r:mi,s:function(t,e){const i=gi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(fi=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")+gi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ti(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ti(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Zt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Zi=Math.sqrt,Ji=Math.tan;function Qi(t){return t>1?0:t<-1?Di:Math.acos(t)}function ts(t){return t>1?Fi:t<-1?-Fi:Math.asin(t)}function es(){}function is(t,e){t&&ns.hasOwnProperty(t.type)&&ns[t.type](t,e)}var ss={Feature:function(t,e){is(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sDi?t+Math.round(-t/ji)*ji:t,e]}function vs(t,e,i){return(t%=ji)?e||i?fs(ys(t),bs(e,i)):ys(t):e||i?bs(e,i):ms}function _s(t){return function(e,i){return[(e+=t)>Di?e-ji:e<-Di?e+ji:e,i]}}function ys(t){var e=_s(t);return e.invert=_s(-t),e}function bs(t,e){var i=Gi(t),s=Ki(t),n=Gi(e),r=Ki(e);function a(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*i+o*s;return[Ui(l*n-c*r,o*i-h*s),ts(c*n+l*r)]}return a.invert=function(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*n-l*r;return[Ui(l*n+h*r,o*i+c*s),ts(c*i-o*s)]},a}function xs(t,e){(e=hs(e))[0]-=t,gs(e);var i=Qi(-e[1]);return((-e[2]<0?-i:i)+ji-Li)%ji}function Ss(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:es,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ni(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=Ki(s),r=[Ki(i),-Gi(i),0],a=0,o=0;Bs.reset(),1===n?s=Fi+Li:-1===n&&(s=-Fi-Li);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Di,T=f*x;if(Bs.add(Ui(T*A*Ki(M),m*S+T*Gi(M))),a+=w?k+A*ji:k,w^p>=i^y>=i){var C=ds(hs(u),hs(_));gs(C);var B=ds(r,C);gs(B);var P=(w^k>=0?-1:1)*ts(B[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Li||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(Is))}return u}}function Is(t){return t.length>1}function Ls(t,e){return((t=t.x)[0]<0?t[1]-Fi-Li:Fi-t[1])-((e=e.x)[0]<0?e[1]-Fi-Li:Fi-e[1])}1===(Ts=Es).length&&(Cs=Ts,Ts=function(t,e){return Es(Cs(t),e)});var Ds=Os((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?Di:-Di,l=Ni(r-i);Ni(l-Di)0?Fi:-Fi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Di&&(Ni(i-n)Li?Wi((Ki(e)*(r=Gi(s))*Ki(i)-Ki(s)*(n=Gi(e))*Ki(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*Fi,s.point(-Di,n),s.point(0,n),s.point(Di,n),s.point(Di,0),s.point(Di,-n),s.point(0,-n),s.point(-Di,-n),s.point(-Di,0),s.point(-Di,n);else if(Ni(t[0]-e[0])>Li){var r=t[0]0,n=Ni(e)>Li;function r(t,i){return Gi(t)*Gi(i)>e}function a(t,i,s){var n=[1,0,0],r=ds(hs(t),hs(i)),a=cs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ds(n,r),u=ps(n,h);us(u,ps(r,c));var p=d,g=cs(u,p),f=cs(p,p),m=g*g-f*(cs(u,u)-1);if(!(m<0)){var v=Zi(m),_=ps(p,(-g-v)/f);if(us(_,u),_=ls(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ni(_[0]-b)Di^(b<=_[0]&&_[0]<=x)){var w=ps(p,(-g+v)/f);return us(w,u),[_,ls(w)]}}}function o(e,i){var n=s?t:Di-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Di:-Di),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Gi(e),o=Ki(e),l=s*i;null==n?(n=e+s*ji,r=e-l/2):(n=xs(a,n),r=xs(a,r),(s>0?nr)&&(n+=s*ji));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 Ni(s[0]-t)0?0:3:Ni(s[0]-i)0?2:1:Ni(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,f,m,v,_,y=a,b=Ss(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ms(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&&m)y.point(r,a);else{var l=[g=Math.max(js,Math.min(zs,g)),f=Math.max(js,Math.min(zs,f))],b=[r=Math.max(js,Math.min(zs,r)),a=Math.max(js,Math.min(zs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Vs(t){return t}var Ns,Ws,Us,Gs,Ys=Ei(),Xs=Ei(),$s={point:es,lineStart:es,lineEnd:es,polygonStart:function(){$s.lineStart=Ks,$s.lineEnd=Js},polygonEnd:function(){$s.lineStart=$s.lineEnd=$s.point=es,Ys.add(Ni(Xs)),Xs.reset()},result:function(){var t=Ys/2;return Ys.reset(),t}};function Ks(){$s.point=qs}function qs(t,e){$s.point=Zs,Ns=Us=t,Ws=Gs=e}function Zs(t,e){Xs.add(Gs*t-Us*e),Us=t,Gs=e}function Js(){Zs(Ns,Ws)}var Qs=$s,tn=1/0,en=tn,sn=-tn,nn=sn;var rn,an,on,ln,hn={point:function(t,e){tsn&&(sn=t);enn&&(nn=e)},lineStart:es,lineEnd:es,polygonStart:es,polygonEnd:es,result:function(){var t=[[tn,en],[sn,nn]];return sn=nn=-(en=tn=1/0),t}},cn=0,dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn={point:bn,lineStart:xn,lineEnd:An,polygonStart:function(){yn.lineStart=Mn,yn.lineEnd=wn},polygonEnd:function(){yn.point=bn,yn.lineStart=xn,yn.lineEnd=An},result:function(){var t=_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:un?[cn/un,dn/un]:[NaN,NaN];return cn=dn=un=pn=gn=fn=mn=vn=_n=0,t}};function bn(t,e){cn+=t,dn+=e,++un}function xn(){yn.point=Sn}function Sn(t,e){yn.point=kn,bn(on=t,ln=e)}function kn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,bn(on=t,ln=e)}function An(){yn.point=bn}function Mn(){yn.point=Tn}function wn(){Cn(rn,an)}function Tn(t,e){yn.point=Cn,bn(rn=on=t,an=ln=e)}function Cn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,mn+=(n=ln*t-on*e)*(on+t),vn+=n*(ln+e),_n+=3*n,bn(on=t,ln=e)}var Bn=yn;function Pn(t){this._context=t}Pn.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,ji)}},result:es};var En,Rn,On,In,Ln,Dn=Ei(),Fn={point:es,lineStart:function(){Fn.point=zn},lineEnd:function(){En&&jn(Rn,On),Fn.point=es},polygonStart:function(){En=!0},polygonEnd:function(){En=null},result:function(){var t=+Dn;return Dn.reset(),t}};function zn(t,e){Fn.point=jn,Rn=In=t,On=Ln=e}function jn(t,e){In-=t,Ln-=e,Dn.add(Zi(In*In+Ln*Ln)),In=t,Ln=e}var Hn=Fn;function Vn(){this._string=[]}function Nn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),os(t,i(s))),s.result()}return r.area=function(t){return os(t,i(Qs)),Qs.result()},r.measure=function(t){return os(t,i(Hn)),Hn.result()},r.bounds=function(t){return os(t,i(hn)),hn.result()},r.centroid=function(t){return os(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Vs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Vn):new Pn(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 Un(t){return function(e){var i=new Gn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Gn(){}function Yn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),os(i,t.stream(hn)),e(hn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return Yn(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 $n(t,e,i){return Xn(t,[[0,0],e],i)}function Kn(t,e,i){return Yn(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 qn(t,e,i){return Yn(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)}Vn.prototype={_radius:4.5,_circle:Nn(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=Nn(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}},Gn.prototype={constructor:Gn,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 Zn=16,Jn=Gi(30*Vi);function Qn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Zi(b*b+x*x+S*S),A=ts(S/=k),M=Ni(Ni(S)-1)e||Ni((v*B+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Vi:0,B()):[m*Hi,v*Hi,_*Hi]},T.angle=function(t){return arguments.length?(y=t%360*Vi,B()):y*Hi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=Qn(o,w=t*t),P()):Zi(w)},T.fitExtent=function(t,e){return Xn(T,t,e)},T.fitSize=function(t,e){return $n(T,t,e)},T.fitWidth=function(t,e){return Kn(T,t,e)},T.fitHeight=function(t,e){return qn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function rr(t){var e=0,i=Di/3,s=nr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Vi,i=t[1]*Vi):[e*Hi,i*Hi]},n}function ar(t,e){var i=Ki(t),s=(i+Ki(e))/2;if(Ni(s)2?t[2]*Vi:0),e.invert=function(e){return(e=t.invert(e[0]*Vi,e[1]*Vi))[0]*=Hi,e[1]*=Hi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===pr?[[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 fr(t){return Ji((Fi+t)/2)}function mr(t,e){var i=Gi(t),s=t===e?Ki(t):Xi(i/Gi(e))/Xi(fr(e)/fr(t)),n=i*$i(fr(t),s)/s;if(!s)return pr;function r(t,e){n>0?e<-Fi+Li&&(e=-Fi+Li):e>Fi-Li&&(e=Fi-Li);var i=n/$i(fr(e),s);return[i*Ki(s*t),n-i*Gi(s*t)]}return r.invert=function(t,e){var i=n-e,r=qi(s)*Zi(t*t+i*i),a=Ui(t,Ni(i))*qi(i);return i*s<0&&(a-=Di*qi(t)*qi(i)),[a/s,2*Wi($i(n/r,1/s))-Fi]},r}function vr(t,e){return[t,e]}function _r(t,e){var i=Gi(t),s=t===e?Ki(t):(i-Gi(e))/(e-t),n=i/s+t;if(Ni(s)Li&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Tr.invert=cr(ts),Cr.invert=cr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi(Yi(t))-Fi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Lr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Lr(t.slice(0,s),e),o=Lr(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},Dr=Lr;!function(t){var e=Dr;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;r{const i=zr(Vr,e),{tolerance:s}=i;return Fr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Ur=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Kr(e,6):Kr(e,4))+"-"+Kr(t.getUTCMonth()+1,2)+"-"+Kr(t.getUTCDate(),2)+(r?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"."+Kr(r,3)+"Z":n?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"Z":s||i?"T"+Kr(i,2)+":"+Kr(s,2)+"Z":"")}function Zr(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 Yr;if(h)return h=!1,Gr;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(;a0}function la(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=ea(t));var r=[];switch(t.type){case"GeometryCollection":return ha(t,(function(t){da(t,s)})),t;case"FeatureCollection":return la(t,(function(t){la(da(t,s),(function(t){r.push(t)}))})),ai(r)}return da(t,s)}function da(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ha(t,(function(t){da(t,e)})),t;case"LineString":return ua(aa(t),e),t;case"Polygon":return pa(aa(t),e),t;case"MultiLineString":return aa(t).forEach((function(t){ua(t,e)})),t;case"MultiPolygon":return aa(t).forEach((function(t){pa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ua(t,e){oa(t)===e&&t.reverse()}function pa(t,e){oa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ga(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},_a=(t,e={},i)=>{i.type=Wr.GEO;const s=zr(ma,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(va(t))})):e.push(va(t))})),e})(t);let l=t.features;return o&&(l=ca(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=fa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=fa.bounds(t);t.bbox=e}})),t.features=l,t},ya={},ba=(t,e,i)=>{i.type=Wr.GEO;const s=zr(ma,ya,e),{object:n}=s;if(!v(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 Er(a,t)}))}:Er(a,o));var a,o;return _a(r,s,i)},xa=(t,e,i)=>{const s=!h(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 Sa=0;function ka(t="dataset"){return Sa>1e8&&(Sa=0),t+"_"+Sa++}class Aa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:ka("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.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()}}class Ma{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ma||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ur),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ta={albers:lr,albersusa:function(){var t,e,i,s,n,r,a=lr(),o=or().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=or().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)}},Ca=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ca.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class Ea{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",La="inversify:tagged",Da="inversify:paramtypes";class Fa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var za=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 ja(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};za.hasOwnMetadata(t,e)&&(r=za.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,za.defineMetadata(t,r,e)}(La,t,i.toString(),s)}function Ha(t){return(e,i,s)=>{ja(e,0,s,t)}}function Va(t){return e=>(i,s,n)=>Ha(new Fa(t,e))(i,s,n)}const Na=Va(Oa),Wa=Va(Ia);function Ua(){return function(t){return za.defineMetadata(Da,null,t),t}}function Ga(t){return Ha(new Fa(Ra,t))}const Ya="Singleton",Xa="Transient",$a="ConstantValue",Ka="DynamicValue",qa="Factory",Za="Function",Ja="Instance",Qa="Invalid";class to{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Qa,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new to(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ya&&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 eo{getConstructorMetadata(t){return{compilerGeneratedMetadata:za.getMetadata(Da,t),userGeneratedMetadata:za.getMetadata(La,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const io=(so=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===so&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const ao=Symbol("ContributionProvider");class oo{constructor(t,e){this.serviceIdentifier=t,this.container=e,ho.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function lo(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).inSingletonScope().whenTargetNamed(e)}class ho{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ho.store=new Map;class co{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 uo extends co{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const po=Symbol.for("EnvContribution"),go=Symbol.for("VGlobal");const fo=new class{};let mo=0;class vo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=fo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++mo,t),this.tryRunAnimationFrameNextFrame(),mo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class _o{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var yo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xo=function(t,e){return function(i,s){e(i,s,t)}},So=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 ko=class extends _o{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new uo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new vo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return So(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Ao,Mo,wo,To;ko=yo([Ua(),xo(0,Na(ao)),xo(0,Ga(po)),bo("design:paramtypes",[Object])],ko),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Ao||(Ao={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Mo||(Mo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(To||(To={}));const Co=zt-1e-8;class Bo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Co)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%=zt)<0&&(s+=zt),(n%=zt)<0&&(n+=zt),nn;++o,a-=Ft)g(a);else for(a=s-s%Ft+Ft,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Eo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ro={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 Io,Lo,Do,Fo,zo,jo;var Ho,Vo,No,Wo,Uo,Go;function Yo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;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 Xo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ne(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=zt:C>0&&0===r&&(C-=zt);const B=Math.ceil(Math.abs(C/(Ft+.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 Ko(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=il(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function nl(t,e){const{p0:i,p1:s}=t,n=se.pointAtPP(i,s,e);return[new rl(i,n),new rl(n,s)]}class rl extends qo{constructor(t,e){super(),this.type=Uo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return se.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Vt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?se.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Wo.ROW?Ht(this.p0.x-this.p1.x):t===Wo.COLUMN?Ht(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class al{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new sl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new rl(new ie(this._lastX,this._lastY),new ie(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Wo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ht(t.p0.y-s.y)}if(t===Wo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ht(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class ol extends al{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 ll(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function hl(t,e,i){const s=null!=e?e:Ht(i[i.length-1].x-i[0].x)>Ht(i[i.length-1].y-i[0].y)?Wo.ROW:Wo.COLUMN;return"monotoneY"===t?new ol(t,s):new al(t,s)}class cl{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 dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=hl("linear",i,t);return function(t,e){ll(t,e,1)}(new cl(n,s),t),n}function ul(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 pl{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&&ul(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:ul(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 gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("basis",i,t);return function(t,e){ll(t,e,2)}(new pl(n,s),t),n}function fl(t){return t<0?-1:1}function ml(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(fl(r)+fl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function vl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function _l(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 yl{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:_l(this,this._t0,vl(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,_l(this,vl(this,e=ml(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:_l(this,this._t0,e=ml(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 bl extends yl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function xl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("monotoneX",i,t);return function(t,e){ll(t,e,2)}(new yl(n,s),t),n}function Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return dl(t,e);const n=hl("monotoneY",i,t);return function(t,e){ll(t,e,2)}(new bl(n,s),t),n}let kl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Al extends kl{lineEnd(){this.context.closePath()}}function Ml(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new al("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new kl(r,e,n),t),r}function wl(t,e){return ll(t,e,1)}class Tl extends cl{lineEnd(){this.context.closePath()}}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=hl("linear",i,t);return function(t,e){ll(t,e,1)}(new Tl(n,s),t),n}function Bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Lt){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>Lt){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 Pl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return dl(i,n);const o=hl(t,r,i);return ll(new e(o,s,a),i,2),o}}const El=Pl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Bl(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 Rl=Pl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Ol extends qo{constructor(t,e,i){super(),this.type=Uo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return el(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Zo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Wo.ROW?Ht(this.p0.x-this.p2.x):t===Wo.COLUMN?Ht(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Ut(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Vt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=el(i,s,n,e),a=se.pointAtPP(i,s,e),o=se.pointAtPP(s,n,e);return[new Ol(i,a,r),new Ol(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Il{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new rl(new ie(this._lastX,this._lastY),new ie(t,e))}quadraticCurveTo(t,e,i,s){const n=new Ol(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new sl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ll(t,e,i){var s,n;switch(e){case"linear":default:return dl(t,i);case"basis":return gl(t,i);case"monotoneX":return xl(t,i);case"monotoneY":return Sl(t,i);case"step":return Ml(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new al("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new Al(r,e,n),t),r}(t,.5,i);case"stepBefore":return Ml(t,0,i);case"stepAfter":return Ml(t,1,i);case"catmullRom":return El(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Rl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Cl(t,i)}}class Dl extends Po{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Bo(this.bounds)}get curves(){return this.tryBuildCurves()}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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Il(this);Ko(this.commandList,t,0,0,1,1)}return this._curves}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=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`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;tjo){let t,e=Do;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ko(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Wo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.y-e.p1.y)}if(this.direction===Wo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{nt.getInstance().warn("空函数")}}),th=Object.assign(Object.assign({},Yl),{points:[],cornerRadius:0,closePath:!0}),eh=Object.assign(Object.assign({},Yl),{width:100,height:100,spikes:5,thickness:.5}),ih=Object.assign(Object.assign({},Yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const sh=Object.assign(Object.assign({},Yl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),nh=Object.assign(Object.assign(Object.assign({},Yl),Wl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),rh=Object.assign(Object.assign(Object.assign({},Yl),Wl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ah=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Yl),{fill:!0,cornerRadius:0,cornerType:"round"}),oh=Object.assign(Object.assign({},ah),{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}),lh=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&&_(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 hh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(hh.IsGradientStr(t))try{const e=lh(t)[0];if(e){if("linear"===e.type)return hh.ParseLinear(e);if("radial"===e.type)return hh.ParseRadial(e);if("conic"===e.type)return hh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2,n=parseFloat(e.value)/180*Dt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+jt,stops:hh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:hh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2;let n="angular"===e.type?parseFloat(e.value)/180*Dt:0;for(;n<0;)n+=jt;for(;n>=jt;)n-=jt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const uh={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"}},ph=!0,gh=!1,fh=/\w|\(|\)|-/,mh=/[.?!,;:/,。?!、;:]/,vh=/\S/,_h=(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})};function yh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=fo.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=bh(t,a)),a}function bh(t,e,i=!1){let s=e;for(;fh.test(t[s-1])&&fh.test(t[s])||mh.test(t[s]);)if(s--,s<=0)return i?xh(t,e):e;return s}function xh(t,e){let i=e;for(;fh.test(t[i+1])&&fh.test(t[i])||mh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Sh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=fo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var kh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ah=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=nh.fontSize}){let i=0,s=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=bh(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){nt.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,a=!1){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=bh(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}};Ah=kh([Ua()],Ah);var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=Symbol.for("TextMeasureContribution");let Th=class extends Ah{};Th=Mh([Ua()],Th);const Ch=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new eo}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new to(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ro(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case $a:case Za: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===Ya&&(t.cache=e,t.activated=!0)}},Bh=Symbol.for("CanvasFactory"),Ph=Symbol.for("Context2dFactory");function Eh(t){return Ch.getNamed(Bh,fo.global.env)(t)}const Rh=1e-4,Oh=Math.sqrt(3),Ih=1/3;function Lh(t){return t>-$h&&t<$h}function Dh(t){return t>$h||t<-$h}const Fh=[0,0],zh=[0,0],jh=[0,0];function Hh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Vh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Nh(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 Wh(t){return(t%=jt)<0&&(t+=jt),t}function Uh(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+=jt);let d=Math.atan2(l,o);return d<0&&(d+=jt),d>=s&&d<=n||d+jt>=s&&d+jt<=n}function Xh(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 qh=[-1,-1,-1],Zh=[-1,-1];function Jh(){const t=Zh[0];Zh[0]=Zh[1],Zh[1]=t}function Qh(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,Ih):Math.pow(i,Ih),s=s<0?-Math.pow(-s,Ih):Math.pow(s,Ih);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+Oh*Math.sin(e)))/(3*a),h=(-o+i*(s-Oh*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,qh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Jh(),p=Nh(e,s,r,o,Zh[0]),u>1&&(g=Nh(e,s,r,o,Zh[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,qh);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=Vh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);qh[0]=-l,qh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=jt-1e-4){s=0,n=jt;const e=r?1:-1;return a>=qh[0]+t&&a<=qh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=jt,n+=jt);let c=0;for(let e=0;e<2;e++){const i=qh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=jt+t),(t>=s&&t<=n||t+jt>=s&&t+jt<=n)&&(t>Dt/2&&t<1.5*Dt&&(e=-e),c+=e)}}return c}function ic(t){return Math.round(t/Dt*1e8)/1e8%2*Dt}function sc(t,e){let i=ic(t[0]);i<0&&(i+=jt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=jt?n=i+jt:e&&i-n>=jt?n=i-jt:!e&&i>n?n=i+(jt-ic(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;nc[0]=S,nc[1]=k,sc(nc,Boolean(a[6])),S=nc[0],k=nc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case Oo.M:u=m,p=v,c=u,d=p;break;case Oo.L:if(i){if(Xh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Oo.C:if(i){if(Gh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=Qh(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Oo.Q:if(i){if(Uh(c,d,m,v,_,y,e,s,n))return!0}else h+=tc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Oo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Yh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ec(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case Oo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Xh(u,p,o,p,e,s,n)||Xh(o,p,o,l,e,s,n)||Xh(o,l,u,l,e,s,n)||Xh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Oo.Z:if(i){if(Xh(c,d,u,p,e,s,n))return!0}else h+=Pe(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)<$h}(d,p)||(h+=Pe(c,d,u,p,s,n)||0),0!==h}const ac=new class{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const e=Eh(Object.assign({nativeCanvas:fo.global.createCanvas(t)},t));return this.allocatedCanvas.push(e),e}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const e={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},i=Eh(Object.assign({nativeCanvas:fo.global.createCanvas(e)},e));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};var oc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const hc=Symbol.for("VWindow"),cc=Symbol.for("WindowHandlerContribution");let dc=class extends _o{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(){super(),this.hooks={onChange:new uo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Ch.getNamed(cc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=fo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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&&dt(this.width,t.width())&&dt(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)}};dc=oc([Ua(),lc("design:paramtypes",[])],dc);var uc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gc=function(t,e){return function(i,s){e(i,s,t)}};let fc=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=fo.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=ac.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Wl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Wl.fontFamily,fontSize:Wl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Ch.get(hc),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 mc;fc=uc([Ua(),gc(0,Na(ao)),gc(0,Ga(wh)),pc("design:paramtypes",[Object])],fc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(mc||(mc={}));const vc=new Ve;let _c=class{constructor(){this.matrix=new Ve}init(t){return this.mode=mc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=mc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(vc.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(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(vc.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(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}scale(t,e,i){return this.mode===mc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===mc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return vc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(vc.a,vc.b,vc.c,vc.d,vc.e,vc.f),this}translate(t,e){return this.mode===mc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===mc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};_c=uc([Ua(),pc("design:paramtypes",[])],_c);const yc={arc:Xl,area:$l,circle:Kl,line:Jl,path:Ql,symbol:sh,text:nh,rect:ih,polygon:th,star:eh,richtext:rh,richtextIcon:oh,image:ah,group:ql,glyph:Zl},bc=Object.keys(yc);function xc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Sc={arc:Object.assign({},yc.arc),area:Object.assign({},yc.area),circle:Object.assign({},yc.circle),line:Object.assign({},yc.line),path:Object.assign({},yc.path),symbol:Object.assign({},yc.symbol),text:Object.assign({},yc.text),rect:Object.assign({},yc.rect),polygon:Object.assign({},yc.polygon),star:Object.assign({},yc.star),richtext:Object.assign({},yc.richtext),richtextIcon:Object.assign({},yc.richtextIcon),image:Object.assign({},yc.image),group:Object.assign({},yc.group),glyph:Object.assign({},yc.glyph)};class kc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},bc.forEach((t=>{this._defaultTheme[t]=Object.create(Sc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;bc.forEach((s=>{const n=Object.create(Sc[s]);t&&t[s]&&xc(n,t[s]),i[s]&&xc(n,i[s]),e[s]&&xc(n,e[s]),this.combinedTheme[s]=n})),e.common&&bc.forEach((t=>{xc(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 Ac=new kc;function Mc(t,e){return t.glyphHost?Mc(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)):Ac.getTheme()}return null}(t)||t.attachedThemeGraphic&&Mc(t.attachedThemeGraphic)||Ac.getTheme()}var wc=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 o{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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return wc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Pc))return void nt.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(Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Ic(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 Pc))return void nt.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=Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Ic(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 Pc))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Oc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ic(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(Ic(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,Ic(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 Pc))return void nt.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"):Ic(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 Ec))return void nt.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=Oc.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 Pc,this.rootWheelEvent=new Ec,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class jc{static GetImage(t,e){var i;const s=jc.cache.get(t);s?"fail"===s.loadState?fo.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):jc.loadImage(t,e)}static GetSvg(t,e){var i;let s=jc.cache.get(t);s?"fail"===s.loadState?fo.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"},jc.cache.set(t,s),s.dataPromise=fo.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=jc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},jc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=fo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=fo.global.loadBlob(t):"json"===e&&(i.dataPromise=fo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!jc.isLoading&&jc.toLoadAueue.length){jc.isLoading=!0;const t=jc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(jc.cache.set(i,n),n.dataPromise=fo.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((()=>{jc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jc.loading()})).catch((t=>{console.error(t),jc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),jc.loading()}))}}),0)}static loadImage(t,e){const i=Hc(t,jc.toLoadAueue);if(-1!==i)return jc.toLoadAueue[i].marks.push(e),void jc.loading();jc.toLoadAueue.push({url:t,marks:[e]}),jc.loading()}static improveImageLoading(t){const e=Hc(t,jc.toLoadAueue);if(-1!==e){const t=jc.toLoadAueue.splice(e,1);jc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Hc(t,e){for(let i=0;it?_(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,Gc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Yc=[1,2,3,0,1,2,3,0];function Xc(t,e,i,s){for(;t>=jt;)t-=jt;for(;t<0;)t+=jt;for(;t>e;)e+=jt;Gc[0].x=i,Gc[1].y=i,Gc[2].x=-i,Gc[3].y=-i;const n=Math.ceil(t/Ft)%4,r=Math.ceil(e/Ft)%4;if(s.add(Nt(t)*i,Gt(t)*i),s.add(Nt(e)*i,Gt(e)*i),n!==r||e-t>Dt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Zc.TimeOut=1e3/60;const Jc=new Zc,Qc=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class td{bounds(t,e){if(x(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 x(t)?t:Math.min(t[0],t[1])}}function ed(t,e,i,s,n){return n?t.arc(i,s,e,0,zt,!1,n):t.arc(i,s,e,0,zt),!1}var id=new class extends td{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 ed(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ed(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 sd=new class extends td{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 nd(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 rd=new class extends td{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 nd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return nd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return nd(t,this.parseSize(e)/2+n,i,s,r)}};function ad(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var od=new class extends td{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ad(t,this.parseSize(e)/2+n,i,s)}};function ld(t,e,i,s,n=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 hd extends td{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 ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2,i,s,n)}}var cd=new hd;var dd=new class extends hd{constructor(){super(...arguments),this.type="triangle"}};const ud=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),pd=Math.sin(zt/10)*ud,gd=-Math.cos(zt/10)*ud;function fd(t,e,i,s){const n=pd*e,r=gd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=zt*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 md=new class extends td{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2+n,i,s)}};const vd=Yt(3);function _d(t,e,i,s){const n=e,r=n/vd,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 yd=new class extends td{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 _d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return _d(t,this.parseSize(e)/2+n,i,s)}};function bd(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 xd=new class extends td{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}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+n,i,s)}};function Sd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var kd=new class extends td{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const Ad=-.5,Md=Yt(3)/2,wd=1/Yt(12);function Td(t,e,i,s){const n=e/2,r=e*wd,a=n,o=e*wd+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(Ad*n-Md*r+i,Md*n+Ad*r+s),t.lineTo(Ad*a-Md*o+i,Md*a+Ad*o+s),t.lineTo(Ad*l-Md*h+i,Md*l+Ad*h+s),t.lineTo(Ad*n+Md*r+i,Ad*r-Md*n+s),t.lineTo(Ad*a+Md*o+i,Ad*o-Md*a+s),t.lineTo(Ad*l+Md*h+i,Ad*h-Md*l+s),t.closePath(),!1}var Cd=new class extends td{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 Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};function Bd(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 Pd=new class extends td{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 Bd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2,i,s,n)}};function Ed(t,e,i,s,n=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 Rd=new class extends td{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends td{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};const Ld=Yt(3);function Dd(t,e,i,s){const n=e*Ld;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Fd=new class extends td{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Dd(t,this.parseSize(e)/2/Ld,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2/Ld+n,i,s)}};function zd(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 jd=new class extends td{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 zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/4+n,i,s)}};function Hd(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 Vd=new class extends td{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Wd=new class extends td{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Gd=new class extends td{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Yd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Xd=new class extends td{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Yd(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 $d(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Kd=new class extends td{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return $d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return $d(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 qd(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 Zd=new class extends td{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 qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Qd(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var tu=new class extends td{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 x(e)?Qd(t,e,i,s):Jd(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?Qd(t,e+2*n,i,s):Jd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const eu=new je;class iu{constructor(t,e,i=!1){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(),Ko(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ko(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 x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{eu.x1=i.bounds.x1*t,eu.y1=i.bounds.y1*t,eu.x2=i.bounds.x2*t,eu.y2=i.bounds.y2*t,e.union(eu)}))}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 su={};[id,sd,rd,od,Fd,dd,md,yd,xd,kd,Cd,Pd,Rd,cd,Id,jd,Vd,Wd,Gd,tu,Xd,Kd,Zd].forEach((t=>{su[t.type]=t}));const nu={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ru{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 au(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function ou(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=ou(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=au(t,"--\x3e",r+4,"Comment is not closed.");else{const a=ou(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 ru(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 ru(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 cu(t,e){return du(t)}function du(t,e){const i={};for(let e=0;ebu.set(t,!0)));const xu=new Map;function Su(t){if(bu.has(t))return!0;if(xu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>xu.set(t,!0)));const ku=_u(),Au=_u(),Mu=_u(),wu=_u(),Tu=_u(),Cu=_u(),Bu=_u(),Pu=_u(),Eu=_u(),Ru=_u();_u();const Ou=_u();_u();const Iu=_u();_u();const Lu=_u(),Du=_u(),Fu=Symbol.for("GraphicService"),zu=Symbol.for("GraphicCreator"),ju={"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"},Hu=Object.keys(ju),Vu={duration:200,easing:"cubicOut"};function Nu(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 Wu(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 Uu(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 Gu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Yu(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 Xu{constructor(){this.pools=[]}static identity(t){return Nu(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 Xu.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},Zu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Ju=new Ve(1,0,0,1,0,0),Qu={x:0,y:0};let tp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this.path=new Dl,this._clearMatrix=new Ve(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return $u.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},Qu),function(t,e,i){return rc(t,0,!1,e,i)}(this.path.commandList,Qu.x,Qu.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Qu);const i=ch(this,this.lineWidth,this.dpr);return function(t,e,i,s){return rc(t,e,!0,i,s)}(this.path.commandList,i,Qu.x,Qu.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Ju,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>$u.free(t))),this.stack.length=0}};tp=qu([Ua(),Zu("design:paramtypes",[Object,Number])],tp);const ep={WIDTH:500,HEIGHT:500,DPR:1};class ip{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}set nativeCanvas(t){this._nativeCanvas=t}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=ep.WIDTH,height:n=ep.HEIGHT,dpr:r=ep.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var sp;ip.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sp||(sp={}));class np{static Get(t,e=sp.Color1,i=[0,0,0,1]){if(e===sp.Color1){const e=np.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Qe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];np.store1[t]=e,np.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=np.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Qe.parseColorString(t);return n&&(np.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],np.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===sp.Color1){if(np.store1[t])return;np.store1[t]=i,np.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(np.store255[t])return;np.store255[t]=i,np.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function rp(t,e=!1){return Array.isArray(t)&&x(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 ap(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return op(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):op(t,e,i,s,n)}function op(t,e,i,s,n){if(!t||!e)return t&&rp(t)||e&&rp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=np.Get(t,sp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=np.Get(e,sp.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:rp(a)})))});return o?ap(r,l,i,s,n):ap(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:dp(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:dp(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:dp(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),rp(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)}function lp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}np.store255={},np.store1={};const hp=[0,0,0,0],cp=[0,0,0,0];function dp(t,e,i){return np.Get(t,sp.Color255,hp),np.Get(e,sp.Color255,cp),`rgba(${Math.round(hp[0]+(cp[0]-hp[0])*i)},${Math.round(hp[1]+(cp[1]-hp[1])*i)},${Math.round(hp[2]+(cp[2]-hp[2])*i)},${hp[3]+(cp[3]-hp[3])*i})`}class up{static GetCanvas(){try{return up.canvas||(up.canvas=fo.global.createCanvas({})),up.canvas}catch(t){return null}}static GetCtx(){if(!up.ctx){const t=up.GetCanvas();up.ctx=t.getContext("2d")}return up.ctx}}class pp extends Ne{static getInstance(){return pp._instance||(pp._instance=new pp),pp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=up.GetCanvas(),s=up.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new pp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class gp{static GetSize(t){for(let e=0;e=t)return gp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=gp.GenKey(t,e,i,s,n),l=gp.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=gp.GenKey(t,e,i,s,n);gp.cache[l]?gp.cache[l].push({width:a,height:o,pattern:r}):gp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}gp.cache={},gp.ImageSize=[20,40,80,160,320,640,1280,2560];const fp=new je,mp=new Ve;new je;const vp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],_p=["x","y"],yp=["scaleX","scaleY"],bp=["angle"],xp=new ie,Sp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class kp extends Tc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=su[t];if(e)return e;if(e=kp.userSymbolMap[t],e)return e;if(!0===((i=t=nu[t]||t).startsWith("{const e=(new Dl).fromString(t.d),i={};Hu.forEach((e=>{t[e]&&(i[ju[e]]=t[e])})),n.push({path:e,attribute:i}),fp.union(e.bounds)}));const r=fp.width(),a=fp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new iu(t,n,!0);return kp.userSymbolMap[t]=l,l}var i;const s=(new Dl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new iu(t,s);return kp.userSymbolMap[t]=o,o}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=Uc(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 Bo(t);return Ko(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ve),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Ho.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Ho.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Ho.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Ho.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Ho.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&Ho.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Ho.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Vo.GLOBAL){const i=new ie(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Vu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:No.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:No.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:No.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Ho.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Ho.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Ho.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Ho.UPDATE_SHAPE_AND_BOUNDS)===Ho.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Ho.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ho.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Ho.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Ho.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Ho.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Ho.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Ho.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Ho.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=jl.x,y:e=jl.y,scaleX:i=jl.scaleX,scaleY:s=jl.scaleY,angle:n=jl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Nt(a),f=Gt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),fo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(jl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=mp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:No.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:fo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new Dl).fromString(t):this.pathProxy=new Dl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),fo.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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||fo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new tp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Ap;kp.userSymbolMap={},kp.mixin(Dc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Ap||(Ap={}));let Mp=class t extends kp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Cu,this._childUpdateTag=Ho.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 kc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new kc)}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 ie(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&Ho.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=jl.x,y:e=jl.y,dx:i=jl.dx,dy:s=jl.dy,scaleX:n=jl.scaleX,scaleY:r=jl.scaleY,angle:a=jl.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 Mc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return fo.graphicService.updateTempAABBBounds(i),fo.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&=Ho.CLEAR_BOUNDS,this._childUpdateTag&=Ho.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Ho.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Ho.UPDATE_BOUNDS||(this._childUpdateTag|=Ho.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Ho.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=fo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function wp(t){return new Mp(t)}Mp.NOWORK_ANIMATE_ATTR=Sp;class Tp extends Mp{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 kc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{fo.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=>{fo.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 Cp=Symbol.for("TransformUtil"),Bp=Symbol.for("GraphicUtil"),Pp=Symbol.for("LayerService"),Ep=Symbol.for("StaticLayerHandlerContribution"),Rp=Symbol.for("DynamicLayerHandlerContribution"),Op=Symbol.for("VirtualLayerHandlerContribution");var Ip,Lp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fp=Ip=class{static GenerateLayerId(){return`${Ip.idprefix}_${Ip.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=fo.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?Ch.get(Ep):"dynamic"===t?Ch.get(Rp):Ch.get(Op),e}createLayer(t,e={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 Tp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ip.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)}};Fp.idprefix="visactor_layer",Fp.prefix_count=0,Fp=Ip=Lp([Ua(),Dp("design:paramtypes",[])],Fp);var zp=new Ea((t=>{t(go).to(ko).inSingletonScope(),t(hc).to(dc),t(Bp).to(fc).inSingletonScope(),t(Cp).to(_c).inSingletonScope(),t(Pp).to(Fp).inSingletonScope()}));function jp(t,e){return!(!t&&!e)}function Hp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Vp(t,e,i){return i&&t*e>0}function Np(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Wp(t,e){return t*e>0}function Up(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Gp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-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-m,B=M-v,P=w-m,E=T-v;return C*C+B*B>P*P+E*E&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Yp(t,e,i,s,n){const r=Ht(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 k=n*Nt(c),A=n*Gt(c),M=s*Nt(u),w=s*Gt(u);let T,C,B,P;if((b>Lt||y>Lt)&&(T=n*Nt(d),C=n*Gt(d),B=s*Nt(p),P=s*Gt(p),r1?0:E<-1?Dt:Math.acos(E))/2),l=Yt(t[0]*t[0]+t[1]*t[1]);S=Ut(b,(s-l)/(o-1)),x=Ut(y,(n-l)/(o+1))}}var E;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:P,xore:T,yore:C,xire:M,yire:w,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 Xp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ht(l-o),c=l>o;let d=!1;if(n=jt-Lt)e.moveTo(i+n*Nt(o),s+n*Gt(o)),e.arc(i,s,n,o,l,!c),r>Lt&&(e.moveTo(i+r*Nt(l),s+r*Gt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:P,innerCornerRadiusEnd:E,maxInnerCornerRadius:R}=Yp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Lt){const t=Ut(v,m),r=Ut(_,m),o=Gp(g,f,u,p,n,t,Number(c)),l=Gp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,n,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Nt(Vt(l.y01,l.x01)),s+l.cy+r*Gt(Vt(l.y01,l.x01))):e.moveTo(i+b,s+n*Gt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Nt(M),s+n*Gt(M));if(!(r>Lt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Lt){const t=Ut(P,w),n=Ut(E,w),o=Gp(S,k,b,x,r,-n,Number(c)),l=Gp(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),w0&&e.arc(i+o.cx,s+o.cy,n,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,r,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Nt(Vt(l.y01,l.x01)),s+l.cy+t*Gt(Vt(l.y01,l.x01))):e.moveTo(i+g,s+f)}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,B,c):e.moveTo(i+r*Nt(B),s+r*Gt(B))}return a?a[3]&&e.lineTo(i+n*Nt(o),s+n*Gt(o)):e.closePath(),d}const $p=Symbol.for("ArcRenderContribution"),Kp=Symbol.for("AreaRenderContribution"),qp=Symbol.for("CircleRenderContribution"),Zp=Symbol.for("GroupRenderContribution"),Jp=Symbol.for("ImageRenderContribution"),Qp=Symbol.for("PathRenderContribution"),tg=Symbol.for("PolygonRenderContribution"),eg=Symbol.for("RectRenderContribution"),ig=Symbol.for("SymbolRenderContribution"),sg=Symbol.for("TextRenderContribution"),ng=Symbol.for("InteractiveSubRenderContribution");function rg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function ag(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}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)},hg=function(t,e){return function(i,s){e(i,s,t)}};function cg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Nu(t),Wu(t,t,[n+o,r+l,a+h]),Wu(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),Wu(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]),f){const i=Ku.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]}Wu(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),Wu(i,i,[-s[0],-s[1],0]),Gu(t,t,i)}}let dg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new uo(["graphic"]),onSetStage:new uo(["graphic","stage"]),onRemove:new uo(["graphic"]),onRelease:new uo(["graphic"]),onAddIncremental:new uo(["graphic","group","stage"]),onClearIncremental:new uo(["graphic","group","stage"]),beforeUpdateAABBBounds:new uo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new je,this.tempAABBBounds2=new je}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Bo(t);return Ko(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=ag(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=rg(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){mu(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;mu(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&&Fe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};dg=og([Ua(),hg(0,Na(zu)),lg("design:paramtypes",[Object])],dg);const ug=(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},pg=["radius","startAngle","endAngle",...vp];class gg extends kp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=wu}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 Mc(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}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.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>jt-Lt?i.set(-r,-r,r,r):Xc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,pg)}needUpdateTag(t){return super.needUpdateTag(t,pg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Dl,s.arc(0,0,r,a,o),s}clone(){return new gg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return gg.NOWORK_ANIMATE_ATTR}}function fg(t){return new gg(t)}gg.NOWORK_ANIMATE_ATTR=Sp;class mg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Ao.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Du,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 Mc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new _g({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=fo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){mu(n,o/Math.abs(r+a),!0,l),i.union(n)}return fo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||fo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Fe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=fo.graphicUtil.textMeasure,S=new mg(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:k}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:y=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),k=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const A=fo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:k},w=new mg(r,M,A),T=_(t)?t.map((t=>t.toString())):[t.toString()],C=[],B=[0,0];let P=1/0;if(y>0&&(P=Math.max(Math.floor(y/k),1)),b&&(P=Math.min(P,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=T.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const t=rg(v,r),e=this.cache.verticalList.length*m,i=ag(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===yu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const b=rg(v,r),x=this.cache.verticalList.length*m,S=ag(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Qc(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=vg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=vg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new _g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _g.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return _g.baselineMapAlign}getAlignMapBaseline(){return _g.alignMapBaseline}}function yg(t){return new _g(t)}_g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Sp),_g.baselineMapAlign={top:"left",bottom:"right",middle:"center"},_g.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const bg=["symbolType","size",...vp];let xg=class t extends kp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Lu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Mc(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}=fo.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;mu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return fo.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,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Dl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Dl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Sp);const kg=["segments","points","curveType","curveTension",...vp];let Ag=class t extends kp{constructor(t={}){super(t),this.type="line",this.numberType=Pu}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=Kc(i,s,e))}getGraphicTheme(){return Mc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),fo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return fo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Dl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Mg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Sp);const wg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Tg=["width","x1","y1","height","cornerRadius",...vp];class Cg extends kp{constructor(t){super(t),this.type="rect",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Mc(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}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=wg(e);return t=new Dl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Cg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Cg.NOWORK_ANIMATE_ATTR}}function Bg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Sp;class Pg extends kp{constructor(t){super(t),this.type="glyph",this.numberType=Tu,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,e=!1,i){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 Mc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Pg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Eg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Sp;class Rg{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=uh[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}}}function Og(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ig{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Qc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Sh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Sh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=yh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Og(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=yh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=yh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Sh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Lg=["width","height","image",...vp];class Dg extends kp{constructor(t){super(t),this.type="image",this.numberType=Bu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Mc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=fo.graphicService.updateTempAABBBounds(i);return ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ah[t]}needUpdateTags(t){return super.needUpdateTags(t,Lg)}needUpdateTag(t){return super.needUpdateTag(t,Lg)}clone(){return new Dg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Sp);class zg extends Dg{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=Uc(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=Uc(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=ah.width,height:e=ah.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 jg{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 zg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=uh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ig){const e=vh.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 zg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Sh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof zg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof zg)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||gh;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,_h(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||ph;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?dh(t,s,{AABBBounds:i}):s,_h(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof zg)break;const{width:n}=Sh(t,s.character,s.ascentDescentMode),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 zg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Hg{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=uh[this.direction]}store(t){if(t instanceof zg){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 jg(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,e=!1){t instanceof zg?"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||this.newLine)&&("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=yh(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 Ig(i,t.newLine,t.character,t.ascentDescentMode),new Ig(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Vg=!1;try{Vg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Vg=!1}const Ng=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...vp];class Wg extends kp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Iu,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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.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:rh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Mc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Wg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Wg.splitText(t.text).length>1)))}static splitText(t){if(Vg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Wg.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),fo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||fo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,fo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}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;e0&&!Wg.AllSingleCharacter(_)&&(_=Wg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Rg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Hg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Wg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Wg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Sp);const Gg=["path","customPath",...vp];class Yg extends kp{constructor(t){super(t),this.type="path",this.numberType=Eu}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 Dl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dl?this.cache:t.path)}getGraphicTheme(){return Mc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=fo.graphicService.updateTempAABBBounds(i);ug(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return fo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Dl).fromString(t.path):t.customPath&&(this.cache=new Dl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}toCustomPath(){return(new Dl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Yg.NOWORK_ANIMATE_ATTR}}function Xg(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Sp);const $g=["segments","points","curveType","curveTension",...vp];class Kg extends kp{constructor(t){super(t),this.type="area",this.numberType=Mu}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 Mc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),fo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return fo.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=Kc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Dl;const 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 Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Sp);const Zg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...vp];class Jg extends kp{constructor(t){super(t),this.type="arc",this.numberType=ku}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(x(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=ae(e),i=e+r,s&&Ht(r)Lt&&o>Lt)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=Yt(a*a+o*o)}=this.attribute,h=Ht(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Lt&&l>Lt){const i=e>t?1:-1;let s=$t(Number(l)/o*Gt(g)),n=$t(Number(l)/a*Gt(g));return(f-=2*s)>Lt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Lt?(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 Mc(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}=fo.graphicService.updateTempAABBBounds(i);ug(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return fo.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<=Lt?i.set(0,0,0,0):Math.abs(o-l)>jt-Lt?i.set(-s,-s,s,s):(Xc(l,o,s,i),Xc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ht(o-a),d=o>a;if(h=jt-Lt)n.moveTo(0+h*Nt(a),0+h*Gt(a)),n.arc(0,0,h,a,o,!d),l>Lt&&(n.moveTo(0+l*Nt(o),0+l*Gt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Nt(a),e=h*Gt(a),i=l*Nt(o),s=l*Gt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Sp);const tf=["points","cornerRadius",...vp];class ef extends kp{constructor(t){super(t),this.type="polygon",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Mc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),fo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return fo.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=Kc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Dl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Sp;class nf extends Mp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function rf(t){return new nf(t)}const af=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 of,lf;function hf(t){return of||(of=af.CreateGraphic("text",{})),of.initAttributes(t),of.AABBBounds}var cf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uf=function(t,e){return function(i,s){e(i,s,t)}};class pf{constructor(){this.time=Go.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Mc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=ac.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),ac.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const gf=new pf;let ff=class{constructor(t){this.subRenderContribitions=t,this.time=Go.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)}))}};ff=cf([Ua(),uf(0,Na(ao)),uf(0,Ga(ng)),df("design:paramtypes",[Object])],ff);const mf=new class{constructor(){this.time=Go.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const vf=new class{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class _f{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=ac.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])),ac.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,jt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=ac.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Sg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:ch(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(),Xp(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"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},xf=yf,Sf=gf;const kf=new class{constructor(){this.time=Go.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{radius:m=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:ch(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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"),f&&M(p,"innerBorder")}},Af=yf,Mf=gf;const wf=new class extends pf{constructor(){super(...arguments),this.time=Go.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Tf=Dt/2;function Cf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Ht(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ht(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ht(t[0]),i=Ht(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ht(l[0]),l[1]=Ht(l[1]),l[2]=Ht(l[2]),l[3]=Ht(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Tf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Tf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Tf,Dt,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Dt,Dt+Tf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Bf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pf{constructor(){this.time=Go.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,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:ch(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(),Cf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),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&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Ef=class{constructor(){this.time=Go.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)}};Ef=Bf([Ua()],Ef);let Rf=class{constructor(){this.time=Go.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,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x: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 Cf(e,i,s,b,x,v,"bevel"!==y,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Rf=Bf([Ua()],Rf);const Of=new Pf,If=yf,Lf=gf;const Df=new class extends Pf{constructor(){super(...arguments),this.time=Go.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)}},Ff=gf;const zf=new class{constructor(){this.time=Go.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:_=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:ch(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()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},jf=new class{constructor(){this.time=Go.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Hf=yf,Vf=gf;const Nf={x:0,y:0,z:0,lastModelMatrix:null};class Wf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(mf),this.builtinContributions.push(vf),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===Go.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Go.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Mc(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,_=Vp(d,u,h),y=Wp(d,g),b=jp(h),x=Hp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Ko(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Vp(o,l,n),p=Wp(o,c),g=jp(n,r),f=Hp(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,s=!1){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;Nf.x=n,Nf.y=r,Nf.z=a,Nf.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=Ku.allocate(),n=Ku.allocate();cg(n,t,e),Gu(s,d||s,n),Nf.x=0,Nf.y=0,Nf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Ku.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Nf.x+=s.x,Nf.y+=s.y,Nf.z=a,i.setTransformForCurrent()}else if(p)Nf.x=0,Nf.y=0,Nf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Nf.x+=s.x,Nf.y+=s.y,this.transformWithoutTranslate(i,Nf.x,Nf.y,Nf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Nf.x=0,Nf.y=0,Nf.z=0;return Nf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Ku.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yf=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ku,this.builtinContributions=[bf,Sf,xf],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(nLt){const t=Ut(b,y),r=Ut(x,y),a=Gp(v,_,f,m,n,t,Number(u)),o=Gp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Vt(o.y11,o.x11),Vt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Lt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Lt){const t=Ut(P,T),n=Ut(E,T),a=Gp(M,w,k,A,r,-n,Number(u)),o=Gp(f,m,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,Vt(a.y01,a.x01),Vt(a.y11,a.x11),!u);const t=Vt(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*Nt(B),s+r*Gt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Mc(t,null==r?void 0:r.theme).arc;const{fill:c=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:_,doStroke:y}=f,{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=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ht(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Nc[s]=t,i&&(i=!(null!==(e=Nc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Nc[e]=!!t[e],i&&(i=!!Nc[e]);else Nc[0]=!1,Nc[1]=!1,Nc[2]=!1,Nc[3]=!1;return{isFullStroke:i,stroke:Nc}})(d);if((_||B)&&(e.beginPath(),Xp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Xp(t,e,i,s,A,M,P),C||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())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ht(h-r)>=jt-Lt){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,m,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+=jt;for(;i>jt;)i-=jt;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),ap(o.color,l.color,h,!1)}(0,0,h,n);a||Vp&&(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,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Xf=Uf([Ua(),Yf(0,Na(ao)),Yf(0,Ga($p)),Gf("design:paramtypes",[Object])],Xf);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)},qf=function(t,e){return function(i,s){e(i,s,t)}};let Zf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[kf,Mf,Af],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Jf(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]=il(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 Qf(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 tm(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=Qf(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),Jf(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Wo.ROW:"y"===s?u=Wo.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 im=class extends Wf{constructor(){super(...arguments),this.numberType=Pu}draw(t,e,i,s){const n=Mc(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;if(!e)return;t.beginPath();tm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Ut(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function sm(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),Jf(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),Jf(t,l,1,s),o=!1):o=!0}t.closePath()}im=em([Ua()],im);const nm=new class extends _f{constructor(){super(...arguments),this.time=Go.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:qc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:qc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:qc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:qc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},rm=gf;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)}};let hm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[nm,rm],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=Mc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function P(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,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=Ll(P(t.points,x),B,{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=Ll(P(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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=P(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ll(e,B,{curveTension:b}),n=Ll(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Ut(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Mc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Wo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ht(y.x-b.x),k=Ht(y.y-b.y);x=null==y.x1?Wo.ROW:null==y.y1?Wo.COLUMN:Number.isFinite(S+k)?S>k?Wo.ROW:Wo.COLUMN:Wo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Wo.ROW:Wo.COLUMN,Number.isFinite(c)||(o=Wo.COLUMN),Number.isFinite(d)||(o=Wo.ROW);const u=i*(o===Wo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),tm(t,i[0]?e.top:e.bottom,l,x===Wo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};hm=am([Ua(),lm(0,Na(ao)),lm(0,Ga(Kp)),om("design:paramtypes",[Object])],hm);const cm=yf,dm=gf;var um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gm=function(t,e){return function(i,s){e(i,s,t)}};let fm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[dm,cm],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:Mc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ko(t.pathShape.commandList,e,i,s,1,1,f);else{Ko((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,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=Mc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};fm=um([Ua(),gm(0,Na(ao)),gm(0,Ga(Qp)),pm("design:paramtypes",[Object])],fm);var mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vm=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 ym=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Ou,this.builtinContributions=[Of,Lf,If],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Mc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Np(g,f,w,T,h),B=Up(g,v,w,T,M),P=jp(h,c),E=Hp(d,m);if(!t.valid||!y)return;if(!P&&!E)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Cf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:P,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,P,E,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,P,E,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};ym=mm([Ua(),_m(0,Na(ao)),_m(0,Ga(eg)),vm("design:paramtypes",[Object])],ym);var bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sm=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[zf,Vf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Mc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Mc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};km=bm([Ua(),Sm(0,Na(ao)),Sm(0,Ga(ig)),xm("design:paramtypes",[Object])],km);const Am=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new je)}allocate(t,e,i,s){if(!this.pools.length)return(new je).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 je(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Mm=new class extends pf{constructor(){super(...arguments),this.time=Go.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=p(T)&&T.background,E=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(g=T.dx)&&void 0!==g?g: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!==(_=T.height)&&void 0!==_?_:e.height();if(B=Am.allocate(i,s,i+n,s+r),T=T.background,!E){const t=B.width(),e=B.height();B.set((null!==(y=T.x)&&void 0!==y?y: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 B=t.AABBBounds,E||(B=hf(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(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Cf(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Am.free(B),C()}};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},Tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Mm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Mc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=Qc(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=$u.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),$u.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(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,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Mc(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:rg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Pm(t,e,i,s){if(e&&e.length){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},Dm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fm=function(t,e){return function(i,s){e(i,s,t)}};let zm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(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))?Pm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Pm(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,_=v/m;const y=Em(d,u),b=Em(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Rm(h,_,y,d,u),k=Rm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Em(A,M),T=Rm(h,Em(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let P=B-C;P<0&&(C=B,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,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=Mc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};zm=Lm([Ua(),Fm(0,Na(ao)),Fm(0,Ga(tg)),Dm("design:paramtypes",[Object])],zm);var jm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Cu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Mc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Np(p,m,g,f,c),C=Up(p,v,g,f),B=jp(c,u),P=Hp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!P)return;if(!(T||C||a||o||u))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,g,f)):(e.beginPath(),Cf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf));const E={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Go.beforeFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o,E)})),h&&e.clip();const R=()=>{E.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{E.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Go.afterFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=fo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Mc(t,null==s?void 0:s.theme).group,i=Ku.allocate(),n=Ku.allocate();cg(n,t,e),Gu(i,p||i,n),a.modelMatrix=i,Ku.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ku.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Nm=jm([Ua(),Vm(0,Na(ao)),Vm(0,Ga(Zp)),Hm("design:paramtypes",[Object])],Nm);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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,s){e(i,s,t)}};const Ym=["","repeat-x","repeat-y","repeat"];let Xm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[Df,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Mc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Cf(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Ym[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void jc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Mc(t).image;this._draw(t,a,!1,i)}};Xm=Wm([Ua(),Gm(0,Na(ao)),Gm(0,Ga(Jp)),Um("design:paramtypes",[Object])],Xm);const $m=Symbol.for("IncrementalDrawContribution"),Km=Symbol.for("ArcRender"),qm=Symbol.for("AreaRender"),Zm=Symbol.for("CircleRender"),Jm=Symbol.for("GraphicRender"),Qm=Symbol.for("GroupRender"),tv=Symbol.for("LineRender"),ev=Symbol.for("PathRender"),iv=Symbol.for("PolygonRender"),sv=Symbol.for("RectRender"),nv=Symbol.for("SymbolRender"),rv=Symbol.for("TextRender"),av=Symbol.for("RichTextRender"),ov=Symbol.for("GlyphRender"),lv=Symbol.for("ImageRender"),hv=Symbol.for("DrawContribution"),cv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Au,!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+=jt;for(;o<0;)o+=jt;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 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},uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const pv=Symbol.for("DrawItemInterceptor"),gv=new je,fv=new je;class mv{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){gv.copy(s.dirtyBounds),fv.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,$u.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(gv),s.backupDirtyBounds.copy(fv)),!0}}class vv{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 _v=class{constructor(){this.order=1,this.interceptors=[new mv,new bv,new yv,new vv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Ku.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kv=function(t,e){return function(i,s){e(i,s,t)}};const Av=Symbol.for("RenderService");let Mv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Mv=xv([Ua(),kv(0,Na(hv)),Sv("design:paramtypes",[Object])],Mv);var wv=new Ea((t=>{t(Av).to(Mv)}));const Tv=Symbol.for("PickerService"),Cv=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Ev([Ua()],Rv);let Ov=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=Mc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=$u.allocateByObj(a),u=new ie(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}};Ov=Ev([Ua()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ie(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}};Iv=Ev([Ua()],Iv);let Lv=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=cv(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()}};Lv=Ev([Ua()],Lv);var Dv=new Ea(((t,e,i)=>{i(Tv)||(t(Cv).toSelf(),t(Tv).toService(Cv)),t(Lv).toSelf().inSingletonScope(),t(Bv).toService(Lv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),lo(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),lo(t,Pv)})),Fv=new Ea((t=>{t(Fu).to(dg),t(zu).toConstantValue(af)}));const zv=Symbol.for("AutoEnablePlugins"),jv=Symbol.for("PluginService");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},Vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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&&Ch.isBound(zv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Hv([Ua(),Nv(0,Na(ao)),Nv(0,Ga(zv)),Vv("design:paramtypes",[Object])],Wv);var Uv=new Ea((t=>{t(jv).to(Wv),function(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).whenTargetNamed(e)}(t,zv)})),Gv=new Ea((t=>{lo(t,po)})),Yv=new Ea((t=>{t(wh).to(Th).inSingletonScope(),lo(t,wh)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kv=class{constructor(){this.type="static",this.offscreen=!1,this.global=fo.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=Eh({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()}};Kv=Xv([Ua(),$v("design:paramtypes",[])],Kv);var qv=new Ea((t=>{t(Kv).toSelf(),t(Ep).toService(Kv)}));var Zv=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 Jv(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 Qv(t,e,i,s=!1,n=!1){let 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}=Jv(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;t{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}=Jv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,s){e(i,s,t)}};let r_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Qv(e,Yl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ze,this.backupDirtyBounds=new ze,this.global=fo.global,this.layerService=fo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=me(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,$u.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=e_(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&&!be(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Am.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=$u.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Am.free(n),$u.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||Ch.get($m);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 o_=class extends im{constructor(){super(...arguments),this.numberType=Pu}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=Mc(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=Vp(u,p,c),_=Wp(u,g),y=jp(c),b=Hp(d,f);if(!t.valid||!m)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())}};o_=a_([Ua()],o_);var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 h_=class extends hm{constructor(){super(...arguments),this.numberType=Mu}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=Mc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Vp(u,d,c),f=jp(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())}};h_=l_([Ua()],h_);var c_,d_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},u_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p_=function(t,e){return function(i,s){e(i,s,t)}},g_=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"}(c_||(c_={}));let f_=class extends r_{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=c_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return g_(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 g_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return g_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>g_(this,void 0,void 0,(function*(){if(2!==t.count)yield t_(t,Yl.zIndex,((i,s)=>{if(this.status===c_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return g_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return g_(this,void 0,void 0,(function*(){this.rendering&&(this.status=c_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=c_.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 g_(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:()=>g_(this,void 0,void 0,(function*(){yield t_(t,Yl.zIndex,(t=>g_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};f_=d_([Ua(),p_(0,Wa(Jm)),p_(1,Na(o_)),p_(2,Na(h_)),p_(3,Na(ao)),p_(3,Ga(pv)),u_("design:paramtypes",[Array,Object,Object,Object])],f_);var m_=new Ea((t=>{t(pf).toSelf().inSingletonScope(),t(_f).toSelf().inSingletonScope(),t(hv).to(r_),t($m).to(f_),t(Qm).to(Nm).inSingletonScope(),t(Jm).toService(Qm),lo(t,Zp),t(ff).toSelf().inSingletonScope(),lo(t,ng),lo(t,Jm),t(_v).toSelf().inSingletonScope(),t(pv).toService(_v),lo(t,pv)}));function v_(){v_.__loaded||(v_.__loaded=!0,Ch.load(zp),Ch.load(Fv),Ch.load(wv),Ch.load(Dv),Ch.load(Uv),function(t){t.load(Gv),t.load(Yv),t.load(qv)}(Ch),function(t){t.load(m_)}(Ch))}v_.__loaded=!1,v_();const __=Ch.get(go);fo.global=__;const y_=Ch.get(Bp);fo.graphicUtil=y_;const b_=Ch.get(Cp);fo.transformUtil=b_;const x_=Ch.get(Fu);fo.graphicService=x_;const S_=Ch.get(Av);fo.renderService=S_;const k_=Ch.get(Pp);fo.layerService=k_;class A_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class M_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=fo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=fo.global.getRequestAnimationFrame();this.rafId=t((()=>{fo.global.devicePixelRatio!==this.dpr&&(this.dpr=fo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=fo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,fo.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 T_=new je;class C_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(T_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(T_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=fo.global&&fo.global.env;return t?"browser"===t:B_}let E_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};E_._pluginClasses={};const R_="white";class O_ extends Mp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new kc,this.hooks={beforeRender:new uo(["stage"]),afterRender:new uo(["stage"]),afterClearScreen:new uo(["stage"]),afterClearRect:new uo(["stage"])},this.global=fo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=Ch.get(hc),this.renderService=Ch.get(Av),this.pluginService=Ch.get(jv),this.layerService=Ch.get(Pp),this.graphicService=Ch.get(Fu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new zc(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(t=!1){t&&(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,_=(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=E_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,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=E_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=E_.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 A_))}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 M_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ze;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new C_,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=E_.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=E_.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=E_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ie(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Ch.get(hc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Ch.get(Tv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},L_=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 D_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new je}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}}loadFont(t,e,i){return L_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};D_=I_([Ua()],D_);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},z_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let j_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new je,this.modelMatrix=new Ve(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};j_=F_([Ua(),z_("design:paramtypes",[])],j_);var H_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},N_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=fo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 je).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 Ve(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ie(e.x,e.y),a=Mc(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 ie(e.x,e.y);l.transformPoint(a,a);const o=Mc(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&&Ku.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),$u.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function U_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function G_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Z_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),iy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},sy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new ze;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return iy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return iy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);sy(n[0],s,i),sy(n[1],e-s,i)}};let ny=!1;const ry=new Ea((t=>{ny||(ny=!0,t(Xf).toSelf().inSingletonScope(),t(Km).to(Xf).inSingletonScope(),t(Jm).toService(Km),t($p).toService(ff),lo(t,$p))}));let ay=!1;const oy=new Ea((t=>{ay||(ay=!0,t(ym).toSelf().inSingletonScope(),t(sv).to(ym).inSingletonScope(),t(Jm).toService(sv),t(Rf).toSelf(),t(Ef).toSelf(),t(eg).toService(Rf),t(eg).toService(Ef),t(eg).toService(ff),lo(t,eg))}));let ly=!1;const hy=new Ea((t=>{ly||(ly=!0,t(im).toSelf().inSingletonScope(),t(o_).toSelf().inSingletonScope(),t(tv).to(im).inSingletonScope(),t(Jm).toService(tv))}));let cy=!1;const dy=new Ea((t=>{cy||(cy=!0,t(hm).toSelf().inSingletonScope(),t(qm).to(hm).inSingletonScope(),t(Jm).toService(qm),t(Kp).toService(ff),lo(t,Kp),t(h_).toSelf().inSingletonScope())}));let uy=!1;const py=new Ea((t=>{uy||(uy=!0,t(km).toSelf().inSingletonScope(),t(nv).to(km).inSingletonScope(),t(Jm).toService(nv),t(ig).toService(ff),lo(t,ig))}));let gy=!1;const fy=new Ea((t=>{gy||(gy=!0,t(Zf).toSelf().inSingletonScope(),t(Zm).to(Zf).inSingletonScope(),t(Jm).toService(Zm),t(qp).toService(ff),lo(t,qp))}));let my=!1;const vy=new Ea((t=>{my||(my=!0,t(rv).to(Bm).inSingletonScope(),t(Jm).toService(rv),t(sg).toService(ff),lo(t,sg))}));let _y=!1;const yy=new Ea((t=>{_y||(_y=!0,t(fm).toSelf().inSingletonScope(),t(ev).to(fm).inSingletonScope(),t(Jm).toService(ev),t(Qp).toService(ff),lo(t,Qp))}));let by=!1;const xy=new Ea((t=>{by||(by=!0,t(iv).to(zm).inSingletonScope(),t(Jm).toService(iv),t(tg).toService(ff),lo(t,tg))}));var Sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Tu}reInit(){}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=Mc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Sy([Ua()],ky);let Ay=!1;const My=new Ea((t=>{Ay||(Ay=!0,t(ov).to(ky).inSingletonScope(),t(Jm).toService(ov))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ty=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cy=class extends Wf{constructor(){super(),this.numberType=Iu,this.builtinContributions=[Mm],this.init()}drawShape(t,e,i,s,n){const r=Mc(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=Vp(o,l,!0),d=Vp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Mc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Cf(e,i-t,s-n,v,_,f,!0)),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=Mc(t).richtext;this._draw(t,s,!1,i)}};Cy=wy([Ua(),Ty("design:paramtypes",[])],Cy);let By=!1;const Py=new Ea((t=>{By||(By=!0,t(av).to(Cy).inSingletonScope(),t(Jm).toService(av))}));let Ey=!1;const Ry=new Ea((t=>{Ey||(Ey=!0,t(lv).to(Xm).inSingletonScope(),t(Jm).toService(lv),t(Jp).toService(ff),lo(t,Jp))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&snt.getInstance().info(`[VChart log]: ${t}`,...e),Dy=(t,e)=>(c(zy.warnHandler)&&zy.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),Fy=(t,e,i)=>{if(!c(zy.errorHandler))throw new Error(t);zy.errorHandler.call(null,t,e)},zy={silent:!1,warnHandler:!1,errorHandler:!1},jy=P_(),Hy=jy&&globalThis?globalThis.document:void 0;function Vy(t){return("desktop-browser"===t||"mobile-browser"===t)&&jy}function Ny(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Uy=0;function Gy(){return Uy>=9999999&&(Uy=0),Uy++}function Yy(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const $y=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Ky extends Mp{constructor(t,e){super(t),this._skipRenderAttributes=$y,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},kb=(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 Ab extends o{constructor(t,e={}){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.startTime=Oc.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=Oc.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||Sb(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=kb(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=Oc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Sb(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("pointerleave",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("pointerleave",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=Oc.now()-i>this.config.press.time&&kb(s[0],t){fo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Tb=[0,0,0];let Cb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Hl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Wl),{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this._clearMatrix=new Ve(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 $u.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&&($u.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&($u.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=jt;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(f,-2*y),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&&gp.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&&(Yu(Tb,[t,e,i],this.modelMatrix),t=Tb[0],e=Tb[1],i=Tb[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&&(Yu(Tb,[t,e,i],this.modelMatrix),t=Tb[0],e=Tb[1],i=Tb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Yu(Tb,[e,i,s],this.modelMatrix),e=Tb[0],i=Tb[1],s=Tb[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,e=fo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=fo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Wl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Wl.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&&(Yu(Tb,[e,i,s],this.modelMatrix),e=Tb[0],i=Tb[1],s=Tb[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=dh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ch(this,a,this.dpr),r.strokeStyle=dh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>$u.free(t))),this.stack.length=0}};Cb.env="browser",Cb=Mb([Ua(),wb("design:paramtypes",[Object,Number])],Cb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Eb=class extends ip{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=fo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Cb(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 Rb(t,e){return new Ea((i=>{i(Bh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Ph).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Eb.env="browser",Eb=Bb([Ua(),Pb("design:paramtypes",[Object])],Eb);const Ob=Rb(Eb,Cb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Db=function(t,e){return function(i,s){e(i,s,t)}};let Fb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=ac.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 jb=class{constructor(){this.type="group",this.numberType=Cu}contains(t,e,i){return!1}};jb=zb([Ua()],jb);const Hb=new Ea(((t,e,i,s)=>{Hb.__vloaded||(Hb.__vloaded=!0,t(bb).to(jb).inSingletonScope(),t(xb).toService(bb),lo(t,xb))}));Hb.__vloaded=!1;var Vb=Hb;const Nb=new Ea(((t,e,i,s)=>{i(Fb)||t(Fb).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(Fb):t(Tv).toService(Fb)}));var Wb,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},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yb=Wb=class extends j_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=fo.global,this.viewBox=new je,this.modelMatrix=new Ve(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Eb(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 Eb({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)}};Yb.env="browser",Yb.idprefix="visactor_window",Yb.prefix_count=0,Yb=Wb=Ub([Ua(),Gb("design:paramtypes",[])],Yb);const Xb=new Ea((t=>{t(Yb).toSelf(),t(cc).toDynamicValue((t=>t.container.get(Yb))).whenTargetNamed(Yb.env)}));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},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qb=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 Zb{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 Jb(t,e=!1){const i=document.createElement("img");if(fo.global.isImageAnonymous&&(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 Qb=class extends D_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Zb(t)}return new je}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Jb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Jb(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:Pa.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(...t){}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}}loadFont(t,e,i){return qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Qb=$b([Ua(),Kb("design:paramtypes",[])],Qb);const tx=new Ea((t=>{tx.isBrowserBound||(tx.isBrowserBound=!0,t(Qb).toSelf().inSingletonScope(),t(po).toService(Qb))}));function ex(t,e=!0){ex.__loaded||(ex.__loaded=!0,t.load(tx),t.load(Ob),t.load(Xb),e&&function(t){t.load(Vb),t.load(Nb)}(t))}tx.isBrowserBound=!1,ex.__loaded=!1;var ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nx=function(t,e){return function(i,s){e(i,s,t)}};let rx=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 tp(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}};rx=ix([Ua(),nx(0,Na(ao)),nx(0,Ga(qy)),nx(1,Na(ao)),nx(1,Ga(Bv)),nx(2,Na(ao)),nx(2,Ga(Pv)),sx("design:paramtypes",[Object,Object,Object])],rx);const ax=new Ea((t=>{ax.__vloaded||(ax.__vloaded=!0,lo(t,qy))}));ax.__vloaded=!1;var ox=ax;class lx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ch(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}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},cx=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 ux=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};ux=hx([Ua(),dx(0,Na(Km)),cx("design:paramtypes",[Object])],ux);let px=!1;const gx=new Ea(((t,e,i,s)=>{px||(px=!0,t(Zy).to(ux).inSingletonScope(),t(qy).toService(Zy))}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Mu}};_x=fx([Ua(),vx(0,Na(qm)),mx("design:paramtypes",[Object])],_x);let yx=!1;const bx=new Ea(((t,e,i,s)=>{yx||(yx=!0,t(Jy).to(_x).inSingletonScope(),t(qy).toService(Jy))}));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},Sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Ax=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};Ax=xx([Ua(),kx(0,Na(Zm)),Sx("design:paramtypes",[Object])],Ax);let Mx=!1;const wx=new Ea(((t,e,i,s)=>{Mx||(Mx=!0,t(Qy).to(Ax).inSingletonScope(),t(qy).toService(Qy))}));class Tx{constructor(){this.type="glyph",this.numberType=Tu}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 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},Bx=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 Ex=class extends Tx{constructor(t){super(),this.canvasRenderer=t}};Ex=Cx([Ua(),Px(0,Na(ov)),Bx("design:paramtypes",[Object])],Ex);let Rx=!1;const Ox=new Ea(((t,e,i,s)=>{Rx||(Rx=!0,t(ob).to(Ex).inSingletonScope(),t(Ex).toService(ob))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lx=class{constructor(){this.type="image",this.numberType=Bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Lx=Ix([Ua()],Lx);let Dx=!1;const Fx=new Ea(((t,e,i,s)=>{Dx||(Dx=!0,t(tb).to(Lx).inSingletonScope(),t(Lx).toService(tb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};Vx=zx([Ua(),Hx(0,Na(tv)),jx("design:paramtypes",[Object])],Vx);let Nx=!1;const Wx=new Ea(((t,e,i,s)=>{Nx||(Nx=!0,t(eb).to(Vx).inSingletonScope(),t(qy).toService(eb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gx=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 Xx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};Xx=Ux([Ua(),Yx(0,Na(iv)),Gx("design:paramtypes",[Object])],Xx);let $x=!1;const Kx=new Ea(((t,e,i,s)=>{$x||($x=!0,t(ab).to(Xx).inSingletonScope(),t(qy).toService(ab))}));var qx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jx=function(t,e){return function(i,s){e(i,s,t)}};let Qx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Eu}};Qx=qx([Ua(),Jx(0,Na(ev)),Zx("design:paramtypes",[Object])],Qx);let tS=!1;const eS=new Ea(((t,e,i,s)=>{tS||(tS=!0,t(ib).to(Qx).inSingletonScope(),t(qy).toService(ib))})),iS=new je;class sS{constructor(){this.type="rect",this.numberType=Ou}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||x(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:ch(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;iS.setValue(i.x1,i.y1,i.x2,i.y2),iS.expand(-r/2),h=!iS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends sS{constructor(t){super(),this.canvasRenderer=t}};oS=nS([Ua(),aS(0,Na(sv)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new Ea(((t,e,i,s)=>{lS||(lS=!0,t(sb).to(oS).inSingletonScope(),t(qy).toService(sb))}));let cS=!1;const dS=new Ea(((t,e,i,s)=>{cS||(cS=!0,t(tb).to(Lx).inSingletonScope(),t(Lx).toService(tb))}));var uS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gS=function(t,e){return function(i,s){e(i,s,t)}};let fS=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Lu}};fS=uS([Ua(),gS(0,Na(nv)),pS("design:paramtypes",[Object])],fS);let mS=!1;const vS=new Ea(((t,e,i,s)=>{mS||(mS=!0,t(nb).to(fS).inSingletonScope(),t(qy).toService(nb))}));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};let yS=class{constructor(){this.type="text",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yS=_S([Ua()],yS);let bS=!1;const xS=new Ea(((t,e,i,s)=>{bS||(bS=!0,t(rb).to(yS).inSingletonScope(),t(qy).toService(rb))})),SS=new Ea(((t,e,i,s)=>{i(rx)||t(rx).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(rx):t(Tv).toService(rx)}));class kS{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 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},MS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let wS=class extends Cb{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};wS.env="node",wS=AS([Ua(),MS("design:paramtypes",[Object,Number])],wS);var TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BS=class extends ip{constructor(t){super(t)}init(){this._context=new wS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};BS.env="node",BS=TS([Ua(),CS("design:paramtypes",[Object])],BS);const PS=Rb(BS,wS);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},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends j_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new BS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new BS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};IS.env="node",IS=ES([Ua(),OS(0,Na(go)),RS("design:paramtypes",[Object])],IS);const LS=new Ea((t=>{t(IS).toSelf(),t(cc).toDynamicValue((t=>t.container.get(IS))).whenTargetNamed(IS.env)}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 FS=class extends D_{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 Jc.call(t)}}getCancelAnimationFrame(){return t=>{Jc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};FS=DS([Ua()],FS);const zS=new Ea((t=>{zS.isNodeBound||(zS.isNodeBound=!0,t(FS).toSelf().inSingletonScope(),t(po).toService(FS))}));function jS(t,e=!0){jS.__loaded||(jS.__loaded=!0,t.load(zS),t.load(PS),t.load(LS))}zS.isNodeBound=!1,jS.__loaded=!1;var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 VS=class extends Cb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:ch(this,l,this.dpr),r.strokeStyle=dh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=fo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,fo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Oe(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Oe(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};VS.env="harmony",VS=HS([Ua()],VS);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},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends ip{constructor(t){super(t)}init(){this._context=new VS(this,this._dpr)}resize(t,e){}release(...t){}};US.env="harmony",US=NS([Ua(),WS("design:paramtypes",[Object])],US);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},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XS=function(t,e){return function(i,s){e(i,s,t)}};class $S{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 KS=class extends j_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new $S}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{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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new US(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}this.canvas=new US({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};KS.env="harmony",KS=GS([Ua(),XS(0,Na(go)),YS("design:paramtypes",[Object])],KS);const qS=new Ea((t=>{t(KS).toSelf(),t(cc).toDynamicValue((t=>t.container.get(KS))).whenTargetNamed(KS.env)})),ZS=Rb(US,VS);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},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tk=class extends D_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new Zc(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new kS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};tk=JS([Ua(),QS("design:paramtypes",[])],tk);const ek=new Ea((t=>{ek.isHarmonyBound||(ek.isHarmonyBound=!0,t(tk).toSelf().inSingletonScope(),t(po).toService(tk))}));function ik(t,e=!0){ik.__loaded||(ik.__loaded=!0,t.load(ek),t.load(ZS),t.load(qS),e&&function(t){t.load(ox),t.load(SS),t.load(gx),t.load(bx),t.load(wx),t.load(Ox),t.load(Fx),t.load(Wx),t.load(Kx),t.load(eS),t.load(hS),t.load(dS),t.load(vS),t.load(xS)}(t))}ek.isHarmonyBound=!1,ik.__loaded=!1;var sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rk=function(t,e){return function(i,s){e(i,s,t)}};let ak=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};ak=sk([Ua(),rk(0,Na(Km)),nk("design:paramtypes",[Object])],ak);let ok=!1;const lk=new Ea(((t,e,i,s)=>{ok||(ok=!0,t(lb).to(ak).inSingletonScope(),t(xb).toService(lb))}));var hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ck=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dk=function(t,e){return function(i,s){e(i,s,t)}};let uk=class extends sS{constructor(t){super(),this.canvasRenderer=t}};uk=hk([Ua(),dk(0,Na(sv)),ck("design:paramtypes",[Object])],uk);let pk=!1;const gk=new Ea(((t,e,i,s)=>{pk||(pk=!0,t(gb).to(uk).inSingletonScope(),t(xb).toService(gb))}));class fk extends Wf{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:ch(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class extends fk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};yk=mk([Ua(),_k(0,Na(tv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Ea(((t,e,i,s)=>{bk||(bk=!0,t(ub).to(yk).inSingletonScope(),t(xb).toService(ub))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ak=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Mu}};Mk=Sk([Ua(),Ak(0,Na(qm)),kk("design:paramtypes",[Object])],Mk);let wk=!1;const Tk=new Ea(((t,e,i,s)=>{wk||(wk=!0,t(hb).to(Mk).inSingletonScope(),t(xb).toService(hb))}));class Ck extends Wf{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&&Ku.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},Pk=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 Rk=class extends Ck{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Lu}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:ch(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Ku.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Rk=Bk([Ua(),Ek(0,Na(nv)),Pk("design:paramtypes",[Object])],Rk);let Ok=!1;const Ik=new Ea(((t,e,i,s)=>{Ok||(Ok=!0,t(fb).to(Rk).inSingletonScope(),t(xb).toService(fb))}));var Lk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fk=function(t,e){return function(i,s){e(i,s,t)}};let zk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};zk=Lk([Ua(),Fk(0,Na(Zm)),Dk("design:paramtypes",[Object])],zk);let jk=!1;const Hk=new Ea(((t,e,i,s)=>{jk||(jk=!0,t(cb).to(zk).inSingletonScope(),t(xb).toService(cb))}));var Vk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wk=function(t,e){return function(i,s){e(i,s,t)}};let Uk=class extends Ck{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Du}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=ag(a,u,n),v=rg(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&&Ku.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Uk=Vk([Ua(),Wk(0,Na(rv)),Nk("design:paramtypes",[Object])],Uk);let Gk=!1;const Yk=new Ea(((t,e,i,s)=>{Gk||(Gk=!0,t(mb).to(Uk).inSingletonScope(),t(xb).toService(mb))}));var Xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Kk=function(t,e){return function(i,s){e(i,s,t)}};let qk=class extends fk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Eu}};qk=Xk([Ua(),Kk(0,Na(ev)),$k("design:paramtypes",[Object])],qk);let Zk=!1;const Jk=new Ea(((t,e,i,s)=>{Zk||(Zk=!0,t(pb).to(qk).inSingletonScope(),t(xb).toService(pb))}));var Qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eA=function(t,e){return function(i,s){e(i,s,t)}};let iA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};iA=Qk([Ua(),eA(0,Na(iv)),tA("design:paramtypes",[Object])],iA);let sA=!1;const nA=new Ea(((t,e,i,s)=>{sA||(sA=!0,t(vb).to(iA).inSingletonScope(),t(xb).toService(vb))}));var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends Tx{constructor(t){super(),this.canvasRenderer=t}};lA=rA([Ua(),oA(0,Na(ov)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new Ea(((t,e,i,s)=>{hA||(hA=!0,t(yb).to(lA).inSingletonScope(),t(xb).toService(yb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Iu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};gA=dA([Ua(),pA(0,Na(av)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new Ea(((t,e,i,s)=>{fA||(fA=!0,t(_b).to(gA).inSingletonScope(),t(xb).toService(_b))}));var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Bu}};bA=vA([Ua(),yA(0,Na(lv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Ea(((t,e,i,s)=>{xA||(xA=!0,t(db).to(bA).inSingletonScope(),t(xb).toService(db))})),kA=P_();function AA(){AA.__loaded||(AA.__loaded=!0,af.RegisterGraphicCreator("arc",Qg),Ch.load(ry),Ch.load(kA?lk:gx))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,af.RegisterGraphicCreator("area",qg),Ch.load(dy),Ch.load(kA?Tk:bx))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,af.RegisterGraphicCreator("circle",fg),Ch.load(fy),Ch.load(kA?Hk:wx))}CA.__loaded=!1;const BA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,af.RegisterGraphicCreator("glyph",Eg),Ch.load(My),Ch.load(kA?cA:Ox))}PA.__loaded=!1;const EA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,af.RegisterGraphicCreator("group",wp))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,af.RegisterGraphicCreator("image",Fg),Ch.load(Ry),Ch.load(kA?SA:Fx))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,af.RegisterGraphicCreator("line",Mg),Ch.load(hy),Ch.load(kA?xk:Wx))}DA.__loaded=!1;const FA=DA;function zA(){zA.__loaded||(zA.__loaded=!0,af.RegisterGraphicCreator("path",Xg),Ch.load(yy),Ch.load(kA?Jk:eS))}zA.__loaded=!1;const jA=zA;function HA(){HA.__loaded||(HA.__loaded=!0,af.RegisterGraphicCreator("polygon",sf),Ch.load(xy),Ch.load(kA?nA:Kx))}HA.__loaded=!1;const VA=HA;function NA(){NA.__loaded||(NA.__loaded=!0,af.RegisterGraphicCreator("rect",Bg),Ch.load(oy),Ch.load(kA?gk:hS))}NA.__loaded=!1;const WA=NA;function UA(){UA.__loaded||(UA.__loaded=!0,af.RegisterGraphicCreator("richtext",Ug),Ch.load(Py),Ch.load(kA?mA:dS))}UA.__loaded=!1;const GA=UA;function YA(){YA.__loaded||(YA.__loaded=!0,af.RegisterGraphicCreator("shadowRoot",rf))}YA.__loaded=!1;const XA=YA;function $A(){$A.__loaded||($A.__loaded=!0,af.RegisterGraphicCreator("symbol",Sg),Ch.load(py),Ch.load(kA?Ik:vS))}$A.__loaded=!1;const KA=$A;function qA(){qA.__loaded||(qA.__loaded=!0,af.RegisterGraphicCreator("text",yg),Ch.load(vy),Ch.load(kA?Yk:xS))}qA.__loaded=!1;const ZA=qA;function JA(){OA(),WA()}const QA=-.5*Math.PI,tM=1.5*Math.PI,eM="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 iM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(iM||(iM={}));const sM={[iM.selectedReverse]:{},[iM.selected]:{},[iM.hover]:{},[iM.hoverReverse]:{}},nM={container:"",width:30,height:30,style:{}},rM="scrollDrag";function aM(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const oM={debounce:yt,throttle:bt};JA();let lM=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=aM(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:oM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=mt(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(rM,{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",oM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(mt(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:si(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]=si(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]=mt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?mt([a+i*n,a+s*n],a,n-l):mt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=aM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};lM.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};var hM,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};let dM=hM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new ze).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ht(t.deltaX)>Ht(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new je,e.addEventListener("wheel",this.scroll),this.params=hM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(rM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new lM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(dM)||(t(dM).toSelf(),t(zv).toService(dM))}));function pM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&pM(t,e)}))}const gM=t=>!d(t)&&!1!==t.visible;function fM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function mM(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 _M=["#ffffff","#000000"];function yM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Qe(t).toHex(),o=new Qe(e).toHex();return bM(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(..._M);for(const n of a)if(t!==n&&bM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function bM(t,e,i,s,n){if("lightness"===n){const i=Qe.getColorBrightness(new Qe(e));return Qe.getColorBrightness(new Qe(t))<.5?i>=.5:i<.5}return s?xM(t,e)>s:"largeText"===i?xM(t,e)>3:xM(t,e)>4.5}function xM(t,e){const i=SM(t),s=SM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function SM(t){const e=ei(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 kM(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 MM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const TM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:eM,fontSize:14},s),getTextBounds:i?void 0:hf,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function CM(t,e,i={}){if(!t)return{width:0,height:0};const s=hf({text:t,fontFamily:e.fontFamily||i.fontFamily||eM,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 BM(t,e="type"){var i,s;return p(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 PM(t){var e,i;return u(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 EM(t,e="type"){const i=BM(t,e);return"rich"===i?af.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),af.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 LM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function DM(){OA(),WA(),KA(),GA(),ZA()}var FM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=FM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Dl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},zM.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))}}zM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const jM={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}},HM={poptip:z({},jM)};var VM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Ut(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Ut(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Dt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Dt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Dt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}$M.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var KM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 qM=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,$M.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new $M(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,HM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};qM=KM([Ua()],qM);var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 JM{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 QM=class extends JM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};QM=ZM([Ua()],QM);let tw=class extends JM{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)}};tw=ZM([Ua()],tw);const ew=new Ea(((t,e,i,s)=>{i(qM)||(t(qM).toSelf().inSingletonScope(),t(ng).toService(qM)),i(QM)||(t(QM).toSelf(),t(zv).toService(QM)),i(tw)||(t(tw).toSelf(),t(zv).toService(tw))}));class iw extends Ky{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}OA(),FA();class sw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sw.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})}}sw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},OA(),WA();class nw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nw.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})}}nw.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},OA(),MA();class rw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rw.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=se.distancePP(t,e);this.setAttribute("radius",i)}}rw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},OA(),MA();class aw extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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=QA,endAngle:s=tM}=this.attribute,n=s-i,r=re(he(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}aw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},OA(),jA();class ow extends iw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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=oe(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=se.distancePP(t,e);this.setAttribute("radius",i)}}function lw(){OA(),FA(),VA(),KA()}function hw(){OA(),FA(),MA(),KA()}ow.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},lw();class cw extends Ky{getStartAngle(){return ce(this._startAngle)}getEndAngle(){return ce(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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(k(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=af.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),P(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=af.line;G(i)[0].cornerRadius&&(t=af.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=af.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}cw.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}}},hw();class dw extends cw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=af.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var uw,pw;!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"}(uw||(uw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(pw||(pw={}));const gw={[pw.selectedReverse]:{},[pw.selected]:{},[pw.hover]:{},[pw.hoverReverse]:{}},fw={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}}},mw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const vw=Math.sin(Math.PI/10);function _w(t,e=vw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function yw(t,e=vw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function bw(t){const e={};return pM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function xw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Sw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return AM(r,(s?-1:1)*(n?-1:1)*t/MM(r))}function kw(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 Mw(t,e,i){var s;if(yw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Le(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Le(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>De(n,r)}function ww(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(iM.hover,!0),pM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(iM.hoverReverse,!0)})),s):i},Cw=(t,e,i)=>i?(pM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(iM.hoverReverse),t.removeState(iM.hover))})),null):i,Bw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(iM.selected)?(pM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(iM.selectedReverse),t.removeState(iM.selected))})),null):s.name&&!P(s.states)?(s.addState(iM.selected,!0),pM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(iM.selectedReverse,!0)})),s):i};class Pw extends Ky{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Ew={type:"default",duration:300,easing:"linear"};class Rw extends Pw{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Tw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Cw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Bw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=af.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._prepare(),this._prevInnerView=this._innerView&&bw(this._innerView),this.removeAllChild(!0),this._innerView=af.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Ew)}_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=af.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=uw.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=af.group({x:0,y:0,pickable:!1});t.name=uw.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=af.group({x:0,y:0,pickable:!1});i.name=uw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=af.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=uw.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=sM;else{const t=this.data[s],e=z({},sM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=af.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=uw.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=sM;else{const i=z({},sM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=af.group({x:0,y:0,pickable:!1});return r.name=`${uw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=EM(this._getLabelAttribute(t,e,n,i));if(a.name=uw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=sM;else{const s=z({},sM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new zM(Object.assign({},e));i.name=uw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return xw(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&&c(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;Ht(s[0])>Ht(s[1])?o=Dt/2*(l.x>e.x?1:-1):h=Dt/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+E(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+E(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:_}=this.attribute.label;_=c(_)?z({},fw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d: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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},pM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Ow={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&&Mw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Iw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Lw(t,e,i,s,n=!1){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=c(n)?n:Ow[n]||Ow.parity;if(s.length>=3&&ww(s,r)){do{s=a(s,r)}while(s.length>=3&&ww(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Mw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Lw(l,s,n,(t=>Mw(t,l,r))),Lw(h,s,o,(t=>Mw(t,h,r)||!(!n||t===l)&&Mw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Fw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Hw(t,e.attribute.angle)),{angle:jw(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({},Vw(t,e.attribute.angle)),{angle:jw(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=ke({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 jw(t=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 Hw(t,e=0){let 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=jw(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 Vw(t,e=0){let 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=jw(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 Nw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=yw(h),m=_w(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);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(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(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 Ww(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Uw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=MM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return AM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Gw{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-Gw.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Gw.bounceIn(2*t):.5*Gw.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*jt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/jt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*jt/e)*.5+1}}static registerFunc(t,e){Gw[t]=e}}function Yw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Gw.quadIn=Gw.getPowIn(2),Gw.quadOut=Gw.getPowOut(2),Gw.quadInOut=Gw.getPowInOut(2),Gw.cubicIn=Gw.getPowIn(3),Gw.cubicOut=Gw.getPowOut(3),Gw.cubicInOut=Gw.getPowInOut(3),Gw.quartIn=Gw.getPowIn(4),Gw.quartOut=Gw.getPowOut(4),Gw.quartInOut=Gw.getPowInOut(4),Gw.quintIn=Gw.getPowIn(5),Gw.quintOut=Gw.getPowOut(5),Gw.quintInOut=Gw.getPowInOut(5),Gw.backIn=Gw.getBackIn(1.7),Gw.backOut=Gw.getBackOut(1.7),Gw.backInOut=Gw.getBackInOut(1.7),Gw.elasticIn=Gw.getElasticIn(1,.3),Gw.elasticOut=Gw.getElasticOut(1,.3),Gw.elasticInOut=Gw.getElasticInOut(1,.3*1.5),Gw.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Gw.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Gw.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Gw[`flicker${t}`]=e=>Yw(e,t);for(let t=2;t<10;t++)Gw[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Xw(t,e,i){return t+(e-t)*i}const $w=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Xw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Xw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Xw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Xw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Xw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Xw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Xw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Xw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Xw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=ap(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?lp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=ap(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?lp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Xw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Xw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Xw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Xw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Xw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Xw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Xw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Xw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Xw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Xw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Kc(e,i,s),r.addUpdateBoundTag()}}};function Kw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Gw[s])&&void 0!==n?n:Gw.linear:Gw.linear,"wait"===t&&(this.onUpdate=qw),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=np.Get(i,sp.Color255),r=np.Get(s,sp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push($w["fill"===e?"fillPure":"strokePure"])}else $w[e]?t.push($w[e]):t.push(Kw)}else $w[e]?t.push($w[e]):t.push(Kw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Jw extends Zw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Qw extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===To.END?this.removeAnimate(t,!0):t.status!==To.RUNNING&&t.status!==To.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const tT=new Qw;tT.isGlobal=!0;class eT{constructor(t=Pa.GenAutoIncrementId(),e=tT,i){this.id=t,this.status=To.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new Zw(wo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Jw(wo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new Zw(wo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===To.RUNNING&&(this.status=To.PAUSED)}resume(){this.status===To.PAUSED&&(this.status=To.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==To.END&&this.onEnd(),this.status=To.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=To.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===To.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=To.END);this.status=To.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const iT=new vo;class sT{constructor(){this.released=!1}tick(t,e){iT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class nT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Mo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Mo.INITIAL,fo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),fo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new sT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Mo.INITIAL&&(this.status=Mo.PAUSE,!0)}resume(){return this.status!==Mo.INITIAL&&(this.status=Mo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Mo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Mo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Mo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Mo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Mo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Mo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}oT.getInstance();class lT{static registerBuiltInAnimate(t,e){lT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&c(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+d:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&c(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+d+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=d*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const P=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,E=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;E&&R&&(i=null!==(h=E[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+P;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_;if(e&&i){const d=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=c(h)?h.call(null,null!==(m=d&&(null===(f=d.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,d):h;d.options=y,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lT.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}lT.builtInAnimateMap={};const hT="appear",cT="disappear",dT="update",uT="highlight",pT="unhighlight";class gT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=oT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lT(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hT],[{name:hT,animation:t}],e)}applyDisappearState(t,e){this.applyState([cT],[{name:cT,animation:t}],e)}applyUpdateState(t,e){this.applyState([dT],[{name:dT,animation:t}],e)}applyHighlightState(t,e){this.applyState([uT],[{name:uT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mT)._getAnimationStateManager(t),t}}class vT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new eT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:tT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new Qw}createTicker(t){return new nT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _T(){U(kp,mT),U(kp,vT)}class yT extends Zw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bT extends yT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ST(t){return new xT(t)}class kT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const AT=1e3,MT="quadInOut",wT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],TT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=ap(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},CT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?q_(t):[],n=q_(e);i&&s&&(i.fromTransform&&Z_(s,i.fromTransform.clone().getInverse()),Z_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},PT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],ET=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!PT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?np.Get(t,sp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class RT extends yT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;CT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&TT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const OT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=BT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=ET(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new RT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:AT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:MT);return c.play(d),c};class IT extends yT{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;CT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&TT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const LT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>wT.includes(t))(i)||(e[i]=t[i])})),e},DT=(t,e,i)=>{const s=LT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=fo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},FT=(t,e,i)=>{const s=[],n=i?null:LT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:LT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=wg(t.attribute),n=Q_(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(fo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Q_(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(fo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Q_(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(fo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ty(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ty(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(fo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ey(i)}];const s=[];return sy(i,e,s),s})(t,e).forEach((t=>{s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return sy(l,e,h),h})(t,e).forEach((t=>{s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=q_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(fo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(fo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&DT(t,s,e),s};class jT extends yT{constructor(t,e,i,s,n){super(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(){super.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:No.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:No.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:No.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class HT extends jT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=fo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 VT extends jT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=fo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class NT extends yT{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ie(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=$c(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class GT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class YT extends UT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class XT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class $T extends UT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const KT=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class qT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class ZT extends qT{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=KT(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class JT extends qT{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class QT extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class tC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const eC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class iC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=eC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class rC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>$c(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class aC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:nC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class oC extends rC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:nC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const lC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class hC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:lC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends rC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:lC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class uC extends rC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends rC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const gC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class fC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mC extends fC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=gC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class vC extends fC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const _C=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class yC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=_C(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class SC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class kC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class AC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class MC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends MC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class TC extends MC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class CC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class BC extends CC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class PC extends CC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class EC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class RC extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=fo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Dl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=fo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:No.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:No.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=il(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=il(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=af.group({zIndex:999});e.name=uw.axisBreak,e.id=this._getNodeId(`${uw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},mw,s),a=null!==(e=r.size)&&void 0!==e?e:mw.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=af.symbol(Object.assign({x:s.x,y:s.y},o));l.name=uw.axisBreakSymbol;const h=af.symbol(Object.assign({x:n.x,y:n.y},o));h.name=uw.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=af.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=uw.background,n.id=this._getNodeId("background"),n.states=z({},gw,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=DC(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];P(l)||(c.state={line:z({},gw,l),symbol:z({},gw,l)});const d=new cw(c);d.name=uw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return dt(t[0],0)?dt(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:u}=s,p=DC(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),_=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=+E(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),w=this.getTextBaseline(A,!1);let C=u;if(d(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},gw,c.text),shape:z({},gw,c.shape),panel:z({},gw,c.background)}});return B.angle=T,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return dt(t[1],0)?i=!dt(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 Hw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Vw(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(P(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=ne(e)})),zw(i,t),!Fw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=yw(a),l=_w(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=Ww(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);k(i)&&(c=Ut(c,i))}}else{if(l){const i=Ww(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);k(i)&&(c=Ut(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&&k(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);Nw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&Dw(t,{orient:o,method:m,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(k(c)&&(!k(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=af.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=uw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(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=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=si(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}}FC.defaultAttributes=fw,U(FC,Uw);class zC{isInValidValue(t){const{startAngle:e=QA,endAngle:i=tM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=QA,endAngle:i=tM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return oe(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Sw(t,i,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 jC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=jC(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 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);n0&&(c=r,d=0),k(l)&&l>=3){const t=kw(n,l,c,e,i);h=af.path(Object.assign(Object.assign({},a.style),{path:Aw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=af.circle(t)}h.name=uw.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=z({},gw,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:u={}}=a,p=NC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=E(this.attribute.label,"style.fontSize",12)+E(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},gw,u.text),shape:z({},gw,u.shape),panel:z({},gw,u.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(dt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=jC(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&&HC(e,c,i)}else e.AABBBounds.width()>r&&HC(e,r,i)}else o>a.x&&h.x2>n.x2?(HC(e,n.x2-o,i),r&&VC(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return dt(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}}WC.defaultAttributes=fw,U(WC,zC);const UC=t=>t.map(((t,e)=>({index:e,value:t}))),GC=(t,e,i=0)=>{const s=new je(t).expand(i/2),n=new je(e).expand(i/2);return s.intersects(n)},YC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ne(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=TM(a),_=t.range();let y=[];for(let i=0;i{KC[t]=!0}));const tB=t=>-Math.log(-t),eB=t=>-Math.exp(-t),iB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,sB=t=>10===t?iB:t===Math.E?Math.exp:e=>Math.pow(t,e),nB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),rB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),aB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function oB(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 lB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function hB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function cB(t,e,i,s){return 1===i&&(i=0),hB(t,i,s)*(e/(1-i))}function dB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function uB(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]{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 gB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=dB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 fB=Symbol("implicit");class mB extends gB{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=$C.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=fB}clone(){const t=(new mB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==fB)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 vB(t,e,r,n)}class yB extends mB{constructor(t){super(),this.type=$C.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=cB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:_B(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return _B(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=vt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new yB(!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:bB}=ii;function xB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return xt(t,e);if("string"===i){if(s=Qe.parseColorString(e)){const e=bB(Qe.parseColorString(t),s);return t=>e(t).formatRgb()}return xt(Number(t),Number(e))}return e instanceof ti?bB(t,e):e instanceof Qe?bB(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):xt(Number(t),Number(e))}class SB extends gB{constructor(t=QC,e=QC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=QC,this._piecewise=lB,this._interpolate=xB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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),xt)),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,tt);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=St,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=vt(i[0],i[r-1])),this._piecewise=r>2?uB:lB,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:QC),this.rescale(i)):this._clamp!==QC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const kB=Math.sqrt(50),AB=Math.sqrt(10),MB=Math.sqrt(2),wB=[1,2,5,10],TB=(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=EB(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)),J(0,e).map((t=>n+t*s))):t>0?BB(0,-(e-1)/s,s):BB((e-1)/s,0,s)},CB=gt(((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 TB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return TB(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=BB(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=BB(t,e,l);return n&&r.reverse(),r})),EB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=wB[0];return i>=kB?s=wB[3]:i>=AB?s=wB[2]:i>=MB&&(s=wB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function RB(t,e,i){const s=(e-t)/Math.max(0,i);return EB(s)}function OB(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;e0;){if(s=RB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function LB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const DB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),FB=gt(((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})),zB=gt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=PB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?DB(t,e,n):DB(t,e,pB(n)),h=DB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),jB=gt(((t,e,i,s,n)=>OB(s(t),s(e),i).map((t=>pB(n(t))))));class HB extends SB{constructor(){super(...arguments),this.type=$C.Linear}clone(){var t;const e=new HB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return CB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=PB(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(t=10){const e=this.calculateVisibleDomain(this._range);return OB(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 NB(t){return e=>-t(-e)}function WB(t=Number.EPSILON){return e=>Math.max(e,t)}class UB extends SB{constructor(){super(nB(10),sB(10)),this.type=$C.Log,this._limit=WB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new UB).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=nB(this._base),s=sB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=NB(i),this._pows=NB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=tB,this.untransformer=eB):(this._logs=i,this._pows=s,this._limit=WB(),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 QC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return FB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jB(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(UB,VB);class GB extends HB{constructor(){super(rB(1),aB(1)),this.type=$C.Symlog,this._const=1}clone(){return(new GB).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=rB(t),this.untransformer=aB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return FB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(GB,VB);class YB{constructor(){this.type=$C.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!d(t)&&k(+t)?this._range[rt(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 YB).domain(this._domain).range(this._range).unknown(this._unknown)}}function XB(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 $B(t,e,i,s,n=!1){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,n,r;if(!qC(t.type))return UC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return UC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=XB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=XB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=XB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=XC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=XC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?qB.greedy:qB.parity;for(;l.length>=3&&ww(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Mw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),$B(t,l,a,(e=>Mw(e,t,i))),$B(n,l,o,(e=>Mw(e,n,i)||!(!a||e===t)&&Mw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return UC(m)},qB={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Mw(i,t,e)||(i=t,0))))}},ZB=(t,e,i,s)=>{const n=XC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},JB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,QB=(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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?UC([s[s.length-1]]):UC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=ZB(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=eP(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=ZB(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!JB(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?QB(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=TM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=oe({x:0,y:0},i,t),a=xw(r,Sw(s,r,e,n));return o=a,l=Sw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(dt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 UC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=iP(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=nP(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return UC(d)},nP=(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&&GC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},rP=new Uint32Array(33),aP=new Uint32Array(33);aP[0]=0,rP[0]=~aP[0];for(let t=1;t<=32;++t)aP[t]=aP[t-1]<<1|1,rP[t]=~aP[t];function oP(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&rP[31&o]&aP[1+(31&l)])return!0}else{if(i[h]&rP[31&o])return!0;if(i[c]&aP[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,rP[31&o]&aP[1+(31&l)]);else for(s(h,rP[31&o]),s(c,aP[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,aP[31&a]|rP[1+(31&o)]);else for(n(l,aP[31&a]),n(h,rP[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 lP(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ft(i,-o,t.width+l),d=ft(s,-o,t.width+l),u=ft(n,-a,t.height+h),p=ft(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function hP(t,e,i=!1){return i?lP(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function cP(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=hP(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=lP(t,r)),e.getRange(r)))}function dP(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>u(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return dP(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return dP(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return dP(t,e,n,s,h,d)}return!1}const pP=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],gP=["top","inside-top","inside"];function fP(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const mP={mode:"same-time",duration:300,easing:"linear"};function vP(t){return 3===t||4===t}function _P(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 yP=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 bP(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)}}var xP=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const AP=(t,e)=>Math.ceil(t)>Math.floor(e),MP=([t,e],[i,s])=>s>t&&e>i;function wP(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 TP=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||P(e.states)||(e.addState(iM.hover,!0),pM(this,(t=>{t===e||P(t.states)||t.addState(iM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(pM(this,(t=>{P(t.states)||(t.removeState(iM.hoverReverse),t.removeState(iM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void pM(this,(t=>{P(t.states)||(t.removeState(iM.selectedReverse),t.removeState(iM.selected))}));P(e.states)||(e.addState(iM.selected,!0),pM(this,(t=>{t===e||P(t.states)||t.addState(iM.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)===No.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===No.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(be(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[bP(g,f,c,d,a,o),bP(-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=af.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Dl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),c(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return EM(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=c(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&AP(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&AP(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(dt(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(wP([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])&&!MP([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 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},h),{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(hP(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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(hP(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(hP(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{BP[t]=e};var EP=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{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,i,s)}}RP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const OP=()=>{PP("symbol",RP),PP("line-data",RP)};var IP=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{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}}}LP.tag="rect-label",LP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var DP=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};FP.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const zP=()=>{PP("line",FP),PP("area",FP)};var jP=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=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ue(h.endAngle-d/2),g=oe(c,h.outerRadius,o),f=oe(c,a+e.line.line1MinLength,o),m=new HP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=oe(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):vP(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=oe(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ut(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=vP(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=vP(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&&(pt(t.pointB.x,this._line2MinLength+h)||ut(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=vP(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?d(h)||"auto"===h?"edge"===c?vP(t.quadrant)?"left":"right":vP(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(vP(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(dt(l/2,u))g=0,f=1,m=-p;else if(dt(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?dt(v[0].y,v[1].y)?ut(t.middleAngle,-Math.PI)&&pt(t.middleAngle,0)||ut(t.middleAngle,Math.PI)&&pt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 UP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=se.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 GP(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=Aw(t,!!n),o=Aw(r,!!n);const h=se.distancePP(s,l),c=se.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=UP(e,t,!1,!!n),o=UP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Aw(t,!!n),o=Aw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}WP.defaultAttributes={pickable:!1};class YP extends Ky{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&bw(this._innerView),this.removeAllChild(!0),this._innerView=af.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 xw(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?`${uw.grid}-sub`:`${uw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Aw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=UP(t,o,!1,!!a)}const u=af.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:YP.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Aw(o,!!a),m=Ht(o[0].x-o[1].x),v=Ht(o[0].y-o[1].y),_=af.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Dt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:YP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),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=!dt(a.value,0)&&!dt(l.value,0),d=!dt(a.value,1)&&!dt(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}}YP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},OA(),jA();class XP extends YP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},YP.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=QA,endAngle:r=tM}=this.attribute;i=kw(t,s,se.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(XP,Uw);var $P=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var 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(KP,zC);const qP="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",ZP={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:qP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:qP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},JP={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 QP;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QP||(QP={}));var tE=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=QP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=aM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===QP.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===QP.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=QP.endHandler):h+=l:this._activeTag===QP.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===QP.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===__.env?__:this.stage,e=aM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===QP.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===QP.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=tE(c,["formatMethod"]),{formatMethod:g}=d,f=tE(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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+m*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==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*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==f?void 0:f.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({},f,{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 ze).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:W}=this.attribute,{start:U,end:G}=this.state,{position:Y,width:X,height:$}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:X,height:$,cursor:N?"crosshair":"auto"},L),{pickable:!W&&(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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y,width:(G-U)*X,height:$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(r=z.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+U*$,width:X,height:(G-U)*$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y-t,width:(G-U)*X,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!W&&(null===(p=null===(u=null===(d=j.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+(U+G)/2*X,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!W&&(null===(m=j.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*X,y:Y.y+$/2,size:$,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},JP.horizontal),H),{pickable:!W&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*X,y:Y.y+$/2,size:$,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},JP.horizontal),V),{pickable:!W&&(null===(b=V.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+U*X-t/2,y:Y.y+$/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},JP.horizontal),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*X-i/2,y:Y.y+$/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},JP.horizontal),{pickable:!W}),"rect")}else{if(j.visible){const t=(null===(x=j.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+X,y:Y.y+U*$,width:t,height:(G-U)*$},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!W&&(null===(M=null===(A=null===(k=j.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+X+t/2,y:Y.y+(U+G)/2*$,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=j.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},j.icon),{pickable:!W&&(null===(B=null===(C=j.icon)||void 0===C?void 0:C.pickable)||void 0===B||B)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+U*$,size:X,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},JP.vertical),H),{pickable:!W&&(null===(E=H.pickable)||void 0===E||E)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+G*$,size:X,symbolType:null!==(R=V.symbolType)&&void 0!==R?R:"square"},JP.vertical),V),{pickable:!W&&(null===(O=V.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+X/2+t/2,y:Y.y+U*$-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},JP.vertical),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+X/2+i/2,y:Y.y+G*$-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},JP.vertical),{pickable:!W}),"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 zM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;u(t)&&u(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,...G(a))}setPreviewPointsX(t){c(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._statePointToData=t)}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var sE,nE,rE,aE;function oE(){OA(),DM(),_T()}iE.defaultAttributes=ZP,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"}(sE||(sE={})),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"}(nE||(nE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(rE||(rE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(aE||(aE={}));class lE extends Ky{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Tw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Cw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Bw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=af.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=af.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=af.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 hE(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 cE(t,e,i,s){t&&(hE(t.startSymbol,e,i,s),t.lines.forEach((t=>hE(t,e,i,s))),hE(t.line,e,i,s),hE(t.endSymbol,e,i,s))}function dE(t,e,i,s){t&&(hE(t.getTextShape(),e,i,s),hE(t.getBgRect(),e,i,s))}function uE(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 pE(t,e,i,s){t&&(uE(t.startSymbol,e,i,s),t.lines.forEach((t=>uE(t,e,i,s))),uE(t.line,e,i,s),uE(t.endSymbol,e,i,s))}function gE(t,e,i,s){t&&(uE(t.getTextShape(),e,i,s),uE(t.getBgRect(),e,i,s))}function fE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;hE(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)})),hE(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;hE(t.getTextShape(),e,l,n),hE(t.getBgRect(),e,l,n)}))}function mE(t,e,i,s,n){cE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function vE(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function _E(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{dE(t,s,i,n)}))}function yE(t,e,i,s,n,r){var a;cE(t,n,s,r),hE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?dE(i,n,s,r):hE(i,n,s,r)}function bE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;hE(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)})),hE(e,n+o+l,h,r),hE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(hE(i.getTextShape(),n+o+l+h+c,d,r),hE(i.getBgRect(),n+o+l+c,d,r)):hE(i,n+o+l+c,d,r)}function xE(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?fE(t,e,s,r,a):"fadeIn"===i&&mE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?fE(t,e,s,n,a):"fadeIn"===i&&mE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){pE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function SE(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&&vE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&vE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function kE(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&&_E(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&_E(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{gE(t,s,i,n)}))}(t,e,i,s,n)}}function AE(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?yE(n,r,e,i,s,o):"callIn"===t&&bE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?yE(n,r,e,i,s,a):"callIn"===t&&bE(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;pE(t,n,s,r),uE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?gE(i,n,s,r):uE(i,n,s,r)}(n,r,e,t,i,s)}}const ME={type:"clipIn",duration:500,easing:"linear",delay:0},wE={type:"fadeIn",duration:500,easing:"linear",delay:0},TE={type:"callIn",duration:500,easing:"linear",delay:0},CE={type:"fadeOut",duration:500,easing:"linear",delay:0};class BE{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new zM(Object.assign(Object.assign({},h),{state:{panel:z({},sM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},sM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},sM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},sM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class PE extends lE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=CE}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;LM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(PE,BE);const EE=.001,RE={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:sE.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]}},OE={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"}}},IE={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:{autoRotate:!0,position:rE.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]}},LE={interactive:!0,label:{position:nE.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}},DE={interactive:!0,label:{autoRotate:!0,position:rE.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}},FE={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"}},zE={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"}},jE={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 HE(){VE._animate=xE}oE(),lw(),_T();class VE extends PE{markerAnimate(t){VE._animate&&this._animationConfig&&VE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},VE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(fM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return mM(Math.abs(e),Math.PI/2,EE)||mM(Math.abs(e),3*Math.PI/2,EE)?vM(i,e,t):fM(e)?OE.postiveXAxis[t]:OE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new cw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},sM,null==a?void 0:a.line),startSymbol:z({},sM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},sM,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({},sM,null==a?void 0:a.line),startSymbol:z({},sM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},sM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",VE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(VE.defaultAttributes.label)}}function NE(){WE._animate=SE}VE.defaultAttributes=RE,oE(),VA(),_T();class WE extends lE{markerAnimate(t){WE._animate&&this._animationConfig&&WE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=CE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},zE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;LM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=af.polygon(Object.assign({points:e},i));n.states=z({},sM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",WE.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},sM,null==i?void 0:i.area)),this._updateMarkLabels(WE.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}WE.defaultAttributes=LE,U(WE,BE),oE(),hw(),_T();class UE extends PE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case rE.arcInnerStart:l=n;case rE.arcOuterStart:l=n;break;case rE.arcInnerEnd:l=r;case rE.arcOuterEnd:l=r;break;case rE.center:case rE.arcInnerMiddle:case rE.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return FE[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new dw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},sM,null==o?void 0:o.line),startSymbol:z({},sM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},sM,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({},sM,null==o?void 0:o.line),startSymbol:z({},sM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},sM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",UE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(UE.defaultAttributes.label)}}UE.defaultAttributes=IE,oE(),MA(),_T();class GE extends lE{markerAnimate(t){GE._animate&&this._animationConfig&&GE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GE.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=CE}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case rE.center:h=(s+n)/2,c=(r+a)/2;break;case rE.arcInnerStart:h=s,c=r;break;case rE.arcOuterStart:h=n,c=r;break;case rE.arcInnerEnd:h=s,c=a;break;case rE.arcOuterEnd:h=n,c=a;break;case rE.arcInnerMiddle:h=s,c=(r+a)/2;break;case rE.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},FE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;LM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=af.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},sM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",GE.defaultAttributes.label)}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({},sM,null==o?void 0:o.area)),this._updateMarkLabels(GE.defaultAttributes.label)}isValidPoints(){return!0}}function YE(){XE._animate=AE}GE.defaultAttributes=DE,U(GE,BE),oE(),lw(),hw(),KA(),LA(),FA(),_T();class XE extends lE{markerAnimate(t){XE._animate&&this._animationConfig&&XE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},XE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=TE,this.defaultExitAnimation=CE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return mM(Math.abs(s),Math.PI/2,EE)||mM(Math.abs(s),3*Math.PI/2,EE)?vM(t,s,n):fM(s)?jE.postiveXAxis[n]:jE.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,style:d,position:u=aE.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},sM,null==p?void 0:p.textBackground),text:z({},sM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},sM,null==p?void 0:p.itemContent));const v=fM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=af.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"text"===n?o=new zM(Object.assign(Object.assign({},i),{state:{panel:z({},sM,null==s?void 0:s.textBackground),text:z({},sM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=af.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"image"===n?(o=af.image(Object.assign(Object.assign({},i),r)),o.states=z({},sM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},sM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=mM(c,0,EE)||mM(d,0,EE),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=OM(e-u,t-d),o=OM(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(iR.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(iR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===iR.focus||"focus"===o){const s=a.hasState(tR.focus);a.toggleState(tR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[tR.unSelected,tR.unSelectedHover,tR.focus],t),this._setLegendItemState(e,tR.selected,t)})):(this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[tR.selected,tR.selectedHover,tR.focus],t),this._setLegendItemState(e,tR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(tR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(tR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(eR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[tR.selected,tR.selectedHover],t),this._setLegendItemState(a,tR.unSelected,t)):(this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t))}else this._setLegendItemState(a,tR.selected,t),this._removeLegendItemState(a,[tR.unSelected,tR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[tR.selected,tR.selectedHover],t),this._setLegendItemState(e,tR.unSelected,t))}))}this._dispatchLegendEvent(eR.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,tR.selected),this._removeLegendItemState(e,[tR.unSelected,tR.unSelectedHover])):(this._removeLegendItemState(e,[tR.selected,tR.selectedHover]),this._setLegendItemState(e,tR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=ZE,spaceRow:l=JE,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=af.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+E(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";p(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";p(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:p,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),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=si(c);let T;!1===x.visible?(T=af.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,iR.item,t,T)):(T=af.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,iR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?tR.selected:tR.unSelected);const C=af.group({x:0,y:0,pickable:!1});T.add(C);let B,P=0,R=0,O=0;if(v&&!1!==v.visible){const i=E(S,"style.size",10);R=_(i)?i[0]||0:i,O=E(v,"space",8);const s=af.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,iR.itemShape,t,T,S.state),s.addState(e?tR.selected:tR.unSelected),C.add(s)}let I=0;if(p){const e=E(g,"size",10);B=af.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,iR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=EM(Object.assign(Object.assign({x:R/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:y.formatMethod?o:void 0}));this._appendDataToShape(D,iR.itemLabel,t,T,k.state),D.addState(e?tR.selected:tR.unSelected),C.add(D);const F=E(y,"space",8);if(u(l)){const s=E(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=EM(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,iR.itemValue,t,T,A.state),r.addState(e?tR.selected:tR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/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]-R-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",P),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.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 qE(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 qE(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 lM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new lM(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",bt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+E(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=ZE,spaceRow:o=JE}=n,l=this._itemsContainer,{space:h=QE,defaultCurrent:c=1}=r,d=aR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=af.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+E(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=ZE,spaceRow:a=JE}=s,o=this._itemsContainer,{space:l=QE,defaultCurrent:h=1}=n,c=aR(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 _=af.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=af.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=[];dt(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),dt(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(tR.selected)?this._setLegendItemState(t,tR.selectedHover,e):this._setLegendItemState(t,tR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===iR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(eR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(tR.unSelectedHover)||t.hasState(tR.selectedHover))&&(i=!0),t.removeState(tR.unSelectedHover),t.removeState(tR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(tR.unSelectedHover)&&!t.hasState(tR.selectedHover)||(i=!0),t.removeState(tR.unSelectedHover),t.removeState(tR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===iR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(eR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(eR.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!==iR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(eR.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!==iR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(eR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(tR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},oR,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(tR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(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 hR;function cR(t){return _(t)?t:[t,t]}function dR(t){return t?"ew-resize":"ns-resize"}lR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:ZE,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:QE,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"}(hR||(hR={})),nR();class uR extends Ky{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({},uR.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=aM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=aM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:cR(p)[0],endValue:cR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=af.group({x:0,y:0});f.name=hR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=af.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)),m.name=hR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=af.group({x:g?v:0,y:g?0:v});f.add(_);const y=af.group({x:0,y:0});let b;if(y.name=hR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=af.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=hR.endText,f.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=af.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=hR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=cR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":dR(p)},r));if(v.name=hR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=hR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":dR(p)},r));if(i.name=hR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=hR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=mt(h,i,s);c=t[0],u=t[1]}else c=i,u=ft(h,i,s);const g=this._isHorizontal;e||(c=i);const f=af.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=hR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":dR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=af.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=hR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return af.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":dR(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),af.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=af.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=af.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=aM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===hR.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===hR.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===hR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===hR.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}}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}uR.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}}},rR(),nR();class pR extends sR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function gR(t="bottom"){let 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`}pR.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"}}},rR(),nR(),jA();class fR extends sR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=af.group({x:0,y:0});this._innerView.add(x);const S=new uR({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:gR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=af.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+E(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))}}fR.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)"}},OA(),ZA(),GA();let mR=class t extends Ky{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:P,maxWidth:E,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=si(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},nM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},nM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(P)&&UE&&(U=E),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};mR.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 vR={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"}}};OA(),ZA(),GA();let _R=class extends Ky{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},E(vR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=EM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(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 p=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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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",u(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;G(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 yR extends xg{constructor(t){super(t)}}var bR,xR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(bR||(bR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(xR||(xR={}));class SR extends Ky{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},SR.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"},SR.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"},SR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},SR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},SR.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=()=>{d(this._playController)&&(this._playController=new yR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new yR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new yR(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(bR.OnPlay)},this.pause=()=>{this._dispatchEvent(bR.OnPause)},this.forward=()=>{this._dispatchEvent(bR.OnForward)},this.backward=()=>{this._dispatchEvent(bR.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()}}SR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},SR.defaultAttributes={[xR.Start]:{},[xR.Pause]:{},[xR.Backward]:{},[xR.Forward]:{}};const kR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},AR=[200,10];var MR,wR;!function(t){t.Default="default",t.Reverse="reverse"}(MR||(MR={})),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"}(wR||(wR={}));const TR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===MR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===MR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),CR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===MR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===MR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),BR=t=>"top"===t||"bottom"===t;class PR extends Ky{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PR.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(BR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:AR[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:AR[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 uR(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=BR(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 SR(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=BR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:AR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(BR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:BR(this._orient)?t+s:(this._size.width-r)/2,y:BR(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:BR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:BR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:BR(this._orient)?t+s:(this._size.width-r)/2,y:BR(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 ER(){nR(),OA(),KA()}PR.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({},kR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},kR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},kR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},kR),{key:"backward",position:"start"})}},ER();class RR extends PR{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:MR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(bR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(bR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(bR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(bR.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(wR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(TR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||CR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===MR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(wR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(wR.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(wR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(wR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.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(wR.change),this.dispatchCustomEvent(wR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var OR,IR=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())}))};ER();class LR extends PR{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(bR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(bR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(bR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(bR.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(wR.change))},this.play=()=>IR(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(wR.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(wR.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(wR.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(wR.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.brushActive="brushActive",t.brushClear="brushClear"}(OR||(OR={}));const DR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},FR=5;const zR={debounce:yt,throttle:bt};OA(),VA();let jR=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=DR.updateTrigger,endTrigger:i=DR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:zR[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=DR.trigger,resetTrigger:e=DR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(OR.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(OR.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=FR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(OR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(OR.brushActive,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._dispatchBrushEvent(OR.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=FR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(OR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=DR.updateTrigger,endTrigger:e=DR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=af.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};jR.defaultAttributes=DR;const HR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},VR=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}},NR={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:eM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:eM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:eM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new je).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},WR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];OA(),WA(),KA(),ZA(),GA();let UR=class t extends Ky{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=si(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:gM(p)&&gM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gM(p)&&gM(p.value)},VR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:gM(p)&&gM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:gM(p)&&gM(p.value)},VR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},nM),p.value),visible:gM(p)&&gM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=gM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=gM(p)?p.height+p.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(!gM(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 p="right"===c?(o?d:0)+(gM(n.key)?r+n.key.spacing:0)+(gM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(RM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:gM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(gM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Qc(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(gM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},VR(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},VR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},nM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(gM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},VR(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},VR(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=>WR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&gM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=gM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=TM(d),_=TM(u);let y=0;if(gM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(gM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&su[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 HR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return HR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};UR.defaultAttributes=NR;const GR=dt;function YR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function XR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function $R(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function KR(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function qR(t,e){const i=KR(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 ZR(t,e){const i=JR(t),s=JR(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 JR(t,e={x:0,y:0}){return se.distancePP(t,e)}function QR(t){return k(t.x)&&k(t.y)}function tO(t,e,i){let s=!1;if(e&&c(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 eO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const iO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function nO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&nO(t[i],e)}}var rO,aO,oO;function lO(t){var e,i;const{type:s}=t;return s===aO.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(rO||(rO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(aO||(aO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(oO||(oO={}));const hO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},cO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function dO(t,e){var i;if(!t)return[];const s=_O(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?mO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fO(i)?pO(t,i,e):i)).filter(u)}))):i.map((i=>fO(i)?pO(t,i,e):i)).filter(u):[]}return[]}function uO(t,e){var i,s;return mO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 pO(t,e,i){var s;const n=_O(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=hO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=cO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new Qe(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ue(t,i,s),a=We(n,r,e.l),l=new Qe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gO=(t,e)=>{if(e&&fO(t)){const i=pO(e,t);if(i)return i}return t};function fO(t){return t&&"palette"===t.type&&!!t.key}function mO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function vO(t){return _(t)?{dataScheme:t}:t}function _O(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=lO(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 yO extends mB{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(!mO(this._range))return void super.range(this._range);const t=uO(this._range,this._domain);super.range(t)}}const bO={linear:HB,band:yB,point:class extends yB{constructor(t){super(!1),this.type=$C.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:mB,threshold:YB,colorOrdinal:yO};function xO(t){const e=bO[t];return e?new e:null}function SO(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 kO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function AO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function MO(t){return!!v(t)&&(!!t.endsWith("%")&&Yy(t.substring(0,t.length-1)))}function wO(t){return!!p(t)&&("percent"in t||"offset"in t)}function TO(t,e,i,s=0){var n,r;return x(t)?t:MO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function CO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=TO(t[s],e.size,i)}))})),o}function BO(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}}function PO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||MO(t)||c(t)||wO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function EO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const RO=(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},OO=[{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"]}];function IO(t,e){return t&&e.key in t?t[e.key]:e.default}function LO(t){return t&&"token"===t.type&&!!t.key}const DO={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%"},FO={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:OO,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"}}},token:DO,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},zO={name:"dark",colorScheme:{default:{dataScheme:OO,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}}}}}},jO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>jO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>jO(t[i],e[i])))),HO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),HO(t[s],e.slice(1),i))},VO=t=>t instanceof Ma||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 NO(t,e=["data"]){return I(t,VO,e)}function WO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=vO(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)})}UO._charts={},UO._series={},UO._components={},UO._graphicComponents={},UO._marks={},UO._regions={},UO._animations={},UO._implements={},UO._chartPlugin={},UO._vChartPlugin={},UO._componentPlugin={},UO.transforms={fields:Ur,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}},UO.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Jr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=zr(ta,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return Zr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t))},UO._layout={},UO._grammarTransforms={},UO._stageEventPlugins={},UO.registerStageEventPlugin=(t,e)=>{UO._stageEventPlugins[t]=e},UO.getStageEventPlugin=t=>UO._stageEventPlugins[t],UO._interactionTriggers={},UO.registerInteractionTrigger=(t,e)=>{UO._interactionTriggers[t]=e},UO._composedEventMap={},UO.registerComposedEvent=(t,e)=>{UO._composedEventMap[t]=e},UO._tooltipProcessors={},UO.registerTooltipProcessor=(t,e)=>{UO._tooltipProcessors[t]=e},UO.createTooltipProcessor=(t,e)=>{const i=UO._tooltipProcessors[t];return i?new i(e):null};const XO=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},$O=XO(),KO={[FO.name]:FO},qO=FO.name,ZO=new Map(Object.keys(KO).map((t=>[t,KO[t]]))),JO=new Map,QO=new Map(Object.keys(KO).map((t=>[t,t===qO]))),tI=(t,e)=>{if(!t)return;const i=nI(e);ZO.set(t,i),QO.set(t,!0)},eI=(t=qO)=>(QO.has(t)&&!QO.get(t)&&tI(t,ZO.get(t)),ZO.get(t)),iI=t=>ZO.delete(t)&&JO.delete(t)&&QO.delete(t),sI=t=>!!v(t)&&ZO.has(t),nI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:qO;return GO({},eI(i),t)};class rI{static registerInstance(t){rI.instances.set(t.id,t)}static unregisterInstance(t){rI.instances.delete(t.id)}static getInstance(t){return rI.instances.get(t)}static instanceExist(t){return rI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return rI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}rI.instances=new Map;class aI{static registerTheme(t,e){tI(t,e)}static getTheme(t,e=!1){return eI(t)}static removeTheme(t){return iI(t)}static themeExist(t){return sI(t)}static getDefaultTheme(){return aI.themes.get(qO)}static setCurrentTheme(t){aI.themeExist(t)&&(aI._currentThemeName=t,rI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return aI.getTheme(aI._currentThemeName,t)}static getCurrentThemeName(){return aI._currentThemeName}}function oI(t){return v(t)?aI.themeExist(t)?aI.getTheme(t):{}:p(t)?t:{}}aI.themes=ZO,aI._currentThemeName=qO;const lI=["animationThreshold","colorScheme","name","padding"];function hI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];lI.includes(n)?s[n]=r:f(r)?fO(r)?s[n]=gO(r,e):LO(r)?s[n]=IO(i,r):s[n]=hI(r,e,i):s[n]=r})),s}function cI(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]=cI(t[s],e)}return i}return _(t)?t.map((t=>cI(t,e))):t}function dI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=dI(t[s],e)}return i}return _(t)?t.map((t=>dI(t,e))):t}const uI=(t,e,i,s)=>((t,e,i)=>TM(t,e,i,{fontFamily:DO.fontFamily,fontSize:DO.fontSize}))(e,i,s).measure(t),pI="__VCHART",gI=500,fI=500,mI=`${pI}_MEASURE_CANVAS_ID`,vI=`${pI}_DEFAULT_DATA_INDEX`,_I=`${pI}_DEFAULT_DATA_KEY`,yI=`${pI}_DEFAULT_DATA_SERIES_FIELD`,bI=`${pI}_DEFAULT_SERIES_STYLE_NAME`,xI=`${pI}_STACK_KEY`,SI=`${pI}_STACK_START`,kI=`${pI}_STACK_END`,AI=`${pI}_STACK_START_PERCENT`,MI=`${pI}_STACK_END_PERCENT`,wI=`${pI}_STACK_START_OffsetSilhouette`,TI=`${pI}_STACK_END_OffsetSilhouette`,CI=`${pI}_STACK_TOTAL`,BI=`${pI}_STACK_TOTAL_PERCENT`,PI=`${pI}_STACK_TOTAL_TOP`,EI=`${pI}_STACK_TOTAL_BOTTOM`,RI=`${pI}_MOSAIC_VALUE_START_PERCENT`,OI=`${pI}_MOSAIC_VALUE_END_PERCENT`,II=`${pI}_MOSAIC_CAT_START_PERCENT`,LI=`${pI}_MOSAIC_CAT_END_PERCENT`,DI=`${pI}_SEGMENT_START`,FI=`${pI}_SEGMENT_END`,zI=`${pI}_KEY`;function jI(t,e){for(let i=0;it.key===e))}function VI(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 NI(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:{}},XI(t,a,n[o],l,e,r))})),s?WI(n):n}function WI(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))):WI(t[e].nodes);return t}function UI(t,e){if("values"in t&&t.values.length){const i=$R(t.values,e),s=XR(t.values,MI);t.values.forEach((t=>{t[CI]=i,t[BI]=s}))}else for(const i in t.nodes)UI(t.nodes[i],e)}function GI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][kI]/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)YI(t.nodes[r],e,i,s,n)}function XI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[kI]=function(t){if(k(t))return t;const e=+t;return k(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},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),XI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const $I=(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]=qI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function ZI(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>tL(t.style(e,i,s,n)):P(t.style)||(e.style=tL(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>tL(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=tL(t.state[e]))})),e.state=i}return e}function JI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>tL(t[i](e,s,n,r)):P(t[i])||(e[i]=tL(t[i]))})),e}function QI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),tL(i)}function tL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ne(t.angle)}):t}const eL=t=>"line"===t||"area"===t,iL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return eL(i)?e:null==e?void 0:e[0]},sL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let nL=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},n=UO.getComposedEvent(t);if(n){const e=new n(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(UO.getComposedEvent(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()}};var rL;!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"}(rL||(rL={}));const aL=["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 oL,lL,hL;!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.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(oL||(oL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(lL||(lL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(hL||(hL={}));const cL=[hL.mark,hL.model,hL.chart,hL.vchart];class dL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(hL.vchart,[]),this._levelNodes.set(hL.chart,[]),this._levelNodes.set(hL.model,[]),this._levelNodes.set(hL.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 uL={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 pL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=E(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>iL(t)))};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)||lL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||lL.chart);o.get(t)||o.set(t,new dL);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)||lL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||lL.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)||lL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||lL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?cL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[lL.chart,lL.window,lL.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(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&E(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 uL[a]&&(a=uL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?hL.model:hL.vchart:hL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=bt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=yt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=lL.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!==hL.model&&s!==hL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=hL.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 lL.chart:return this._viewBubbles;case lL.window:return this._windowBubbles;case lL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case lL.chart:return this._viewListeners;case lL.window:return this._windowListeners;case lL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return aL.includes(t)||Object.values(rL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&UO.hasInteractionTrigger(e)}}function gL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function fL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const mL=new Map;let vL;function _L(){vL||(vL=new Aa,fL(vL,"geojson",_a),fL(vL,"topojson",ba),gL(vL,"simplify",Nr))}function yL(t,e,i={type:"geojson",centroid:!0}){mL.has(t)&&Dy(`map type of '${t}' already exists, will be overwritten.`),_L();const s=new Ma(vL),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"}):p(r)&&s.transform({type:"simplify",options:r}),mL.set(t,s)}function bL(t){mL.has(t)?mL.delete(t):Dy(`map type of '${t}' does not exists.`)}function xL(t,e=!1){let i=e;return t.latestData instanceof Ma&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const SL=(t,e)=>0===t.length?[]:1===t.length?xL(t[0],null==e?void 0:e.deep):t.map((t=>xL(t,null==e?void 0:e.deep)));function kL(t,e,i){gL(e=e instanceof Aa?e:t.dataSet,"copyDataView",SL);const s=new Ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:wL.copyDataView}),s}function AL(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?I(t.parser):{clone:!0},c=I(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 Dy(`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 Dy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Dy("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 ML(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var wL,TL,CL,BL;!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"}(wL||(wL={})),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"}(TL||(TL={})),function(t){t.data="data",t.mark="mark"}(CL||(CL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(BL||(BL={}));const PL=["line","area","trail"];function EL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(zI,i?t.slice().sort(i):t.slice()),{keys:[zI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const RL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function OL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{OL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function LL(t,e,i,s){const n=EL(t,(t=>i(t))),r=EL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 DL{getRootGroup(){return this._rootGroup}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(oL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(oL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(oL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=wp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Ny(o))&&!1!==c&&UO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=BL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>OL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>OL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{OL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Ly(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===BL.before&&(this._layoutState=BL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=BL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Ly(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=IL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=LL(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=LL(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===lL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:iL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===lL.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===lL.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===lL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===lL.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===lL.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{OL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=IL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Vy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return fu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{fo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{OL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function FL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Fy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function zL(t){t.crosshair=G(t.crosshair||{}).map((e=>WO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function jL(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ni(l,i.width,i.height);a=t,o=e}else if(h&&Vy(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=ni(t,i.width,i.height);a=e,o=s}else if(Wy(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 HL(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 VL(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}}const NL=9,WL=0,UL=-1;var GL,YL,XL,$L,KL,qL;!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"}(GL||(GL={})),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"}(YL||(YL={})),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"}(XL||(XL={}));class ZL{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ZL.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]))))}}ZL.defaultMarkInfo={};class JL{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class QL{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=>WO({},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 tD extends JL{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=QL,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ZL,this._lastLayoutRect=null,this.id=Gy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new nL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${pI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=UO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return E(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class eD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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=YL.Region,this._willLayoutTag=!0,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){let a=CO(PO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:TO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:TO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:TO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:TO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:TO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:TO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=TO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=TO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=TO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(BO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class iD extends tD{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,this._transformLayoutPadding=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 eD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 sD extends QL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class nD extends iD{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=sD,this.modelType="region",this.specKey="region",this.type=nD.type,this._series=[],this.layoutType="region",this.layoutZIndex=GL.Region,this.seriesDataFilterOver=()=>{this.event.emit(oL.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"}_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._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",GL.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",XL.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:GL.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:GL.Mark+1}))}_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",XL.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",XL.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}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",XL.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",XL.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",XL.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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))&&(!u(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function rD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 aD(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 oD(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 lD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=uD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),oD(d,!0,p,l),s&&aD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function hD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=uD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=uD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),oD(d,!1,p,o),s&&aD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function dD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=uD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=uD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&lD(n,e,i,!1,"left",s),r.length&&lD(r,e,i,!0,"left",s),a.length&&hD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&cD(n,e,i,!1,"top",s),r.length&&cD(r,e,i,!0,"top",s),a.length&&dD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&lD(n,e,i,!1,"right",s),r.length&&lD(r,e,i,!0,"right",s),a.length&&hD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rD(t);n.length&&cD(n,e,i,!1,"bottom",s),r.length&&cD(r,e,i,!0,"bottom",s),a.length&&dD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=uD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=uD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Fy)("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}}}pD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($L||($L={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(KL||(KL={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(qL||(qL={}));const gD=["linear","radial","conical"],fD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const mD={};Object.values(KL).forEach((t=>{mD[t]=!0})),KL.STATE_HOVER,KL.STATE_HOVER_REVERSE,KL.STATE_SELECTED,KL.STATE_SELECTED_REVERSE,KL.STATE_DIMENSION_HOVER,KL.STATE_DIMENSION_HOVER_REVERSE;class vD extends JL{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class _D extends vD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,PL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!mD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(pI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(pI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(qC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class yD extends JL{constructor(){super(...arguments),this.id=Gy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=UO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class bD extends yD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const xD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,SD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=xD(l.delay,n,a,o),d=xD(l.duration,n,a,o),u=xD(l.oneByOne,n,a,o),p=xD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?FT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zT)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);OT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?FT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>BT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>ET(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:No.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new RT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:AT,null!==(l=i.easing)&&void 0!==l?l:MT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:No.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new IT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:AT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:MT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):OT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},kD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},AD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class MD extends yD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new bD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=wp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:GL.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Dl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$L.enter&&t.context.diffState!==$L.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=t,this.model=e.model,this.key=e.key,this.state=new _D(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ne)}isUserLevel(t){return[XL.User_Mark,XL.User_Series,XL.User_Chart,XL.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&WO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ZC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=xO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):gD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):ZC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",XL.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,XL.User_Mark)}else this.setStyle(i,t,XL.User_Mark)}))}_computeGradientAttr(e){var i,s;const{gradient:n,scale:r,field:a}=e,o=t(e,["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 d=uO(dO(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()),p=Object.assign(Object.assign({},fD[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(p).forEach((s=>{const n=p[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=Qe.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||d[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)gD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=uO(dO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return EL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return UO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[_I],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=EL(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{AD(t),s.push(...t.getGraphics())})),e.forEach((t=>{AD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);SD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=kD(e,n),r=kD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===TL.exit?TL.exit:i===TL.update?TL.update:TL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$L.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===$L.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$L.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$L.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=$L.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=TL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=TL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return RL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=RL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=sL(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===KL.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=UO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=UO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===BL.before||(Ly(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$L.exit&&!e.isExiting)if(e.context.animationState===$L.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$L.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=wp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var wD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(wD||(wD={}));class TD extends MD{constructor(){super(...arguments),this.type=TD.type,this._marks=[],this._diffState=$L.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Dy("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?(Dy("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))}getMarkInUserId(t){let e;return OL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===$L.update){const t=this.hasAnimation(),e=sL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$L.update}render(){this._isCommited&&(Ly(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}TD.type="group";const CD={measureText:uI};class BD{static instance(){return BD.instance_||(BD.instance_=new BD),BD.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 PD{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))?Dy("不要重复添加相同的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 ED extends PD{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}}const RD={type:"fadeIn"};function OD(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 RD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ID={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"}},LD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},DD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},FD=()=>{UO.registerAnimation("scaleInOut",(()=>LD))},zD=()=>{UO.registerAnimation("fadeInOut",(()=>DD))},jD=(t,e)=>({appear:OD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:NT,duration:ID.update.duration,easing:ID.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),HD=()=>{UO.registerAnimation("line",jD)},VD=()=>{lT.registerBuiltInAnimate("growPointsIn",aC),lT.registerBuiltInAnimate("growPointsOut",oC),lT.registerBuiltInAnimate("growPointsXIn",hC),lT.registerBuiltInAnimate("growPointsXOut",cC),lT.registerBuiltInAnimate("growPointsYIn",uC),lT.registerBuiltInAnimate("growPointsYOut",pC),lT.registerBuiltInAnimate("clipIn",GT),lT.registerBuiltInAnimate("clipOut",YT)},ND=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};KL.STATE_HIGHLIGHT,KL.STATE_BLUR;class WD{constructor(t){this._markSet=new ZL,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 UD={highlightState:KL.STATE_HIGHLIGHT,blurState:KL.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class GD extends WD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},UD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}GD.type="element-highlight",GD.defaultOptions=UD;const YD=()=>{UO.registerInteractionTrigger(GD.type,GD)},XD={state:KL.STATE_SELECTED,trigger:"click"};class $D extends WD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},XD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}$D.type="element-select",$D.defaultOptions=XD;const KD=()=>{UO.registerInteractionTrigger($D.type,$D)};class qD extends PD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class ZD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>UO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>UO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>UO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return UO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>UO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){UO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&BD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&BD.instance().unregisterFunction(t)}static getFunction(t){return t?BD.instance().getFunction(t):null}static getFunctionList(){return BD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=UO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=UO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,mL.get(e);var e}static registerSVG(t,e,i){const s=UO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=UO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){rI.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=Gy(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=HL(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?UO.getSeriesBuiltInTheme(e):UO.getComponentBuiltInTheme(e);i=i?WO({},s,i[e]):s}s===t.length-1&&u(i)&&(i=hI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},nO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Vy(_);if(S?ex(Ch):"node"===_&&jS(Ch),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=aI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:st.Error);nt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new DL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new pL(this,this._compiler),this._event=new nL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),rI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=WO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=cI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;ZD.getFunctionList()&&ZD.getFunctionList().length&&(t=dI(t,ZD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=UO.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=UO.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=UO.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._chartSpecTransformer),this._chart.init(),this._event.emit(oL.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)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(oL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=bt(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 jL(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:gI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:fI})}_initDataSet(t){this._dataSet=t instanceof Aa?t:new Aa,fL(this._dataSet,"dataview",xa),fL(this._dataSet,"array",i),gL(this._dataSet,"copyDataView",SL);for(const t in UO.transforms)gL(this._dataSet,t,UO.transforms[t]);for(const t in UO.dataParser)fL(this._dataSet,t,UO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(oL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?TL.none:TL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,rI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,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 e(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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ma?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=AL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.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,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?WO({},t[n][e.index],i):i):t[n]=s?WO({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?WO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?WO({},t[n],i):i)}))}(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=WO({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(oL.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=GO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=oI(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=GO({},oI(this._currentThemeName),oI(n),oI(r));this._currentTheme=o(a,t)}else{const t=GO({},oI(this._currentThemeName),oI(n),oI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(HM.poptip,jM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Vy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return oI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!aI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield FL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Vy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?EO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Dy("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 u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?EO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Dy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return BD.instance().getFunction(t)}registerFunction(t,e){t&&e&&BD.instance().registerFunction(t,e)}unregisterFunction(t){t&&BD.instance().unregisterFunction(t)}getFunctionList(){return BD.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(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.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=UO.getChartPlugins();t.length>0&&(this._chartPlugin=new ED(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=UO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new qD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}ZD.InstanceManager=rI,ZD.ThemeManager=aI,ZD.globalConfig={uniqueTooltip:!0},ZD.Utils=CD,ZD.vglobal=__;UO.registerRegion("region",nD),UO.registerLayout("base",pD),XA(),OA(),UO.registerMark(TD.type,TD),UO.registerStageEventPlugin("gesture",Ab),YD(),KD(),tI(zO.name,zO);const JD="monotone",QD="linear",tF="bevel";var eF;function iF(t,e){return e("component",t)}function sF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=UO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(eF||(eF={}));const nF=(t,e,i,s)=>{if(d(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},rF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},aF="2.0.5",oF=(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},lF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?E(e,t.field):t,s){const{formatFunc:i,args:r}=sF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},hF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const cF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function dF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=pF(lF(h,r,a,c),p,g),o.value=pF(lF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=lF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function uF(t,e,i,s,n,r,a){if(c(e)){dF(t,e(n,a),i,s,r,a)}else e&&dF(t,e,i,s,r,a)}const pF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=pi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class gF{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:u(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(u(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(u(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=>{uF(a,t,e,i,s,n,r)})):c(t)?uF(a,t,e,i,s,n,r):t&&dF(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=c(e)?e(s,n):e;if(r?d(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:lF(r.visible,t,n),value:pF(lF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:lF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=lF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&cF(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 fF={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}},mF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=jI([],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 vF(a,n,o)},vF=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Yy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Yy(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=fF[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},_F=(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=>{Yy(t[e])||(t[e]=0)}))})),t},yF=`${pI}_HIERARCHY_DEPTH`,bF=`${pI}_HIERARCHY_ROOT`,xF=`${pI}_HIERARCHY_ROOT_INDEX`;function SF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function kF(t,e,i){t&&(i.needDefaultSeriesField&&(t[yI]=i.defaultSeriesField),t[vI]=e,t[_I]=i.getKey(t,e,i))}function AF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function MF(t,e,i,s=0,n,r){void 0===r&&(r=e),kF(t,e,i),t[yF]=s,t[bF]=n||t[i.categoryField],t[xF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>MF(e,s,i,t[yF]+1,t[bF],r)))}const wF={label:{name:"label",type:"text"}},TF=`${pI}_rect_x`,CF=`${pI}_rect_x1`,BF=`${pI}_rect_y`,PF=`${pI}_rect_y1`,EF={data:!0},RF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OF=[...Object.keys(ID),"normal"];function IF(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 jF(n)&&delete n.type,n.oneByOne&&(n=DF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=WO({},o[e],a);return jF(n)&&delete n.type,n.oneByOne&&(n=DF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:FF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function LF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(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;const i=["custom","customParameters"];return t=I(t,null,i),HF(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function DF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function FF(t,e){var i;return null!==(i=null==t?void 0:t[vI])&&void 0!==i?i:e.context.graphicIndex}function zF(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 jF(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function HF(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),HF(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),HF(t[s],e,i))}function VF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class NF extends QL{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=lO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=UO.getSeriesMarkMap(o)?function(t,e,i){const s=UO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=WO({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return WO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(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:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=WO({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>WO({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class WF extends tD{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){u(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:`${pI}_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=NF,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=GL.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(oL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=VF(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(oL.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 d(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),u(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)&&(gL(this._rawData.dataSet,"invalidTravel",_F),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=AL(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=kL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=kL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new bD(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=vF(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(){gL(this._dataSet,"dimensionStatistics",mF);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&&jI(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){gL(this._dataSet,"dimensionStatistics",mF);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=jI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&jI(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(gL(this._rawData.dataSet,"addVChartProperty",oF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:SF.bind(this),call:kF}},!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(oL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(oL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(oL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(oL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=IF({},LF(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Ny(i)||Wy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=WO(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=WO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=ND(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=ND(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:KL.STATE_HOVER_REVERSE,highlightState:KL.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:KL.STATE_SELECTED_REVERSE,state:KL.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=ND(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:yI;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:bI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,bI,XL.User_SeriesStyle)}))}afterInitMark(){this.event.emit(oL.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",XL.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new gF(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)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},EF),RF),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=>RF[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ma||ML(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();VF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:yI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new yO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return dO(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:yI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,WO({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:_I}_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!==kI&&t!==MI&&t!==SI&&t!==AI||(t=this.getStackValueField()),null!==(e=VI(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=>Yy(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:yI]}}function UF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();qC(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 GF(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}}}WF.mark=wF,WF.transformerConstructor=NF;class YF extends WF{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);qC(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:`${pI}_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(kI),this.setFieldX2(SI)):(this.setFieldY(kI),this.setFieldY2(SI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(MI),this.setFieldX2(AI)):(this.setFieldY(MI),this.setFieldY2(AI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(TI),this.setFieldX2(wI)):(this.setFieldY(TI),this.setFieldY2(wI))}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),u(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(),u(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(oL.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)&&(UF("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function XF(t){return"bottom"===t||"top"===t}function $F(t){return"left"===t||"right"===t}function KF(t){return"z"===t}function qF(t,e){return AO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function ZF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function JF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?XF(t)?"linear":"band":XF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const QF=(t,e,i)=>{var s;const n=null!==(s="band"===e?iF("axisBand",i):["linear","log","symlog"].includes(e)?iF("axisLinear",i):{})&&void 0!==s?s:{},r=XF(t)?iF("axisX",i):$F(t)?iF("axisY",i):iF("axisZ",i);return WO({},iF("axis",i),n,r)};class tz{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:Fy)("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:Fy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>JC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return XF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class ez extends tz{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:lL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const iz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},sz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},nz=(t,e,i,s)=>{var n;const r=e.getScale(),a=JC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:rz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,az=(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};class oz extends tz{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)=>!iz(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:lL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:lL.canvas}),callback:this.onMouseOut}),Ny(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:lL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ny(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var lz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(lz||(lz={}));const hz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class cz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(hz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{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",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.event.on(oL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:tF,curveType:QD,closePath:!0},"normal",XL.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===JD?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",XL.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",XL.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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(hz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:zF(this._spec,hz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ma(this._option.dataSet,{name:`${pI}_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()},{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(lz.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:XL.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:KL.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",XL.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",XL.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[hz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(lz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,WO({},this._spec[hz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:KL.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",XL.Series),this.event.on(oL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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",XL.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",XL.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const dz=Object.assign(Object.assign({},wF),hz),uz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>uz(t,e[i])));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]))},pz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class gz extends MD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return pz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(ZC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?uz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$L.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[_I]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class fz extends gz{constructor(){super(...arguments),this.type=fz.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)===aO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}fz.type="line";const mz=()=>{UO.registerMark(fz.type,fz),XA(),FA(),zP(),OP(),VD(),UO.registerGraphicComponent("line",Mg)};class vz extends MD{constructor(){super(...arguments),this.type=vz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}vz.type="symbol";const _z=()=>{UO.registerMark(vz.type,vz),XA(),KA(),OP(),UO.registerGraphicComponent("symbol",Sg)};class yz extends NF{_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 bz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function xz(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:!k(o.min),extendable_max:!k(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 Sz(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 kz(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 Az(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 Mz(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 wz=(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=>function(t,e,i,s,n){const r=ee(t,e),a=Math.max(Qt(i),Qt(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return UC(v)};class Tz{constructor(t){this.id=Gy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Cz extends Tz{constructor(){super(Cz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!qC(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(oL.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&&bz(c)&&bz(d)))return;const u=xz(t,c),p=xz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!kz(u,p))return}else if(0===y&&0===b){if(!kz(p,u))return}else if(_||k)if(_&&!k){if(!Sz(u,p))return}else if(k&&!_){if(!Sz(p,u))return}else{if(f===b)return;if(f>b){if(!Az(u,p))return}else if(!Az(p,u))return}else{if(0===f&&0===y){if(!Mz(u,p))return}else if(0===b&&0===g&&!Mz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){gL(e.getOption().dataSet,"tickAlign",wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Cz.pluginType="component",Cz.type="AxisSyncPlugin";const Bz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Pz(t){let e=0;return E(t,"tick.visible")&&(e+=E(t,"tick.tickSize")),E(t,"label.visible")&&(e+=E(t,"label.space")),e}function Ez(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 Rz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Oz=t=>"band"===t||"ordinal"===t||"point"===t;function Iz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Lz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Dz extends PD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Fz=`${pI}_ARC_TRANSFORM_VALUE`,zz=`${pI}_ARC_RATIO`,jz=`${pI}_ARC_START_ANGLE`,Hz=`${pI}_ARC_END_ANGLE`,Vz=`${pI}_ARC_K`,Nz=`${pI}_ARC_MIDDLE_ANGLE`,Wz=`${pI}_ARC_QUADRANT`,Uz=`${pI}_ARC_RADIAN`,Gz=-Math.PI/2,Yz=3*Math.PI/2,Xz=.6,$z=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(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 de(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Kz=(t,e,i)=>{var s;const n=null!==(s="band"===e?iF("axisBand",i):"linear"===e?iF("axisLinear",i):{})&&void 0!==s?s:{},r=iF("angle"===t?"axisAngle":"axisRadius",i);return WO({},iF("axis",i),n,r)};function qz(t,e,i,s){switch(t){case n.cartesianBandAxis:return QF(qF(i,["z"]),"band",e);case n.cartesianLinearAxis:return QF(qF(i,["z"]),"linear",e);case n.cartesianLogAxis:return QF(qF(i,["z"]),"log",e);case n.cartesianSymlogAxis:return QF(qF(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return QF(qF(i),void 0,e);case n.polarBandAxis:return Kz(i.orient,"band",e);case n.polarLinearAxis:return Kz(i.orient,"linear",e);case n.polarAxis:return Kz(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=iF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>XF(t.orient)));let g;g=u(p)?WO({},Oz(p.type)?a:o,l):l;const f=r.find((t=>$F(t.orient)));let m;return m=u(f)?WO({},JC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=iF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?WO({},Oz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?WO({},JC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Zz(i,iF(t,e));default:return iF(t,e)}}const Zz=(t,e)=>{var i;const s=WO({},e,e[ZF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Jz extends QL{getTheme(t,e){return qz(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({},PO(e)),{[s]:0}))}}class Qz extends iD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Jz,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:lL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Dz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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}}getDatum(t){}}var tj,ej;Qz.transformerConstructor=Jz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(tj||(tj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ej||(ej={}));class ij extends MD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=UO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(rL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}ij.type="component";const sj=()=>{UO.registerMark(ij.type,ij)},nj=t=>t;class rj extends Qz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?tj.circleAxis:tj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),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()?ej.circleAxisGrid:ej.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),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:GL.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==E(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IF(null===(l=UO.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:E(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:E(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:E(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:E(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:E(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:E(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:E(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:E(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:E(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:E(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()),e=new bD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return tO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?qC(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===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.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 tO(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(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(oL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=eO(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()})),tO(this._regions,(t=>{t.event.on(oL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(oL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(tO(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 e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=ZI(s=e.domainLine)).startSymbol=ZI(s.startSymbol),s.endSymbol=ZI(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return tL(WO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:tL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>tL(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=tL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return tL(WO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:tL(e.tick.style)),e.tick.state&&(i.tick.state=JI(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return tL(WO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:tL(e.subTick.style)),e.subTick.state&&(i.subTick.state=JI(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Bz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ne(p):null,textStyle:WO({},u,tL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:tL(h.style)}),h.state&&(i.title.state.shape=JI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:tL(o.style)}),o.state&&(i.title.state.background=JI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=JI(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=tL(e.background.style)),e.background.state&&(i.panel.state=JI(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:c(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 tL(WO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:tL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:tL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=sF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){fL(this._option.dataSet,"scale",nj);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)}getDatum(t){var e;return t&&t.name===uw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}rj.specKey="axes";const aj=()=>{sj(),UO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},oj=[Cz];class lj extends rj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=GL.Axis,this.layoutLevel=YL.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),tO(this._regions,(t=>{const e=this.getOrient();XF(e)?Lz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):$F(e)?Lz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):KF(e)&&Lz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=WO({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(WO({x:e.x,y:e.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=XF(this.getOrient()),n=t=>{var e;return(s?!XF(t.getOrient()):XF(t.getOrient()))&&qC(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(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=qF(e,["z"]),KF(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(!Rz(e))return null;const{axisType:t,componentName:s}=JF(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=>$F(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(!Rz(t))return;const{axisType:s,componentName:n}=JF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=UO.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return XF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):KF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(oj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){XF(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!XF(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!KF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;$F(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=TO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=TO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=XF(this.getOrient())?t.fieldX:KF(this.getOrient())?t.fieldZ:t.fieldY,qC(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:qC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(rL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(XF(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=XF(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)}))}collectScale(){const t=[];return tO(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]:XF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:KF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();tO(this._regions,(e=>{XF(t)?Lz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):$F(t)?Lz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):KF(t)&&Lz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(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=XF(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=XF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=WO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new ze).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=XF(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-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Iz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:qC(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(oL.layoutEnd,this._updateAxisLayout),this.event.on(oL.layoutEnd,this._fixAxisOnZero),this.event.on(oL.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}}}}lj.type=n.cartesianAxis,lj.specKey="axes";const hj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function cj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,uj=(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 pj(t,e,i="count"){const s=uj(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const gj=Math.sqrt(50),fj=Math.sqrt(10),mj=Math.sqrt(2);class vj{constructor(){this._extend={},this.niceLabelFormatter=null}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Ez(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=XF(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=k(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(dj),e.sort(dj),{domain:cj(t,e),scope:pj(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Ez(this._spec);if(u(e)||u(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>=gj?10:n>=fj?5:n>=mj?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(oL.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(oL.scaleDomainUpdate,{model:this}),this.event.emit(oL.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=>k(+t)?Math.round(+t*s)/s:t}}const _j={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},yj={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}}},bj={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}}},xj={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}}};class Sj extends lj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new HB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(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(!KF(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=XF(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=MO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 gL(this._option.dataSet,t,KB),t}}Sj.type=n.cartesianLinearAxis,Sj.specKey="axes",Sj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Sj,vj);const kj=()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),aj(),UO.registerComponent(Sj.type,Sj)};class Aj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new bD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(oL.scaleDomainUpdate,{model:this}),this.event.emit(oL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Iz(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=>Iz(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 Mj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class wj extends lj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new yB}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 gL(this._option.dataSet,t,tP),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=cB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),aj(),UO.registerComponent(wj.type,wj,!1)};class Cj extends Sj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),tO(this._regions,(t=>{XF(this.getOrient())?Lz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Lz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=WO({},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 bD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=pi.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=>Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Cj.type=n.cartesianTimeAxis,Cj.specKey="axes",Cj.builtInTheme={axis:xj,axisX:yj,axisY:bj};class Bj extends Sj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new UB}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 gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Bj.type=n.cartesianLogAxis,Bj.specKey="axes",Bj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Bj,vj);class Pj extends Sj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new GB}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 gL(this._option.dataSet,t,KB),t}transformScaleDomain(){}}Pj.type=n.cartesianSymlogAxis,Pj.specKey="axes",Pj.builtInTheme={axis:xj,axisLinear:_j,axisX:yj,axisY:bj},U(Pj,vj);const Ej=`${pI}_hide_`;function Rj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Oj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Ej]&&(Rj(t,!0),t[Ej]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Ej]=!0,Rj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Ij=()=>{UO.registerGrammarTransform("symbolOverlap",{transform:Oj,runType:"afterEncode"})},Lj={min:$,max:X,average:KR,sum:$R};function Dj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Fj(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 zj(t,e,i,s){return Fj(t,e,i,"min",s)}function jj(t,e,i,s){return Fj(t,e,i,"max",s)}function Hj(t,e,i,s){return Fj(t,e,i,"average",s)}function Vj(t,e,i,s){return Fj(t,e,i,"sum",s)}const Nj=(t,e)=>{let i=c(t.size)?t.size():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=Dj;if("min"===n?l=zj:"max"===n?l=jj:"average"===n?l=Hj:"sum"===n&&(l=Vj),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[]},Wj=()=>{UO.registerGrammarTransform("dataSampling",{transform:Nj})};class Uj extends YF{constructor(){super(...arguments),this.type=aO.line,this.transformerConstructor=yz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(IF(null===(i=UO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),LF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=GF(this);this._symbolMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Uj.type=aO.line,Uj.mark=dz,Uj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Uj.transformerConstructor=yz,U(Uj,cz);class Gj{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)=>{ML(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];Dy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Dy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Yj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{jI(e,[{key:t,operations:qC(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&&jI(e,[{key:i.field,operations:qC(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?xO("colorOrdinal"):xO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(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(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:N(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=qC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=qC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;qC(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(qC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=qC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));qC(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class Xj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class $j extends JL{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Gy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:gI,height:fI},this._viewRect={width:gI,height:fI},this._viewBox={x1:0,y1:0,x2:gI,y2:fI},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=>u(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=PO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new nL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Gj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Xj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=UO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=UO.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:GL.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=UO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(oL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(oL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(oL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof tD)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 MD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof MD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&ML(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=jL(this._spec,this._option,{width:gI,height:fI})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=dO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Yj(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){HL(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=dO(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(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{HL(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,HL(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):HL(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()];HL(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=CO(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(oL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(KL.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(KL.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(KL.STATE_SELECTED)}clearHovered(){this.clearState(KL.STATE_HOVER)}_initEvent(){[oL.dataZoomChange,oL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(rL.AFTER_MARK_RENDER_END,e)};this._event.on(rL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:iL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(eL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===lz.dimensionHover||s===lz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>JC(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.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(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Kj=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class qj{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):HO(t,a,c.spec),HO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Kj(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=Kj(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(UO.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(UO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=UO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=UO.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=UO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):nF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=nF(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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class Zj extends qj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),E(i,"trimPadding")&&WO(i,VL(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 Jj extends Zj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),zL(t)}}const Qj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=NI(t,!0);for(const e in o)for(const i in o[e].nodes)YI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)GI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&UI(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(oL.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 eH{_beforeInit(){this._dataSet&&gL(this._dataSet,"stackSplit",Qj)}_initStack(){this._stack=new tH(this),this._stack.init()}}const iH={state:KL.STATE_DIMENSION_HOVER,reverseState:KL.STATE_DIMENSION_HOVER_REVERSE,trigger:lz.dimensionHover};class sH extends WD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},iH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=iL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}sH.type="dimension-hover",sH.defaultOptions=iH;const nH=()=>{UO.registerInteractionTrigger(sH.type,sH)},rH=()=>{UO.registerComposedEvent(lz.dimensionHover,oz),UO.registerComposedEvent(lz.dimensionClick,ez)},aH=t=>t.fieldX[0],oH=t=>t.fieldY[0],lH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},hH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},cH=(t,e)=>t?e?aH:lH:e?oH:hH,dH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=az(t,(t=>XF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=az(t,(t=>$F(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=>{JC(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=uH(t,i,cH(e,JC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=uH(t,i,cH(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},uH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:pH(t,s,i)},pH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=nz(e,t,"cartesian",null!=i?i:XF(t.getOrient())?aH:oH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},gH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(JC(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(qC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Pz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};mH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&fH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),fH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=sF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},mH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},vH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=_H(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},_H=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},yH=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return gH(c,r,e),c.xField.cacheInfo?vH(c.xField):c.yField.cacheInfo?vH(c.yField):void 0},bH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],xH=(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])&&bH.forEach((e=>{u(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(SH(s).every((t=>{var e;return!cF("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},SH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},kH={dom:`${pI}_TOOLTIP_HANDLER_DOM`,canvas:`${pI}_TOOLTIP_HANDLER_CANVAS`},AH={key:"其他",value:"..."};var MH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(MH||(MH={}));class wH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(oL.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:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=xH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[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({},AH),t):AH;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!d(e)&&cF(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 TH extends wH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!JC(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const CH=()=>{UO.registerTooltipProcessor("dimension",TH)};class BH extends wH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Vo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(iL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const PH=()=>{UO.registerTooltipProcessor("mark",BH)};class EH extends wH{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 RH=()=>{UO.registerTooltipProcessor("group",EH)};class OH extends $j{constructor(){super(...arguments),this.transformerConstructor=Jj,this.type="line",this.seriesType=aO.line}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}OH.type="line",OH.seriesType=aO.line,OH.transformerConstructor=Jj,U(OH,eH);const IH=[...pz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class LH extends gz{constructor(){super(...arguments),this.type=LH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IH}_getIgnoreAttributes(){return[]}}LH.type="area";const DH=()=>{UO.registerMark(LH.type,LH),XA(),TA(),zP(),OP(),VD(),UO.registerGraphicComponent("area",qg)};class FH extends gF{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")),u(e))return e}return i}}}const zH=Object.assign(Object.assign(Object.assign({},wF),hz),{area:{name:"area",type:"area"}}),jH=()=>{UO.registerAnimation("area",jD),HD(),FD()};class HH extends yz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=WO({},f.style,g.style),l.state=WO({},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 VH extends YF{constructor(){super(...arguments),this.type=aO.area,this.transformerConstructor=HH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(VH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===JD?"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 SO(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",XL.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return SO(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",XL.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[kI]},"normal",XL.Series),this.setMarkStyle(o,{curveType:a},"normal",XL.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(IF(null===(e=UO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),LF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IF(null===(i=UO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),LF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=GF(this);this._symbolMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),LF("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 FH(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(){super.onLayoutEnd(),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}}}VH.type=aO.area,VH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},VH.mark=zH,VH.transformerConstructor=HH,U(VH,cz);class NH extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),zL(t)}}class WH extends $j{constructor(){super(...arguments),this.transformerConstructor=NH,this.type="area",this.seriesType=aO.area}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}WH.type="area",WH.seriesType=aO.area,WH.transformerConstructor=NH,U(WH,eH);function UH(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 GH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:UH(t,e)}),YH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:UH(t,e)}),XH={type:"fadeIn"},$H={type:"growCenterIn"};function KH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XH;case"scaleIn":return $H;default:return GH(t)}}class qH extends MD{constructor(){super(...arguments),this.type=qH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}qH.type="rect";const ZH=()=>{XA(),WA(),PP("rect",LP),UO.registerMark(qH.type,qH),lT.registerBuiltInAnimate("growHeightIn",iC),lT.registerBuiltInAnimate("growHeightOut",sC),lT.registerBuiltInAnimate("growWidthIn",yC),lT.registerBuiltInAnimate("growWidthOut",bC),lT.registerBuiltInAnimate("growCenterIn",QT),lT.registerBuiltInAnimate("growCenterOut",tC),UO.registerGraphicComponent("rect",Bg)},JH=Object.assign(Object.assign({},wF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function QH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=RO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[TF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):SO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):SO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=SO(this._dataToPosX(t),e,i),n=SO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):SO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):SO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=SO(this._dataToPosY(t),e,i),n=SO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},iV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:zF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(iV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",XL.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===n.cartesianBandAxis));let r;if(gL(this._option.dataSet,"addVChartProperty",oF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};gL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:SF.bind(this),call:kF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new bD(this._option,r)}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=PF,s=BF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=CF,s=TF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=NI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)QH(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=SO(this[r](t),l,i),u=SO(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",XL.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",XL.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[SI],n=t[kI],r=t[AI],h=t[MI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[SI]:i,[kI]:s}),a?{[AI]:o,[MI]:l}:void 0),d="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(Bg(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,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=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>SO(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",XL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",XL.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>SO(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",XL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",XL.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=d(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",XL.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",XL.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=GF(this);this._barMark.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),LF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=RO(this._spec.barWidth,a)),l&&(c=Math.max(c,RO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,RO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(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=RO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=qC(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}iV.type=aO.bar,iV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},iV.mark=JH,iV.transformerConstructor=eV;const sV=()=>{Wj(),ZH(),UO.registerAnimation("bar",((t,e)=>({appear:KH(t,e),enter:GH(t,!1),exit:YH(t,!1),disappear:YH(t)}))),Tj(),kj(),UO.registerSeries(iV.type,iV)};class nV extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),zL(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=p(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 rV extends $j{constructor(){super(...arguments),this.transformerConstructor=nV,this.type="bar",this.seriesType=aO.bar}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}rV.type="bar",rV.seriesType=aO.bar,rV.transformerConstructor=nV,U(rV,eH);const aV=[10,20],oV=$C.Linear,lV="circle",hV=$C.Ordinal,cV=["circle","square","triangle","diamond","star"],dV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},uV=Object.assign(Object.assign({},wF),{point:{name:"point",type:"symbol"}});class pV extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class gV extends YF{constructor(){super(...arguments),this.type=aO.scatter,this.transformerConstructor=pV,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(c(e))return e;if(_(e)){if(d(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=`${pI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${pI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:oV,defaultRange:aV},"size")}getShapeAttribute(t,e){return d(e)?lV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:hV,defaultRange:cV},"shape")}initMark(){this._symbolMark=this._createMark(gV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,gV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=GF(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(IF(null===(i=UO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),LF("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:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:lV},KL.STATE_NORMAL,XL.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},KL.STATE_NORMAL,XL.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},KL.STATE_NORMAL,XL.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",XL.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",XL.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},KL.STATE_NORMAL,XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},KL.STATE_NORMAL,XL.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}gV.type=aO.scatter,gV.mark=uV,gV.builtInTheme={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"}}}}},gV.transformerConstructor=pV;const fV=()=>{_z(),UO.registerAnimation("scatter",((t,e)=>Object.assign({appear:dV(0,e)},LD))),Tj(),kj(),UO.registerSeries(gV.type,gV)};class mV extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class vV extends $j{constructor(){super(...arguments),this.transformerConstructor=mV,this.type="scatter",this.seriesType=aO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}vV.type="scatter",vV.seriesType=aO.scatter,vV.transformerConstructor=mV,U(vV,eH);class _V extends WF{constructor(){super(...arguments),this.type=aO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${pI}_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 yV=`${pI}_MAP_LOOK_UP_KEY`,bV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[vI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[yV]=e.nameMap[n]:t[yV]=n})),t.features);class xV extends gF{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 SV extends MD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}SV.type="path";const kV=()=>{UO.registerMark(SV.type,SV),XA(),jA(),UO.registerGraphicComponent("path",Xg)},AV=Object.assign(Object.assign({},wF),{area:{name:"area",type:"path"}});class MV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ta[i]?(wa[i]||(wa[i]=Ba(i,Ta[i])),wa[i]):null}(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 wV{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(){}}class TV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 CV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:wV}:Ny(t)||Wy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:TV}:null}const BV={debounce:yt,throttle:bt};class PV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Ny(this._renderMode)||Wy(this._renderMode),CV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return CV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!xe({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:hL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:hL.chart,consume:!1}];l.on(...c,BV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,BV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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 d(r)&&d(a)?s:xe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:hL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:hL.chart,consume:!1}];l.on(...c,BV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,BV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){CV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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:hL.chart},(t=>{if(!t.event)return;const{event:n}=t;xe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:hL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:hL.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||CV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:hL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:hL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:hL.chart,source:lL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:hL.chart,source:lL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=BV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=BV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:hL.chart})}));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:hL.chart,source:lL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:hL.chart,source:lL.chart},this._handleDragMouseUp)}))}}function EV(t,e){return`${pI}_${e}_${t}`}class RV extends Qz{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=GL.Mark,this._projectionSpec={name:EV(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(d(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:n.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=WO(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(){var t,e,i;this.event.on(oL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 MV(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===aO.map||e.type===aO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),tO(this._regions,(t=>{var e;if(t.type===aO.map||t.type===aO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ve})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==aO.map&&e.type!==aO.pictogram||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[yV],s=t.getDatumCenter(e);i&&u(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=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}RV.type=n.geoCoordinate,U(RV,PV);const OV=()=>{UO.registerComponent(RV.type,RV)};class IV extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class LV extends _V{constructor(){super(...arguments),this.type=aO.map,this.transformerConstructor=IV,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 !`),mL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),gL(this._dataSet,"copyDataView",SL),gL(this._dataSet,"map",bV),gL(this._dataSet,"lookup",rF);const i=mL.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:wL.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:yV,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 bD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(LV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:zF(this._spec,LV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:yI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:yI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",XL.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",XL.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(IF(null===(t=UO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),LF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new xV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[vI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[vI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ve}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ve}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 vI}getActiveMarks(){return[this._pathMark]}}LV.type=aO.map,LV.mark=AV,LV.builtInTheme={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"}}}}},LV.transformerConstructor=IV;const DV=`${pI}_waterfall_default_seriesField`,FV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[PI]=!0:delete t[PI]})),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=zV([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 f=g[0];let{start:m,end:v}=jV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=te(_,e)):(t[c]=+y,y=te(y,e)),t[d]=te(t[c],e),m=te(m,e),b=ee(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=te(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=zV(a,t,n,r,h,l,i,e),r.push(n)})),r};function zV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=jV(t,i,s,n,u);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=te(i.positive,e)):(t[h]=+i.negative,i.negative=te(i.negative,e)),t[c]=te(t[h],e),i.end=te(i.end,e)}i.isTotal=e,(d(p)||p===DV)&&(t[DV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function jV(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&&!d(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?Dy("total.collectCountField error"):n=e[a].start;o<0?Dy("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&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=te(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 HV=(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)=>te(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},VV={type:"fadeIn"},NV={type:"growCenterIn"};function WV(t,e){switch(e){case"fadeIn":return VV;case"scaleIn":return NV;default:return GH(t,!1)}}class UV extends MD{constructor(){super(...arguments),this.type=UV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Mg(t)}}UV.type="rule";const GV=()=>{UO.registerMark(UV.type,UV),XA(),FA(),UO.registerGraphicComponent("line",Mg)},YV=Object.assign(Object.assign({},JH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),XV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:$V(t.map((t=>t.latestData)).flat(),e.fields,i)}};function $V(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)=>$V(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class KV{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 Aa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),gL(e,"dimensionTree",XV),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 qV extends eV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const ZV={rect:sN,symbol:eN,arc:rN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=eN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:aN,line:oN,area:oN,rect3d:sN,arc3d:rN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function JV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=ZV[t])&&void 0!==i?i:ZV.point;return e.series.type===aO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=tN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(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&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:lN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function QV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==aO.sankey){const{formatFunc:t,args:n}=sF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function tN(t){return c(t)?e=>t(e.data):t}function eN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=tN(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:iN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function iN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function sN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=tN(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:nN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function nN(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 rN(t){var e;const{labelSpec:i}=t,s=null!==(e=tN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function aN(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),yg(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 oN(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}))):[{index:0,[yI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function lN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class hN extends iV{constructor(){super(...arguments),this.type=aO.waterfall,this.transformerConstructor=qV,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 KV(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]],d(this._seriesField)&&(this._seriesField=DV)}getSeriesKeys(){return this._seriesField===DV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),gL(this._dataSet,"waterfallFillTotal",HV),gL(this._dataSet,"waterfall",FV),(d(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=kL(this.getViewData(),this._dataSet,{name:`${pI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new bD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:SI,endAs:kI,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=GF(this);this._barMark.setAnimationConfig(IF(null===(i=UO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),LF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("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(){super.initMark();const t=this._createMark(hN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ee(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:ee(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return aN(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?SO(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):SO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",XL.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",XL.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}hN.type=aO.waterfall,hN.mark=YV,hN.builtInTheme={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}}}},hN.transformerConstructor=qV;const cN=()=>{GV(),ZH(),UO.registerAnimation("waterfall",((t,e)=>({appear:WV(t,e),enter:GH(t,!1),exit:YH(t,!1),disappear:YH(t,!1)}))),zD(),Tj(),kj(),UO.registerSeries(hN.type,hN)},dN=`${pI}_BOX_PLOT_OUTLIER_VALUE`;var uN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(uN||(uN={}));const pN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[dN]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class gN extends gF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return this.series.getOutliersField();if(t===uN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case uN.MIN:return this.series.getMinField();case uN.MAX:return this.series.getMaxField();case uN.MEDIAN:return this.series.getMedianField();case uN.Q1:return this.series.getQ1Field();case uN.Q3:return this.series.getQ3Field();case uN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return e[dN];if(t===uN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case uN.MIN:return e[this.series.getMinField()];case uN.MAX:return e[this.series.getMaxField()];case uN.MEDIAN:return e[this.series.getMedianField()];case uN.Q1:return e[this.series.getQ1Field()];case uN.Q3:return e[this.series.getQ3Field()];case uN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[dN])}getDefaultContentList(t){return[{key:this.getContentKey(uN.OUTLIER),value:this.getContentValue(uN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(uN.MAX),value:this.getContentValue(uN.MAX)},{key:this.getContentKey(uN.Q3),value:this.getContentValue(uN.Q3)},{key:this.getContentKey(uN.MEDIAN),value:this.getContentValue(uN.MEDIAN)},{key:this.getContentKey(uN.Q1),value:this.getContentValue(uN.Q1)},{key:this.getContentKey(uN.MIN),value:this.getContentValue(uN.MIN)},{key:this.getContentKey(uN.SERIES_FIELD),value:this.getContentValue(uN.SERIES_FIELD)}]}}class fN extends MD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$L.enter&&t.context.diffState!==$L.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Eg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=UO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const mN=()=>{UO.registerGraphicComponent("glyph",Eg),XA(),EA()},vN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],_N=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class yN extends fN{constructor(){super(...arguments),this.type=yN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=vN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=_N,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}yN.type="boxPlot";const bN=Object.assign(Object.assign({},wF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),xN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},SN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},kN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),AN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,P;if("horizontal"===e){w=null===(r=null===(n=(null===(s=kN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=kN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=kN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=kN(t,"box").attribute.width,i=kN(t,"box").attribute.x;B=i,P=i+e}else{w=null===(m=null===(f=(null===(g=kN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=kN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=kN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=kN(t,"box").attribute.height,i=kN(t,"box").attribute.y;B=i,P=i+e}return k(w)?w:k(B)&&k(P)?(B+P)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},MN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=kN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=kN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=kN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=kN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=kN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=kN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=kN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=kN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=kN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=kN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class wN extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return xN(AN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TN extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return SN(AN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class CN extends wN{computeAttribute(){return xN(MN)(this.target,this.params,this.params.options)}}class BN extends TN{computeAttribute(){return SN(MN)(this.target,this.params,this.params.options)}}class PN extends YF{constructor(){super(...arguments),this.type=aO.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(){this._boxPlotMark=this._createMark(PN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(PN.mark.outlier,{key:vI,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={lineWidth:this._lineWidth,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"};r.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const 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,KL.STATE_NORMAL,XL.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:x(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},KL.STATE_NORMAL,XL.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=>SO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>SO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>SO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>SO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>SO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},KL.STATE_NORMAL,XL.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=>SO(t(this.getDatumPositionValues(e,dN),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>SO(t(this.getDatumPositionValues(e,dN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,KL.STATE_NORMAL,XL.Series)}}initData(){if(super.initData(),!this._data)return;gL(this._dataSet,"foldOutlierData",pN),gL(this._dataSet,"addVChartProperty",oF);const t=new Ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${pI}_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:SF.bind(this),call:kF}},!1),this._outlierDataView=new bD(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(){super.onLayoutEnd(),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=GF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=UO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(LF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IF(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(IF(null===(a=UO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new gN(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]}}PN.type=aO.boxPlot,PN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},PN.mark=bN;const EN=()=>{mN(),FA(),WA(),UO.registerGraphicComponent("line",(t=>Mg(t))),UO.registerGraphicComponent("rect",(t=>Bg(t))),UO.registerMark(yN.type,yN),_z(),FD(),Tj(),kj(),lT.registerBuiltInAnimate("boxplotScaleIn",wN),lT.registerBuiltInAnimate("boxplotScaleOut",TN),lT.registerBuiltInAnimate("barBoxplotScaleIn",CN),lT.registerBuiltInAnimate("barBoxplotScaleOut",BN),UO.registerSeries(PN.type,PN)};class RN extends MD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=RN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Ug(t):yg(t)}}RN.type="text";const ON=()=>{UO.registerMark(RN.type,RN),XA(),ZA(),GA(),UO.registerGraphicComponent("text",yg),UO.registerGraphicComponent("richtext",Ug)};class IN extends gF{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 LN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),DN={type:"fadeIn"},FN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function zN(t,e){return"fadeIn"===e?DN:LN(t)}const jN=Object.assign(Object.assign({},JH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class HN extends eV{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 VN extends iV{constructor(){super(...arguments),this.type=aO.rangeColumn,this._barMarkType="rect",this._barName=aO.bar,this.transformerConstructor=HN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(VN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,VN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(VN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(VN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(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",XL.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=GF(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(IF(null===(i=UO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),LF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IF(null===(n=UO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),LF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new IN(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)}}VN.type=aO.rangeColumn,VN.mark=jN,VN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},VN.transformerConstructor=HN;const NN=()=>{ZH(),ON(),UO.registerAnimation("rangeColumn",((t,e)=>({appear:zN(t,e),enter:LN(t),exit:FN(t),disappear:FN(t)}))),zD(),Tj(),kj(),UO.registerSeries(VN.type,VN)};var WN,UN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(WN||(WN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(UN||(UN={}));class GN extends gF{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 YN=Object.assign({},zH);class XN extends VH{constructor(){super(...arguments),this.type=aO.rangeArea}initMark(){this._areaMark=this._createMark(XN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{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",XL.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",XL.Series),this.setMarkStyle(t,{stroke:!1},"normal",XL.Series))}initTooltip(){this._tooltipHelper=new GN(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))}}XN.type=aO.rangeArea,XN.mark=YN;class $N extends WF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Xz,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(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(d(t)||d(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:[]};qC(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:[]};qC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(oL.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)&&UF(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 KN(t){return Yy(t)?Number.parseFloat(t):0}const qN=(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&&ZN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ue(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(m.forEach(((t,e)=>{const i=t[Fz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[Fz]*t;v(e,k,i),k+=i}))}if(0!==_&&(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},ZN=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===KN(t[e])))||!i&&0===t.reduce(((t,i)=>t+KN(i[e])),0)));function JN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const QN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:JN(t,!0,TL.appear)}),tW={type:"fadeIn"},eW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:JN(t,!0,TL.enter)}),iW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:JN(t,!0,TL.exit)}),sW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:JN(t,!0,TL.exit)});function nW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return tW;case"growRadius":return QN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return QN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class rW extends MD{constructor(t,e){super(t,e),this.type=aW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>oe({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Nz])[t]+s,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 aW extends rW{constructor(){super(...arguments),this.type=aW.type}}aW.type="arc";const oW=()=>{XA(),MA(),PP("arc",VP),lT.registerBuiltInAnimate("growRadiusIn",mC),lT.registerBuiltInAnimate("growRadiusOut",vC),lT.registerBuiltInAnimate("growAngleIn",ZT),lT.registerBuiltInAnimate("growAngleOut",JT),UO.registerGraphicComponent("arc",Qg),UO.registerMark(aW.type,aW)},lW=Object.assign(Object.assign({},wF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class hW extends NF{_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=WO({},this._theme,i,t);const n=(t,e)=>WO({},"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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const cW=`${pI}_LABEL_VISIBLE`;class dW extends $N{constructor(){super(...arguments),this.transformerConstructor=hW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:TO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:TO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Gz,this._endAngle=Yz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Nz];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return oe(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=u(t),r=u(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}}(u(this._spec.startAngle)?ne(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ne(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ne(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;gL(this._dataSet,"pie",qN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ne(this._spec.minAngle):0,asStartAngle:jz,asEndAngle:Hz,asRatio:zz,asMiddleAngle:Nz,asRadian:Uz,asQuadrant:Wz,asK:Vz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ma(this._dataSet,{name:`${pI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new bD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},dW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:_I,groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return sO(jz)(t)}endAngleScale(t){return sO(Hz)(t)}_computeLayoutRadius(){return $z((()=>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:kO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:kO(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",XL.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",XL.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,XL.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",XL.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:sO(cW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(oL.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*(d(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[Nz];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return oe(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===TL.appear)return this._startAngle;if(i===TL.disappear)return this._endAngle;const r=[TL.disappear,TL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[vI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[vI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Nz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Nz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Nz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Nz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IF(null===(i=UO.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]}}dW.transformerConstructor=hW,dW.mark=lW,dW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class uW extends dW{constructor(){super(...arguments),this.type=aO.pie}}uW.type=aO.pie;const pW=()=>{oW(),UO.registerAnimation("pie",((t,e)=>({appear:nW(t,e),enter:eW(t),exit:iW(t),disappear:sW(t)}))),UO.registerAnimation("emptyCircle",((t,e)=>({appear:nW(t,e)}))),UO.registerSeries(uW.type,uW)};function gW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const fW=t=>({type:gW(t.growField),options:{overall:!0}}),mW={type:"fadeIn"},vW=t=>({type:gW(t.growField)}),_W=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},yW=_W;function bW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mW;case"growAngle":return fW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return fW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class xW extends $N{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(kI),this.setInnerRadiusField(SI)}setValueFieldToPercent(){this.setRadiusField(MI),this.setInnerRadiusField(AI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const SW=Object.assign(Object.assign({},wF),{rose:{name:"rose",type:"arc"}});class kW extends NF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class AW extends rj{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=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,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:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,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(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=UO.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=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=GL.Axis,this._tick=void 0,this._center=null,this._startAngle=Gz,this._endAngle=Yz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),tO(this._regions,(t=>{"radius"===this.getOrient()?Lz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Lz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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:TO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:TO(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=ne(this._spec.startAngle),this._endAngle=ne(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Pz(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(){tO(this._regions,(t=>{"radius"===this.getOrient()?Lz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Lz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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 qC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:qC(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 oe(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return le(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=>Iz(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",scale:this._scale});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=se.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",scale:this._scale.clone()});(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(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return $z((()=>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=Xz,e=0;const i=this.getChart().getSpec();return tO(this.getRegions(),(s=>{const n=s;if(r=n.type,[aO.rose,aO.radar,aO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(WO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(WO({},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)}}AW.type=n.polarAxis,AW.specKey="axes";const MW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},wW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class TW extends AW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new HB}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 gL(this._option.dataSet,t,KB),t}}TW.type=n.polarLinearAxis,TW.specKey="axes",TW.builtInTheme={axis:xj,axisLinear:_j,axisAngle:wW,axisRadius:MW},U(TW,vj);const CW=()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),UO.registerGraphicComponent(tj.circleAxis,((t,e)=>new WC(t,e))),UO.registerGraphicComponent(ej.circleAxisGrid,((t,e)=>new KP(t,e))),aj(),UO.registerComponent(TW.type,TW)};class BW extends AW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new yB}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 gL(this._option.dataSet,t,sP),t}transformScaleDomain(){}}BW.type=n.polarBandAxis,BW.specKey="axes",BW.builtInTheme={axis:xj,axisBand:Mj,axisAngle:wW,axisRadius:MW},U(BW,Aj);const PW=()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),UO.registerGraphicComponent(tj.circleAxis,((t,e)=>new WC(t,e))),UO.registerGraphicComponent(ej.circleAxisGrid,((t,e)=>new KP(t,e))),aj(),UO.registerComponent(BW.type,BW)};class EW extends xW{constructor(){super(...arguments),this.type=aO.rose,this.transformerConstructor=kW,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(){this._roseMark=this._createMark(EW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:zF(this._spec,EW.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=>SO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=SO(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(IF(null===(i=UO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),LF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}EW.type=aO.rose,EW.mark=SW,EW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},EW.transformerConstructor=kW;const RW=()=>{UO.registerSeries(EW.type,EW),oW(),UO.registerAnimation("rose",((t,e)=>({appear:bW(t,e),enter:vW(t),exit:_W(t),disappear:yW(t)}))),PW(),CW()};class OW extends yT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:oe(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=le(this.from,this._prevCenter),{angle:i,radius:s}=le(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,GR(this._fromAngle,this._toAngle)&&GR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=oe({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IW extends NT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!QR(t)&&!QR(e))return e;const s=le(t,this._prevCenter),n=le(e,this._center);let r=ce(s.angle),a=ce(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return oe({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 ie(s,n,r,a);return o.defined=e.defined,o}}const LW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function DW(t,e,i){return"fadeIn"===e?LW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function FW(t,e,i){return"fadeIn"===e?LW(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 zW=(t,e)=>({custom:HT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),jW=Object.assign(Object.assign(Object.assign({},wF),hz),{area:{name:"area",type:"area"}});class HW extends xW{constructor(){super(...arguments),this.type=aO.radar,this.transformerConstructor=yz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(HW.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:QD,closePath:!0},"normal",XL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",XL.Series),this.event.on(oL.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:u(this._spec.startAngle)?ne(this._spec.startAngle):Gz},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(IF(null===(s=UO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),LF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=UO.getAnimationInKey(e);t.setAnimationConfig(IF(null==i?void 0:i(n,r),LF(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&&_(a)?a[0]:a}}}HW.type=aO.radar,HW.mark=jW,HW.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},HW.transformerConstructor=yz,U(HW,cz);const VW=()=>{UO.registerSeries(HW.type,HW),DH(),mz(),_z(),UO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:DW(t,e,"in"),enter:DW(t,e,"in"),exit:DW(t,e,"out"),disappear:"clipIn"===e?void 0:DW(t,e,"out"),update:[{channel:["points","center"],custom:IW,customParameters:t,duration:ID.update.duration,easing:ID.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),UO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:FW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:FW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:OW,customParameters:t,duration:ID.update.duration,easing:ID.update.easing}]}))),UO.registerAnimation("radarGroup",((t,e)=>({appear:zW(t,"in"),disappear:zW(t,"out")}))),MA(),PW(),CW()};class NW extends gF{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=>pi.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 WW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(pI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[vI]:r,[_I]:`${s}_${e}`})),r++}))})),n},UW={fill:"#bbb",fillOpacity:.2},GW=Object.assign(Object.assign({},wF),{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 YW extends YF{constructor(){super(...arguments),this.type=aO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),gL(this._option.dataSet,"objFlat",WW),gL(this._option.dataSet,"copyDataView",SL),fL(this._option.dataSet,"dataview",xa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:wL.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(WO(UW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(YW.mark.group),this._containerMark=this._createMark(YW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(YW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(YW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(YW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(YW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(YW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(YW.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",XL.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",XL.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",XL.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",XL.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",XL.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",XL.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",XL.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",XL.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",XL.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:yI}}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 yO).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:yI}}initTooltip(){this._tooltipHelper=new NW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}YW.type=aO.dot,YW.mark=GW,YW.builtInTheme={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"}}}}};class XW extends gF{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=>pi.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 $W=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),KW=(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 qW extends YF{constructor(){super(...arguments),this.type=aO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),gL(this._option.dataSet,"linkDotInfo",KW),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:wL.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(qW.mark.group),this._containerMark=this._createMark(qW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(qW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(qW.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",XL.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",XL.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",XL.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",XL.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:yI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new XW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}qW.type=aO.link,qW.mark=$W,qW.builtInTheme={link:{arrow:{style:{size:10}}}};const ZW=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"}});class JW extends $N{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()?SI:DI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle);let o;if(u(s)){const t=at(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 d(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()?kI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle),o=at(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=u(n)?ne(n):Gz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ne(r):Yz,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)||u(null==s?void 0:s.startAngle)||u(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=SO(this.angleAxisHelper.dataToPosition([t[SI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=SO(this.angleAxisHelper.dataToPosition([t[kI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?SO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(JW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",XL.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ne(a),o=ne(r)/2;return Qg(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Bg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 iU=()=>{UO.registerAnimation("circularProgress",((t,e)=>({appear:eU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class sU extends NF{constructor(){super(...arguments),this._supportStack=!0}}class nU extends JW{constructor(){super(...arguments),this.type=aO.circularProgress,this.transformerConstructor=sU,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(k(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(k(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(){return this._progressMark=this._createMark(nU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:zF(this._spec,"progress")}),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",XL.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(nU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?SI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?kI: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",XL.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(IF(null===(i=UO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),LF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}nU.type=aO.circularProgress,nU.mark=QW,nU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},nU.transformerConstructor=sU;const rU=()=>{UO.registerSeries(nU.type,nU),oW(),iU(),zD(),PW(),CW()};function aU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const oU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:aU(t)}),lU={type:"fadeIn"};function hU(t,e="grow"){return!1===e?{}:"fadeIn"===e?lU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:aU(t)}))(t)}class cU extends gF{enableByType(t){return"dimension"!==t}}const dU=Object.assign(Object.assign({},wF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class uU extends YF{constructor(){super(...arguments),this.type=aO.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=u(e.width)?e.width:e.x1-e.x,o=u(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;return this._progressMark=this._createMark(uU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape: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 SO(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 SO(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?SO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",XL.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 SO(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 SO(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,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?SO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",XL.Series)}}_initTrackMark(){return this._trackMark=this._createMark(uU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return SO(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",XL.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return SO(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",XL.Series))}getInteractionTriggers(){const t=[];return 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(IF(null===(i=UO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),LF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),LF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new cU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}uU.type=aO.linearProgress,uU.mark=dU,uU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const pU=()=>{ZH(),UO.registerAnimation("linearProgress",((t,e)=>({appear:hU(t,e),enter:hU(t),disappear:oU(t)}))),zD(),UO.registerSeries(uU.type,uU)},gU=[0],fU=[20,40],mU=[200,500],vU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},_U=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],yU=`${pI}_WORD_CLOUD_TEXT`,bU=Object.assign(Object.assign({},wF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),xU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class SU extends WF{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){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=fU}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:mU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:gU,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)?yU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:vU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Vy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:gU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!_U.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;this._wordMark=this._createMark(SU.mark.word,{key:_I,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(SU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:GL.Mark-1}))}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",XL.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",XL.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",XL.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(IF(UO.getAnimationInKey("wordCloud")(n,s),LF("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 yO).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:yI])}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 HB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new HB).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[vI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,oL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:_I,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:hf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:Fg,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(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:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}SU.mark=bU,SU.builtInTheme={wordCloud:xU};function kU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ID.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;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===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=AU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},MU=(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=MU(t.children,e,t,n))})),s},wU=(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=wU(t.children,e,t,n)),n=e(t,s,i,n)})),n},TU=(t,e=[],i)=>{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):TU(t.children,e,i)))})),e};function CU(t,e){let i,s;if(EU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function EU(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*B,y:n+A+M*B,radius:B}}function LU(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 DU(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 FU(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 zU(t){return{_:t,next:null,prev:null}}function jU(t,e){const i=(t=G(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];LU(n,s,r);let a,o,l,h,c,d,u,p=zU(s),g=zU(n),f=zU(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=AU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:WU.defaultOpionts.nodeSort;MU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)MU([o],HU(h)),wU([o],VU(this._getPadding,.5,a)),MU([o],NU(1,this._maxDepth));else{const t=Math.min(s.width,s.height);MU([o],HU(WU.defaultOpionts.setRadius)),wU([o],VU(Pt,1,a)),d&&wU([o],VU(this._getPadding,o.radius/t,a)),MU([o],NU(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}WU.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const UU=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=UU(t.children):t.value=0),e+=Math.abs(t.value)})),e};function GU(t){return t.depth}function YU(t,e){return e-1-t.endDepth}const XU=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),$U=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},KU={left:GU,right:YU,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?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:GU,end:YU},qU=vt(0,1);class ZU{constructor(t){this._ascendingSourceBreadth=(t,e)=>XU(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>XU(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},ZU.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._logger=nt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):KU[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===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=[];UU(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=d(t.value)?0:kt(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=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=kt(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=!d(r.source),l=!d(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&&d(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=[$U(s[t.source]),$U(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=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,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*qU(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)}d(this.options.nodeSortBy)&&n.sort(XU),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(XU),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];JU(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QU);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},tG.defaultOpionts,t):Object.assign({},tG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Bt(t,n))):Bt(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Bt(t,n))):Bt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Bt(r,n),i=(u-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-(_(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=AU(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=oe({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)}}}function eG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:JU,slice:eG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?eG:JU)(t,e,i,s,n)}};class nG{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=_(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=_(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=_(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=_(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({},nG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Ct(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?iG(this.options.aspectRatio):null!==(e=sG[this.options.splitType])&&void 0!==e?e:sG.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=AU(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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function rG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+oi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return nt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=rG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Mi(o.map(Mi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rAt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=aG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&nt.getInstance().error("Area "+r+" not represented on screen")}return i}function pG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ci((function(i){return-1*gG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},mG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:G(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||lG,s=e.lossFunction||oG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];li(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rse.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:fG(l),arcs:l})}))},vG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:_G,triangle:_G,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 _G(){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 yG(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 bG=t=>vG[t]?vG[t]():vG.circle(),xG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function SG(t){return c(t)?t:function(){return t}}class kG{constructor(t){var e,i;switch(this.options=z({},kG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=bG(this.options.shape),this.getText=null!==(e=SG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=SG(this.options.fontWeight),this.getTextFontSize=SG(this.options.fontSize),this.getTextFontStyle=SG(this.options.fontStyle),this.getTextFontFamily=SG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>xG(10,50);break;case"random-light":this.getTextColor=()=>xG(50,90);break;default:this.getTextColor=SG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return ne(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():At(e);return ne(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&&!d(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 MG extends kG{constructor(t){var e;super(z({},MG.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<=MG.defaultOptions.minFontSize&&(this.options.minFontSize=MG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=AG[this.options.spiral])&&void 0!==e?e:AG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=SG(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}=yG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(BG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}BG(p,this._size)&&(p=PG(p,this._size))}else if(BG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||TG(p,i))&&(!i||!wG(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 wG(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 TG(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,BG=(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 PG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},RG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>oe(t,e,i+r*n)))},OG=(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()},IG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=yG(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=bG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return oe(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)OG(n,RG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)OG(n,RG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)OG(n,RG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)OG(n,RG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)OG(n,RG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=RG({x:l,y:h},o,-Math.PI/2,5),e=RG({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]);OG(n,i)}else n.fillRect(0,0,i,s)}; +function t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 w=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function P(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var E=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(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];!u(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,s=!1,n=!1){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(y(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=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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(!N(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(!N(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;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 tt(t){return Number(t)}const et="undefined"!=typeof console;function it(t,e,i){const s=[e].concat([].slice.call(i));et&&console[t].apply(console,s)}var st;!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"}(st||(st={}));class nt{static getInstance(t,e){return nt._instance&&x(t)?nt._instance.level(t):nt._instance||(nt._instance=new nt(t,e)),nt._instance}static setInstance(t){return nt._instance=t}static setInstanceLevel(t){nt._instance?nt._instance.level(t):nt._instance=new nt(t)}static clearInstance(){nt._instance=null}constructor(t=st.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=st.Info}canLogDebug(){return this._level>=st.Debug}canLogError(){return this._level>=st.Error}canLogWarn(){return this._level>=st.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=st.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):it(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=st.Warn&&it(this._method||"warn","WARN",t),this}info(...t){return this._level>=st.Info&&it(this._method||"log","INFO",t),this}debug(...t){return this._level>=st.Debug&&it(this._method||"log","DEBUG",t),this}}function rt(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(t[n],e)>0?s=n:i=n+1}return i}nt._instance=null;const at=(t,e)=>ot(0,t.length,(i=>e(t[i]))),ot=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},lt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(Q)),function(t,e,i=tt){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)},ht=1e-10,ct=1e-10;function dt(t,e,i=ct,s=ht){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ut(t,e,i,s){return t>e&&!dt(t,e,i,s)}function pt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ft=function(t,e,i){return ti?i:t};var mt=(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 vt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let _t=!1;try{_t="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){_t=!1}function yt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const g=!e&&0!==e&&_t;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 g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function bt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),yt(t,e,{leading:s,trailing:n,maxWait:e})}function xt(t,e){return i=>t*(1-i)+e*i}function St(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function At(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}_t=!1;const Mt=4294967296;const wt=t=>e=>E(e,t),Tt=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||wt)(i)},Ct=(t,e={})=>{if(_(t)){const i=t.map((t=>Tt(t,e)));return t=>i.map((e=>e(t)))}return Tt(t,e)},Bt=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Et=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!d(n)&&(n=+n)>=n&&!d(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Lt=1e-12,Dt=Math.PI,Ft=Dt/2,zt=2*Dt,jt=2*Math.PI,Ht=Math.abs,Vt=Math.atan2,Nt=Math.cos,Wt=Math.max,Ut=Math.min,Gt=Math.sin,Yt=Math.sqrt,Xt=Math.pow;function $t(t){return t>=1?Ft:t<=-1?-Ft:Math.asin(t)}function Kt(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 qt(t,e){return t[0]*e[1]-t[1]*e[0]}function Zt(t,e){let i=0;for(let s=0;s0?i:0}function te(t,e){return Jt(t+e,10**Math.max(Qt(t),Qt(e)))}function ee(t,e){return Jt(t-e,10**Math.max(Qt(t),Qt(e)))}class ie{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ie(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 se{static distancePP(t,e){return Yt(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Yt(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return Yt(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new ie((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ne(t){return t*(Math.PI/180)}function re(t){return 180*t/Math.PI}const ae=(t=0)=>{if(t<0)for(;t<-zt;)t+=zt;else if(t>0)for(;t>zt;)t-=zt;return t};function oe(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 le(t,e={x:0,y:0},i=0,s=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 he(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ce(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function de(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=ce(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 ue(t){return(t=ce(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 pe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ge(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 me(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}=_e(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 ve;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ve||(ve={}));const _e=(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 ye(t,e,i){if(!t||!e)return ve.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=_e(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 Se(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Ae(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Me(t,e){const i=e?ne(t.angle):t.angle,s=Ae(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Me(t,i),n=Me(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Ae(t),Ae(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ne(t.angle):t.angle;let u=i?ne(90-t.angle):t.angle+Ft;const p=i?ne(e.angle):e.angle;let g=i?ne(90-e.angle):e.angle+Ft;u>jt&&(u-=jt),g>jt&&(g-=jt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Se(n,i)+Se(n,s))/2>Se(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Te=1e-8;function Ce(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Ee(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Oe(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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(v(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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const Le=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),De=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Fe(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 je extends ze{}class He extends ze{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new He(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ve{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ve,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 Ve;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ve(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=re(r.rotateDeg),r}}class Ne{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 We(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 Ue(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 Ge=/^#([0-9a-f]{3,8})$/,Ye={transparent:4294967040},Xe={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 $e(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ke(t){return x(t)?new ti(t>>16,t>>8&255,255&t,1):_(t)?new ti(t[0],t[1],t[2]):new ti(255,255,255)}function qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ze(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Je=(t,e)=>{const i=Ge.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ti((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ke(t):8===e?new ti(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Qe{static Brighter(t,e=1){return 1===e?t:new Qe(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Qe(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Qe?t:new Qe(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Ye[t]))return function(t){return x(t)?new ti(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ti(t[0],t[1],t[2],t[3]):new ti(255,255,255,1)}(Ye[t]);if(u(Xe[t]))return Ke(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Je(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 ti(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ti(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Qe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ti(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=Ue(this.color.r,this.color.g,this.color.b),r=We(d(t)?n.h:ft(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ti(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Je(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Qe(this.color.toString())}copyGammaToLinear(t,e=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,e=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=qe(t.color.r),this.color.g=qe(t.color.g),this.color.b=qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ti{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${$e(this.r)+$e(this.g)+$e(this.b)+(1===this.opacity?"":$e(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}=Ue(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ei(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 ti(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:Ue});function si(t){if(k(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(p(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 ni(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ri(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 ai(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}const oi=1e-10;function li(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+oi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=ui(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=se.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=hi(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-oi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function hi(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ci(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return hi(t,t-(i*i-e*e+t*t)/(2*i))+hi(e,s)}function di(t,e){const i=se.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function ui(t){const e={x:0,y:0};for(let i=0;ithis.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 fi;function mi(t,e){const i=gi(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 vi{constructor(t={}){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 _i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function yi(t){let e;if(e=_i.exec(t))return new vi({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]});nt.getInstance().error("invalid format: "+t)}const bi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class xi{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 xi.instance||(xi.instance=new xi),xi.instance}newFormat(t){const e=yi(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"):Si[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=Si[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:_,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)?m: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?bi[8+fi/3]:"")+k+(t&&"("===n?")":""),f)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=yi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=gi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=bi[8+n/3];return function(t){return s(r*t)+a}}}const Si={"%":(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)=>mi(100*t,e),r:mi,s:function(t,e){const i=gi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(fi=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")+gi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ti(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ti(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Zt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Zi=Math.sqrt,Ji=Math.tan;function Qi(t){return t>1?0:t<-1?Di:Math.acos(t)}function ts(t){return t>1?Fi:t<-1?-Fi:Math.asin(t)}function es(){}function is(t,e){t&&ns.hasOwnProperty(t.type)&&ns[t.type](t,e)}var ss={Feature:function(t,e){is(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sDi?t+Math.round(-t/ji)*ji:t,e]}function vs(t,e,i){return(t%=ji)?e||i?fs(ys(t),bs(e,i)):ys(t):e||i?bs(e,i):ms}function _s(t){return function(e,i){return[(e+=t)>Di?e-ji:e<-Di?e+ji:e,i]}}function ys(t){var e=_s(t);return e.invert=_s(-t),e}function bs(t,e){var i=Gi(t),s=Ki(t),n=Gi(e),r=Ki(e);function a(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*i+o*s;return[Ui(l*n-c*r,o*i-h*s),ts(c*n+l*r)]}return a.invert=function(t,e){var a=Gi(e),o=Gi(t)*a,l=Ki(t)*a,h=Ki(e),c=h*n-l*r;return[Ui(l*n+h*r,o*i+c*s),ts(c*i-o*s)]},a}function xs(t,e){(e=hs(e))[0]-=t,gs(e);var i=Qi(-e[1]);return((-e[2]<0?-i:i)+ji-Li)%ji}function Ss(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:es,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ni(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ss(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=Ki(s),r=[Ki(i),-Gi(i),0],a=0,o=0;Bs.reset(),1===n?s=Fi+Li:-1===n&&(s=-Fi-Li);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Di,T=f*x;if(Bs.add(Ui(T*A*Ki(M),m*S+T*Gi(M))),a+=w?k+A*ji:k,w^p>=i^y>=i){var C=ds(hs(u),hs(_));gs(C);var B=ds(r,C);gs(B);var P=(w^k>=0?-1:1)*ts(B[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Li||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(Is))}return u}}function Is(t){return t.length>1}function Ls(t,e){return((t=t.x)[0]<0?t[1]-Fi-Li:Fi-t[1])-((e=e.x)[0]<0?e[1]-Fi-Li:Fi-e[1])}1===(Ts=Es).length&&(Cs=Ts,Ts=function(t,e){return Es(Cs(t),e)});var Ds=Os((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?Di:-Di,l=Ni(r-i);Ni(l-Di)0?Fi:-Fi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Di&&(Ni(i-n)Li?Wi((Ki(e)*(r=Gi(s))*Ki(i)-Ki(s)*(n=Gi(e))*Ki(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*Fi,s.point(-Di,n),s.point(0,n),s.point(Di,n),s.point(Di,0),s.point(Di,-n),s.point(0,-n),s.point(-Di,-n),s.point(-Di,0),s.point(-Di,n);else if(Ni(t[0]-e[0])>Li){var r=t[0]0,n=Ni(e)>Li;function r(t,i){return Gi(t)*Gi(i)>e}function a(t,i,s){var n=[1,0,0],r=ds(hs(t),hs(i)),a=cs(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ds(n,r),u=ps(n,h);us(u,ps(r,c));var p=d,g=cs(u,p),f=cs(p,p),m=g*g-f*(cs(u,u)-1);if(!(m<0)){var v=Zi(m),_=ps(p,(-g-v)/f);if(us(_,u),_=ls(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ni(_[0]-b)Di^(b<=_[0]&&_[0]<=x)){var w=ps(p,(-g+v)/f);return us(w,u),[_,ls(w)]}}}function o(e,i){var n=s?t:Di-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Di:-Di),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Gi(e),o=Ki(e),l=s*i;null==n?(n=e+s*ji,r=e-l/2):(n=xs(a,n),r=xs(a,r),(s>0?nr)&&(n+=s*ji));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 Ni(s[0]-t)0?0:3:Ni(s[0]-i)0?2:1:Ni(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,f,m,v,_,y=a,b=Ss(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ms(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&&m)y.point(r,a);else{var l=[g=Math.max(js,Math.min(zs,g)),f=Math.max(js,Math.min(zs,f))],b=[r=Math.max(js,Math.min(zs,r)),a=Math.max(js,Math.min(zs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Vs(t){return t}var Ns,Ws,Us,Gs,Ys=Ei(),Xs=Ei(),$s={point:es,lineStart:es,lineEnd:es,polygonStart:function(){$s.lineStart=Ks,$s.lineEnd=Js},polygonEnd:function(){$s.lineStart=$s.lineEnd=$s.point=es,Ys.add(Ni(Xs)),Xs.reset()},result:function(){var t=Ys/2;return Ys.reset(),t}};function Ks(){$s.point=qs}function qs(t,e){$s.point=Zs,Ns=Us=t,Ws=Gs=e}function Zs(t,e){Xs.add(Gs*t-Us*e),Us=t,Gs=e}function Js(){Zs(Ns,Ws)}var Qs=$s,tn=1/0,en=tn,sn=-tn,nn=sn;var rn,an,on,ln,hn={point:function(t,e){tsn&&(sn=t);enn&&(nn=e)},lineStart:es,lineEnd:es,polygonStart:es,polygonEnd:es,result:function(){var t=[[tn,en],[sn,nn]];return sn=nn=-(en=tn=1/0),t}},cn=0,dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn={point:bn,lineStart:xn,lineEnd:An,polygonStart:function(){yn.lineStart=Mn,yn.lineEnd=wn},polygonEnd:function(){yn.point=bn,yn.lineStart=xn,yn.lineEnd=An},result:function(){var t=_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:un?[cn/un,dn/un]:[NaN,NaN];return cn=dn=un=pn=gn=fn=mn=vn=_n=0,t}};function bn(t,e){cn+=t,dn+=e,++un}function xn(){yn.point=Sn}function Sn(t,e){yn.point=kn,bn(on=t,ln=e)}function kn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,bn(on=t,ln=e)}function An(){yn.point=bn}function Mn(){yn.point=Tn}function wn(){Cn(rn,an)}function Tn(t,e){yn.point=Cn,bn(rn=on=t,an=ln=e)}function Cn(t,e){var i=t-on,s=e-ln,n=Zi(i*i+s*s);pn+=n*(on+t)/2,gn+=n*(ln+e)/2,fn+=n,mn+=(n=ln*t-on*e)*(on+t),vn+=n*(ln+e),_n+=3*n,bn(on=t,ln=e)}var Bn=yn;function Pn(t){this._context=t}Pn.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,ji)}},result:es};var En,Rn,On,In,Ln,Dn=Ei(),Fn={point:es,lineStart:function(){Fn.point=zn},lineEnd:function(){En&&jn(Rn,On),Fn.point=es},polygonStart:function(){En=!0},polygonEnd:function(){En=null},result:function(){var t=+Dn;return Dn.reset(),t}};function zn(t,e){Fn.point=jn,Rn=In=t,On=Ln=e}function jn(t,e){In-=t,Ln-=e,Dn.add(Zi(In*In+Ln*Ln)),In=t,Ln=e}var Hn=Fn;function Vn(){this._string=[]}function Nn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),os(t,i(s))),s.result()}return r.area=function(t){return os(t,i(Qs)),Qs.result()},r.measure=function(t){return os(t,i(Hn)),Hn.result()},r.bounds=function(t){return os(t,i(hn)),hn.result()},r.centroid=function(t){return os(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Vs):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Vn):new Pn(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 Un(t){return function(e){var i=new Gn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Gn(){}function Yn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),os(i,t.stream(hn)),e(hn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return Yn(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 $n(t,e,i){return Xn(t,[[0,0],e],i)}function Kn(t,e,i){return Yn(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 qn(t,e,i){return Yn(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)}Vn.prototype={_radius:4.5,_circle:Nn(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=Nn(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}},Gn.prototype={constructor:Gn,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 Zn=16,Jn=Gi(30*Vi);function Qn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Zi(b*b+x*x+S*S),A=ts(S/=k),M=Ni(Ni(S)-1)e||Ni((v*B+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Vi:0,B()):[m*Hi,v*Hi,_*Hi]},T.angle=function(t){return arguments.length?(y=t%360*Vi,B()):y*Hi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=Qn(o,w=t*t),P()):Zi(w)},T.fitExtent=function(t,e){return Xn(T,t,e)},T.fitSize=function(t,e){return $n(T,t,e)},T.fitWidth=function(t,e){return Kn(T,t,e)},T.fitHeight=function(t,e){return qn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function rr(t){var e=0,i=Di/3,s=nr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Vi,i=t[1]*Vi):[e*Hi,i*Hi]},n}function ar(t,e){var i=Ki(t),s=(i+Ki(e))/2;if(Ni(s)2?t[2]*Vi:0),e.invert=function(e){return(e=t.invert(e[0]*Vi,e[1]*Vi))[0]*=Hi,e[1]*=Hi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===pr?[[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 fr(t){return Ji((Fi+t)/2)}function mr(t,e){var i=Gi(t),s=t===e?Ki(t):Xi(i/Gi(e))/Xi(fr(e)/fr(t)),n=i*$i(fr(t),s)/s;if(!s)return pr;function r(t,e){n>0?e<-Fi+Li&&(e=-Fi+Li):e>Fi-Li&&(e=Fi-Li);var i=n/$i(fr(e),s);return[i*Ki(s*t),n-i*Gi(s*t)]}return r.invert=function(t,e){var i=n-e,r=qi(s)*Zi(t*t+i*i),a=Ui(t,Ni(i))*qi(i);return i*s<0&&(a-=Di*qi(t)*qi(i)),[a/s,2*Wi($i(n/r,1/s))-Fi]},r}function vr(t,e){return[t,e]}function _r(t,e){var i=Gi(t),s=t===e?Ki(t):(i-Gi(e))/(e-t),n=i/s+t;if(Ni(s)Li&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Tr.invert=cr(ts),Cr.invert=cr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi(Yi(t))-Fi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Lr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Lr(t.slice(0,s),e),o=Lr(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},Dr=Lr;!function(t){var e=Dr;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;r{const i=zr(Vr,e),{tolerance:s}=i;return Fr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Ur=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Kr(e,6):Kr(e,4))+"-"+Kr(t.getUTCMonth()+1,2)+"-"+Kr(t.getUTCDate(),2)+(r?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"."+Kr(r,3)+"Z":n?"T"+Kr(i,2)+":"+Kr(s,2)+":"+Kr(n,2)+"Z":s||i?"T"+Kr(i,2)+":"+Kr(s,2)+"Z":"")}function Zr(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 Yr;if(h)return h=!1,Gr;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(;a0}function la(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=ea(t));var r=[];switch(t.type){case"GeometryCollection":return ha(t,(function(t){da(t,s)})),t;case"FeatureCollection":return la(t,(function(t){la(da(t,s),(function(t){r.push(t)}))})),ai(r)}return da(t,s)}function da(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ha(t,(function(t){da(t,e)})),t;case"LineString":return ua(aa(t),e),t;case"Polygon":return pa(aa(t),e),t;case"MultiLineString":return aa(t).forEach((function(t){ua(t,e)})),t;case"MultiPolygon":return aa(t).forEach((function(t){pa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ua(t,e){oa(t)===e&&t.reverse()}function pa(t,e){oa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ga(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},_a=(t,e={},i)=>{i.type=Wr.GEO;const s=zr(ma,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(va(t))})):e.push(va(t))})),e})(t);let l=t.features;return o&&(l=ca(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=fa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=fa.bounds(t);t.bbox=e}})),t.features=l,t},ya={},ba=(t,e,i)=>{i.type=Wr.GEO;const s=zr(ma,ya,e),{object:n}=s;if(!v(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 Er(a,t)}))}:Er(a,o));var a,o;return _a(r,s,i)},xa=(t,e,i)=>{const s=!h(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 Sa=0;function ka(t="dataset"){return Sa>1e8&&(Sa=0),t+"_"+Sa++}class Aa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:ka("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:nt.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()}}class Ma{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ma||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ur),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ta={albers:lr,albersusa:function(){var t,e,i,s,n,r,a=lr(),o=or().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=or().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)}},Ca=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ca.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class Ea{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",La="inversify:tagged",Da="inversify:paramtypes";class Fa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var za=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 ja(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};za.hasOwnMetadata(t,e)&&(r=za.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,za.defineMetadata(t,r,e)}(La,t,i.toString(),s)}function Ha(t){return(e,i,s)=>{ja(e,0,s,t)}}function Va(t){return e=>(i,s,n)=>Ha(new Fa(t,e))(i,s,n)}const Na=Va(Oa),Wa=Va(Ia);function Ua(){return function(t){return za.defineMetadata(Da,null,t),t}}function Ga(t){return Ha(new Fa(Ra,t))}const Ya="Singleton",Xa="Transient",$a="ConstantValue",Ka="DynamicValue",qa="Factory",Za="Function",Ja="Instance",Qa="Invalid";class to{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Qa,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new to(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ya&&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 eo{getConstructorMetadata(t){return{compilerGeneratedMetadata:za.getMetadata(Da,t),userGeneratedMetadata:za.getMetadata(La,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const io=(so=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===so&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const ao=Symbol("ContributionProvider");class oo{constructor(t,e){this.serviceIdentifier=t,this.container=e,ho.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function lo(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).inSingletonScope().whenTargetNamed(e)}class ho{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ho.store=new Map;class co{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 uo extends co{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const po=Symbol.for("EnvContribution"),go=Symbol.for("VGlobal"),fo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new eo}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new to(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ro(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case $a:case Za: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===Ya&&(t.cache=e,t.activated=!0)}},mo=Symbol.for("RenderService");const vo=new class{get renderService(){return this._renderService||(this._renderService=fo.get(mo)),this._renderService}};let _o=0;class yo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=vo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++_o,t),this.tryRunAnimationFrameNextFrame(),_o}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class bo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var xo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ko=function(t,e){return function(i,s){e(i,s,t)}},Ao=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 Mo=class extends bo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new uo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new yo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ao(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var wo,To,Co,Bo;Mo=xo([Ua(),ko(0,Na(ao)),ko(0,Ga(po)),So("design:paramtypes",[Object])],Mo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(To||(To={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Bo||(Bo={}));const Po=zt-1e-8;class Eo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Po)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%=zt)<0&&(s+=zt),(n%=zt)<0&&(n+=zt),nn;++o,a-=Ft)g(a);else for(a=s-s%Ft+Ft,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Oo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Io={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 Do,Fo,zo,jo,Ho,Vo;var No,Wo,Uo,Go,Yo,Xo;function $o(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,k=i+m,A=S+y*m,M=k-y*f;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 Ko(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ne(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=zt:C>0&&0===r&&(C-=zt);const B=Math.ceil(Math.abs(C/(Ft+.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 Zo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=nl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function al(t,e){const{p0:i,p1:s}=t,n=se.pointAtPP(i,s,e);return[new ol(i,n),new ol(n,s)]}class ol extends Jo{constructor(t,e){super(),this.type=Yo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return se.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Vt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?se.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Go.ROW?Ht(this.p0.x-this.p1.x):t===Go.COLUMN?Ht(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ll{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new rl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ol(new ie(this._lastX,this._lastY),new ie(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Go.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ht(t.p0.y-s.y)}if(t===Go.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ht(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class hl extends ll{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 cl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function dl(t,e,i){const s=null!=e?e:Ht(i[i.length-1].x-i[0].x)>Ht(i[i.length-1].y-i[0].y)?Go.ROW:Go.COLUMN;return"monotoneY"===t?new hl(t,s):new ll(t,s)}class ul{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 pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new ul(n,s),t),n}function gl(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 fl{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&&gl(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:gl(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 ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("basis",i,t);return function(t,e){cl(t,e,2)}(new fl(n,s),t),n}function vl(t){return t<0?-1:1}function _l(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(vl(r)+vl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function yl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function bl(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 xl{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:bl(this,this._t0,yl(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,bl(this,yl(this,e=_l(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:bl(this,this._t0,e=_l(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 Sl extends xl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneX",i,t);return function(t,e){cl(t,e,2)}(new xl(n,s),t),n}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneY",i,t);return function(t,e){cl(t,e,2)}(new Sl(n,s),t),n}let Ml=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class wl extends Ml{lineEnd(){this.context.closePath()}}function Tl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Ml(r,e,n),t),r}function Cl(t,e){return cl(t,e,1)}class Bl extends ul{lineEnd(){this.context.closePath()}}function Pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new Bl(n,s),t),n}function El(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Lt){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>Lt){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,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return pl(i,n);const o=dl(t,r,i);return cl(new e(o,s,a),i,2),o}}const Ol=Rl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:El(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 Il=Rl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:El(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Ll extends Jo{constructor(t,e,i){super(),this.type=Yo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return sl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Qo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Go.ROW?Ht(this.p0.x-this.p2.x):t===Go.COLUMN?Ht(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Ut(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Vt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=sl(i,s,n,e),a=se.pointAtPP(i,s,e),o=se.pointAtPP(s,n,e);return[new Ll(i,a,r),new Ll(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Dl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ol(new ie(this._lastX,this._lastY),new ie(t,e))}quadraticCurveTo(t,e,i,s){const n=new Ll(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new rl(new ie(this._lastX,this._lastY),new ie(t,e),new ie(i,s),new ie(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Fl(t,e,i){var s,n;switch(e){case"linear":default:return pl(t,i);case"basis":return ml(t,i);case"monotoneX":return kl(t,i);case"monotoneY":return Al(t,i);case"step":return Tl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Ht(t[t.length-1].x-t[0].x)>Ht(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new wl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Tl(t,0,i);case"stepAfter":return Tl(t,1,i);case"catmullRom":return Ol(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Il(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Pl(t,i)}}class zl extends Ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Eo(this.bounds)}get curves(){return this.tryBuildCurves()}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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Dl(this);Zo(this.commandList,t,0,0,1,1)}return this._curves}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=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`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;tVo){let t,e=zo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Go.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.y-e.p1.y)}if(this.direction===Go.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ht(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{nt.getInstance().warn("空函数")}}),ih=Object.assign(Object.assign({},$l),{points:[],cornerRadius:0,closePath:!0}),sh=Object.assign(Object.assign({},$l),{width:100,height:100,spikes:5,thickness:.5}),nh=Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const rh=Object.assign(Object.assign({},$l),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ah=Object.assign(Object.assign(Object.assign({},$l),Gl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),oh=Object.assign(Object.assign(Object.assign({},$l),Gl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),lh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},$l),{fill:!0,cornerRadius:0,cornerType:"round"}),hh=Object.assign(Object.assign({},lh),{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}),ch=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&&_(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 dh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(dh.IsGradientStr(t))try{const e=ch(t)[0];if(e){if("linear"===e.type)return dh.ParseLinear(e);if("radial"===e.type)return dh.ParseRadial(e);if("conic"===e.type)return dh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2,n=parseFloat(e.value)/180*Dt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+jt,stops:dh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:dh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Dt/2;let n="angular"===e.type?parseFloat(e.value)/180*Dt:0;for(;n<0;)n+=jt;for(;n>=jt;)n-=jt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const gh={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"}},fh=!0,mh=!1,vh=/\w|\(|\)|-/,_h=/[.?!,;:/,。?!、;:]/,yh=/\S/,bh=(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})};function xh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=vo.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=Sh(t,a)),a}function Sh(t,e,i=!1){let s=e;for(;vh.test(t[s-1])&&vh.test(t[s])||_h.test(t[s]);)if(s--,s<=0)return i?kh(t,e):e;return s}function kh(t,e){let i=e;for(;vh.test(t[i+1])&&vh.test(t[i])||_h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ah(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=vo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ah.fontSize}){let i=0,s=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=Sh(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){nt.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,a=!1){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=Sh(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}};wh=Mh([Ua()],wh);var Th=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ch=Symbol.for("TextMeasureContribution");let Bh=class extends wh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Bh=Th([Ua()],Bh);const Ph=Symbol.for("CanvasFactory"),Eh=Symbol.for("Context2dFactory");function Rh(t){return fo.getNamed(Ph,vo.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Lh=1/3;function Dh(t){return t>-Kh&&tKh||t<-Kh}const zh=[0,0],jh=[0,0],Hh=[0,0];function Vh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Nh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Uh(t){return(t%=jt)<0&&(t+=jt),t}function Gh(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+=jt);let d=Math.atan2(l,o);return d<0&&(d+=jt),d>=s&&d<=n||d+jt>=s&&d+jt<=n}function $h(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(Dh(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 Zh=[-1,-1,-1],Jh=[-1,-1];function Qh(){const t=Jh[0];Jh[0]=Jh[1],Jh[1]=t}function tc(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(Dh(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,Lh):Math.pow(i,Lh),s=s<0?-Math.pow(-s,Lh):Math.pow(s,Lh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Zh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Qh(),p=Wh(e,s,r,o,Jh[0]),u>1&&(g=Wh(e,s,r,o,Jh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Dh(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,Zh);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=Nh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Zh[0]=-l,Zh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=jt-1e-4){s=0,n=jt;const e=r?1:-1;return a>=Zh[0]+t&&a<=Zh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=jt,n+=jt);let c=0;for(let e=0;e<2;e++){const i=Zh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=jt+t),(t>=s&&t<=n||t+jt>=s&&t+jt<=n)&&(t>Dt/2&&t<1.5*Dt&&(e=-e),c+=e)}}return c}function sc(t){return Math.round(t/Dt*1e8)/1e8%2*Dt}function nc(t,e){let i=sc(t[0]);i<0&&(i+=jt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=jt?n=i+jt:e&&i-n>=jt?n=i-jt:!e&&i>n?n=i+(jt-sc(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;rc[0]=S,rc[1]=k,nc(rc,Boolean(a[6])),S=rc[0],k=rc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case Lo.M:u=m,p=v,c=u,d=p;break;case Lo.L:if(i){if($h(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Lo.C:if(i){if(Yh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=tc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Lo.Q:if(i){if(Gh(c,d,m,v,_,y,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Lo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Xh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ic(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case Lo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if($h(u,p,o,p,e,s,n)||$h(o,p,o,l,e,s,n)||$h(o,l,u,l,e,s,n)||$h(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Lo.Z:if(i){if($h(c,d,u,p,e,s,n))return!0}else h+=Pe(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},hc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cc=Symbol.for("VWindow"),dc=Symbol.for("WindowHandlerContribution");let uc=class extends bo{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(){super(),this.hooks={onChange:new uo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(fo.getNamed(dc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=vo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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&&dt(this.width,t.width())&&dt(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)}};uc=lc([Ua(),hc("design:paramtypes",[])],uc);var pc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,s){e(i,s,t)}};let mc=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=vo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=oc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:Gl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Gl.fontFamily,fontSize:Gl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=fo.get(cc),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 vc;mc=pc([Ua(),fc(0,Na(ao)),fc(0,Ga(Ch)),gc("design:paramtypes",[Object])],mc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(vc||(vc={}));const _c=new Ve;let yc=class{constructor(){this.matrix=new Ve}init(t){return this.mode=vc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=vc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}scale(t,e,i){return this.mode===vc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===vc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return _c.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}translate(t,e){return this.mode===vc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===vc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};yc=pc([Ua(),gc("design:paramtypes",[])],yc);const bc={arc:Kl,area:ql,circle:Zl,line:th,path:eh,symbol:rh,text:ah,rect:nh,polygon:ih,star:sh,richtext:oh,richtextIcon:hh,image:lh,group:Jl,glyph:Ql},xc=Object.keys(bc);function Sc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},bc.arc),area:Object.assign({},bc.area),circle:Object.assign({},bc.circle),line:Object.assign({},bc.line),path:Object.assign({},bc.path),symbol:Object.assign({},bc.symbol),text:Object.assign({},bc.text),rect:Object.assign({},bc.rect),polygon:Object.assign({},bc.polygon),star:Object.assign({},bc.star),richtext:Object.assign({},bc.richtext),richtextIcon:Object.assign({},bc.richtextIcon),image:Object.assign({},bc.image),group:Object.assign({},bc.group),glyph:Object.assign({},bc.glyph)};class Ac{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},xc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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,nt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;xc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Sc(n,t[s]),i[s]&&Sc(n,i[s]),e[s]&&Sc(n,e[s]),this.combinedTheme[s]=n})),e.common&&xc.forEach((t=>{Sc(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 Mc=new Ac;function wc(t,e){return t.glyphHost?wc(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)):Mc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Mc.getTheme()}var Tc=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 Cc extends o{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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Tc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&nt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Ec))return void nt.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(Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Lc(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 Ec))return void nt.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=Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Lc(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 Ec))return void nt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Lc(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(Lc(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,Lc(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 Ec))return void nt.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"):Lc(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 Rc))return void nt.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=Ic.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 Dc(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 Ec,this.rootWheelEvent=new Rc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Hc{static GetImage(t,e){var i;const s=Hc.cache.get(t);s?"fail"===s.loadState?vo.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):Hc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Hc.cache.get(t);s?"fail"===s.loadState?vo.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"},Hc.cache.set(t,s),s.dataPromise=vo.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=Hc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Hc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vo.global.loadBlob(t):"json"===e&&(i.dataPromise=vo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Hc.isLoading&&Hc.toLoadAueue.length){Hc.isLoading=!0;const t=Hc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Hc.cache.set(i,n),n.dataPromise=vo.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((()=>{Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()})).catch((t=>{console.error(t),Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()}))}}),0)}static loadImage(t,e){const i=Vc(t,Hc.toLoadAueue);if(-1!==i)return Hc.toLoadAueue[i].marks.push(e),void Hc.loading();Hc.toLoadAueue.push({url:t,marks:[e]}),Hc.loading()}static improveImageLoading(t){const e=Vc(t,Hc.toLoadAueue);if(-1!==e){const t=Hc.toLoadAueue.splice(e,1);Hc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Vc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Uc[0]=t[0],Uc[2]=t[0],Uc[1]=t[1],Uc[3]=t[1],Uc):t:t:0,Yc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function $c(t,e,i,s){for(;t>=jt;)t-=jt;for(;t<0;)t+=jt;for(;t>e;)e+=jt;Yc[0].x=i,Yc[1].y=i,Yc[2].x=-i,Yc[3].y=-i;const n=Math.ceil(t/Ft)%4,r=Math.ceil(e/Ft)%4;if(s.add(Nt(t)*i,Gt(t)*i),s.add(Nt(e)*i,Gt(e)*i),n!==r||e-t>Dt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ie(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Jc.TimeOut=1e3/60;const Qc=new Jc,td=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ed{bounds(t,e){if(x(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 x(t)?t:Math.min(t[0],t[1])}}function id(t,e,i,s,n){return n?t.arc(i,s,e,0,zt,!1,n):t.arc(i,s,e,0,zt),!1}var sd=new class extends ed{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 id(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return id(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 nd=new class extends ed{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 rd(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 ad=new class extends ed{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 rd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return rd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return rd(t,this.parseSize(e)/2+n,i,s,r)}};function od(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ld=new class extends ed{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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,n=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 cd extends ed{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 hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}}var dd=new cd;var ud=new class extends cd{constructor(){super(...arguments),this.type="triangle"}};const pd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),gd=Math.sin(zt/10)*pd,fd=-Math.cos(zt/10)*pd;function md(t,e,i,s){const n=gd*e,r=fd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=zt*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 vd=new class extends ed{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 md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return md(t,this.parseSize(e)/2+n,i,s)}};const _d=Yt(3);function yd(t,e,i,s){const n=e,r=n/_d,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 bd=new class extends ed{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 yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return yd(t,this.parseSize(e)/2+n,i,s)}};function xd(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 Sd=new class extends ed{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ad=new class extends ed{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Md=-.5,wd=Yt(3)/2,Td=1/Yt(12);function Cd(t,e,i,s){const n=e/2,r=e*Td,a=n,o=e*Td+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(Md*n-wd*r+i,wd*n+Md*r+s),t.lineTo(Md*a-wd*o+i,wd*a+Md*o+s),t.lineTo(Md*l-wd*h+i,wd*l+Md*h+s),t.lineTo(Md*n+wd*r+i,Md*r-wd*n+s),t.lineTo(Md*a+wd*o+i,Md*o-wd*a+s),t.lineTo(Md*l+wd*h+i,Md*h-wd*l+s),t.closePath(),!1}var Bd=new class extends ed{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 Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ed=new class extends ed{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends ed{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Ld=new class extends ed{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Dd=Yt(3);function Fd(t,e,i,s){const n=e*Dd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var zd=new class extends ed{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Fd(t,this.parseSize(e)/2/Dd,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2/Dd+n,i,s)}};function jd(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 Hd=new class extends ed{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 jd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/4+n,i,s)}};function Vd(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 Nd=new class extends ed{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Ud=new class extends ed{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 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 Gd(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 Yd=new class extends ed{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var $d=new class extends ed{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 Kd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var qd=new class extends ed{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(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 ed{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 Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function tu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var eu=new class extends ed{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 x(e)?tu(t,e,i,s):Qd(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?tu(t,e+2*n,i,s):Qd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const iu=new je;class su{constructor(t,e,i=!1){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(),Zo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Zo(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 x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{iu.x1=i.bounds.x1*t,iu.y1=i.bounds.y1*t,iu.x2=i.bounds.x2*t,iu.y2=i.bounds.y2*t,e.union(iu)}))}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 nu={};[sd,nd,ad,ld,zd,ud,vd,bd,Sd,Ad,Bd,Ed,Od,dd,Ld,Hd,Nd,Ud,Yd,eu,$d,qd,Jd].forEach((t=>{nu[t.type]=t}));const ru={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class au{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 ou(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function lu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=lu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ou(t,"--\x3e",r+4,"Comment is not closed.");else{const a=lu(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 au(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 au(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 du(t,e){return uu(t)}function uu(t,e){const i={};for(let e=0;exu.set(t,!0)));const Su=new Map;function ku(t){if(xu.has(t))return!0;if(Su.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Su.set(t,!0)));const Au=yu(),Mu=yu(),wu=yu(),Tu=yu(),Cu=yu(),Bu=yu(),Pu=yu(),Eu=yu(),Ru=yu(),Ou=yu();yu();const Iu=yu();yu();const Lu=yu();yu();const Du=yu(),Fu=yu(),zu=Symbol.for("GraphicService"),ju=Symbol.for("GraphicCreator"),Hu={"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"},Vu=Object.keys(Hu),Nu={duration:200,easing:"cubicOut"};function Wu(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 Uu(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 Gu(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 Yu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 $u{constructor(){this.pools=[]}static identity(t){return Wu(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 $u.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},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Qu=new Ve(1,0,0,1,0,0),tp={x:0,y:0};let ep=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this.path=new zl,this._clearMatrix=new Ve(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ku.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},tp),function(t,e,i){return ac(t,0,!1,e,i)}(this.path.commandList,tp.x,tp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},tp);const i=uh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return ac(t,e,!0,i,s)}(this.path.commandList,i,tp.x,tp.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Qu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};ep=Zu([Ua(),Ju("design:paramtypes",[Object,Number])],ep);const ip={WIDTH:500,HEIGHT:500,DPR:1};class sp{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}set nativeCanvas(t){this._nativeCanvas=t}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=ip.WIDTH,height:n=ip.HEIGHT,dpr:r=ip.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var np;sp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(np||(np={}));class rp{static Get(t,e=np.Color1,i=[0,0,0,1]){if(e===np.Color1){const e=rp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Qe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];rp.store1[t]=e,rp.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=rp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Qe.parseColorString(t);return n&&(rp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],rp.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===np.Color1){if(rp.store1[t])return;rp.store1[t]=i,rp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rp.store255[t])return;rp.store255[t]=i,rp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function ap(t,e=!1){return Array.isArray(t)&&x(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 op(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return lp(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):lp(t,e,i,s,n)}function lp(t,e,i,s,n){if(!t||!e)return t&&ap(t)||e&&ap(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rp.Get(t,np.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rp.Get(e,np.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:ap(a)})))});return o?op(r,l,i,s,n):op(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:up(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:up(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:up(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),ap(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)}function hp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}rp.store255={},rp.store1={};const cp=[0,0,0,0],dp=[0,0,0,0];function up(t,e,i){return rp.Get(t,np.Color255,cp),rp.Get(e,np.Color255,dp),`rgba(${Math.round(cp[0]+(dp[0]-cp[0])*i)},${Math.round(cp[1]+(dp[1]-cp[1])*i)},${Math.round(cp[2]+(dp[2]-cp[2])*i)},${cp[3]+(dp[3]-cp[3])*i})`}class pp{static GetCanvas(){try{return pp.canvas||(pp.canvas=vo.global.createCanvas({})),pp.canvas}catch(t){return null}}static GetCtx(){if(!pp.ctx){const t=pp.GetCanvas();pp.ctx=t.getContext("2d")}return pp.ctx}}class gp extends Ne{static getInstance(){return gp._instance||(gp._instance=new gp),gp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=pp.GetCanvas(),s=pp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new gp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class fp{static GetSize(t){for(let e=0;e=t)return fp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=fp.GenKey(t,e,i,s,n),l=fp.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=fp.GenKey(t,e,i,s,n);fp.cache[l]?fp.cache[l].push({width:a,height:o,pattern:r}):fp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}fp.cache={},fp.ImageSize=[20,40,80,160,320,640,1280,2560];const mp=new je,vp=new Ve;new je;const _p=["lineWidth","scaleX","scaleY","angle","anchor","visible"],yp=["x","y"],bp=["scaleX","scaleY"],xp=["angle"],Sp=new ie,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ap extends Cc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=nu[t];if(e)return e;if(e=Ap.userSymbolMap[t],e)return e;if(!0===((i=t=ru[t]||t).startsWith("{const e=(new zl).fromString(t.d),i={};Vu.forEach((e=>{t[e]&&(i[Hu[e]]=t[e])})),n.push({path:e,attribute:i}),mp.union(e.bounds)}));const r=mp.width(),a=mp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new su(t,n,!0);return Ap.userSymbolMap[t]=l,l}var i;const s=(new zl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new su(t,s);return Ap.userSymbolMap[t]=o,o}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=Gc(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 Eo(t);return Zo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ve),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&No.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&No.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&No.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&No.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=No.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Wo.GLOBAL){const i=new ie(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Nu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Uo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Uo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Uo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=No.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=No.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&No.UPDATE_SHAPE_AND_BOUNDS)===No.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=No.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=No.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=No.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=No.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=No.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&No.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,scaleX:i=Vl.scaleX,scaleY:s=Vl.scaleY,angle:n=Vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Nt(a),f=Gt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),vo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=vp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Uo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return v(t,!0)?this.pathProxy=(new zl).fromString(t):this.pathProxy=new zl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),vo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||vo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ep(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Mp;Ap.userSymbolMap={},Ap.mixin(Fc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Mp||(Mp={}));let wp=class t extends Ap{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=No.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 Ac),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ac)}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===Wo.GLOBAL){const i=new ie(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&No.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,dx:i=Vl.dx,dy:s=Vl.dy,scaleX:n=Vl.scaleX,scaleY:r=Vl.scaleY,angle:a=Vl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return vo.graphicService.updateTempAABBBounds(i),vo.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&=No.CLEAR_BOUNDS,this._childUpdateTag&=No.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&No.UPDATE_BOUNDS||(this._childUpdateTag|=No.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&No.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=vo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Tp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Cp extends wp{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 Ac,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vo.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=>{vo.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Ep=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Lp,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},Fp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zp=Lp=class{static GenerateLayerId(){return`${Lp.idprefix}_${Lp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vo.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?fo.get(Rp):"dynamic"===t?fo.get(Op):fo.get(Ip),e}createLayer(t,e={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 Cp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Lp.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)}};zp.idprefix="visactor_layer",zp.prefix_count=0,zp=Lp=Dp([Ua(),Fp("design:paramtypes",[])],zp);var jp=new Ea((t=>{t(go).to(Mo).inSingletonScope(),t(cc).to(uc),t(Pp).to(mc).inSingletonScope(),t(Bp).to(yc).inSingletonScope(),t(Ep).to(zp).inSingletonScope()}));function Hp(t,e){return!(!t&&!e)}function Vp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Np(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Up(t,e){return t*e>0}function Gp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Yp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-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-m,B=M-v,P=w-m,E=T-v;return C*C+B*B>P*P+E*E&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Ht(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 k=n*Nt(c),A=n*Gt(c),M=s*Nt(u),w=s*Gt(u);let T,C,B,P;if((b>Lt||y>Lt)&&(T=n*Nt(d),C=n*Gt(d),B=s*Nt(p),P=s*Gt(p),r1?0:E<-1?Dt:Math.acos(E))/2),l=Yt(t[0]*t[0]+t[1]*t[1]);S=Ut(b,(s-l)/(o-1)),x=Ut(y,(n-l)/(o+1))}}var E;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:P,xore:T,yore:C,xire:M,yire:w,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 $p(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ht(l-o),c=l>o;let d=!1;if(n=jt-Lt)e.moveTo(i+n*Nt(o),s+n*Gt(o)),e.arc(i,s,n,o,l,!c),r>Lt&&(e.moveTo(i+r*Nt(l),s+r*Gt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:P,innerCornerRadiusEnd:E,maxInnerCornerRadius:R}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Lt){const t=Ut(v,m),r=Ut(_,m),o=Yp(g,f,u,p,n,t,Number(c)),l=Yp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,n,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Nt(Vt(l.y01,l.x01)),s+l.cy+r*Gt(Vt(l.y01,l.x01))):e.moveTo(i+b,s+n*Gt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Nt(M),s+n*Gt(M));if(!(r>Lt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Lt){const t=Ut(P,w),n=Ut(E,w),o=Yp(S,k,b,x,r,-n,Number(c)),l=Yp(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),w0&&e.arc(i+o.cx,s+o.cy,n,Vt(o.y01,o.x01),Vt(o.y11,o.x11),!c),e.arc(i,s,r,Vt(o.cy+o.y11,o.cx+o.x11),Vt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Vt(l.y11,l.x11),Vt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Nt(Vt(l.y01,l.x01)),s+l.cy+t*Gt(Vt(l.y01,l.x01))):e.moveTo(i+g,s+f)}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,B,c):e.moveTo(i+r*Nt(B),s+r*Gt(B))}return a?a[3]&&e.lineTo(i+n*Nt(o),s+n*Gt(o)):e.closePath(),d}const Kp=Symbol.for("ArcRenderContribution"),qp=Symbol.for("AreaRenderContribution"),Zp=Symbol.for("CircleRenderContribution"),Jp=Symbol.for("GroupRenderContribution"),Qp=Symbol.for("ImageRenderContribution"),tg=Symbol.for("PathRenderContribution"),eg=Symbol.for("PolygonRenderContribution"),ig=Symbol.for("RectRenderContribution"),sg=Symbol.for("SymbolRenderContribution"),ng=Symbol.for("TextRenderContribution"),rg=Symbol.for("InteractiveSubRenderContribution");function ag(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function og(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var lg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cg=function(t,e){return function(i,s){e(i,s,t)}};function dg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Uu(t,t,[n+o,r+l,a+h]),Uu(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),Uu(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]),f){const i=qu.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]}Uu(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),Uu(i,i,[-s[0],-s[1],0]),Yu(t,t,i)}}let ug=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new uo(["graphic"]),onSetStage:new uo(["graphic","stage"]),onRemove:new uo(["graphic"]),onRelease:new uo(["graphic"]),onAddIncremental:new uo(["graphic","group","stage"]),onClearIncremental:new uo(["graphic","group","stage"]),beforeUpdateAABBBounds:new uo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new uo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new uo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new je,this.tempAABBBounds2=new je}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Eo(t);return Zo(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=og(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ag(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){vu(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;vu(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&&Fe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};ug=lg([Ua(),cg(0,Na(ju)),hg("design:paramtypes",[Object])],ug);const pg=(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},gg=["radius","startAngle","endAngle",..._p];class fg extends Ap{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Tu}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 wc(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}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.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>jt-Lt?i.set(-r,-r,r,r):$c(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new zl,s.arc(0,0,r,a,o),s}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=kp;class vg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=wo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Fu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new yg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=vo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){vu(n,o/Math.abs(r+a),!0,l),i.union(n)}return vo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Fe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=vo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new vg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=vo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new vg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],P=[0,0];let E=1/0;if(b>0&&(E=Math.max(Math.floor(b/A),1)),x&&(E=Math.min(E,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),P[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const t=ag(_,a),e=this.cache.verticalList.length*v,i=og(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===bu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const x=ag(_,a),S=this.cache.verticalList.length*v,k=og(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=td(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=_g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=_g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return yg.baselineMapAlign}getAlignMapBaseline(){return yg.alignMapBaseline}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),yg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},yg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const xg=["symbolType","size",..._p];let Sg=class t extends Ap{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Du}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=vo.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;vu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return vo.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,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new zl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new zl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Ag=["segments","points","curveType","curveTension",..._p];let Mg=class t extends Ap{constructor(t={}){super(t),this.type="line",this.numberType=Eu}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=qc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new zl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Tg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Cg=["width","x1","y1","height","cornerRadius",..._p];class Bg extends Ap{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Tg(e);return t=new zl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Eg extends Ap{constructor(t){super(t),this.type="glyph",this.numberType=Cu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Eg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=kp;class Og{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=gh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Lg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=td(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ah(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ah(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=xh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Dg=["width","height","image",..._p];class Fg extends Ap{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return lh[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}clone(){return new Fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class jg extends Fg{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=Gc(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=Gc(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=lh.width,height:e=lh.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 Hg{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 jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Lg){const e=yh.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 jg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ah(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)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||mh;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,bh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||fh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ph(t,s,{AABBBounds:i}):s,bh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Ah(t,s.character,s.ascentDescentMode),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 jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Vg{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=gh[this.direction]}store(t){if(t instanceof jg){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 Hg(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,e=!1){t instanceof jg?"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||this.newLine)&&("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=xh(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 Lg(i,t.newLine,t.character,t.ascentDescentMode),new Lg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ng=!1;try{Ng=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ng=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",..._p];class Ug extends Ap{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Lu,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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&Ug.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&Ug.splitText(t.text).length>1)))}static splitText(t){if(Ng){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Ug.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),vo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Ug.AllSingleCharacter(_)&&(_=Ug.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Og(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Vg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new Ug(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Ug.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const Yg=["path","customPath",..._p];class Xg extends Ap{constructor(t){super(t),this.type="path",this.numberType=Ru}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 zl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof zl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return vo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new zl).fromString(t.path):t.customPath&&(this.cache=new zl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){return(new zl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const Kg=["segments","points","curveType","curveTension",..._p];class qg extends Ap{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return vo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new zl;const 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 qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Jg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",..._p];class Qg extends Ap{constructor(t){super(t),this.type="arc",this.numberType=Au}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(x(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=ae(e),i=e+r,s&&Ht(r)Lt&&o>Lt)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=Yt(a*a+o*o)}=this.attribute,h=Ht(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Lt&&l>Lt){const i=e>t?1:-1;let s=$t(Number(l)/o*Gt(g)),n=$t(Number(l)/a*Gt(g));return(f-=2*s)>Lt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Lt?(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 wc(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}=vo.graphicService.updateTempAABBBounds(i);pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return vo.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<=Lt?i.set(0,0,0,0):Math.abs(o-l)>jt-Lt?i.set(-s,-s,s,s):($c(l,o,s,i),$c(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ht(o-a),d=o>a;if(h=jt-Lt)n.moveTo(0+h*Nt(a),0+h*Gt(a)),n.arc(0,0,h,a,o,!d),l>Lt&&(n.moveTo(0+l*Nt(o),0+l*Gt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Nt(a),e=h*Gt(a),i=l*Nt(o),s=l*Gt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const ef=["points","cornerRadius",..._p];class sf extends Ap{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new zl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=kp;class rf extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function af(t){return new rf(t)}const of=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 lf,hf;function cf(t){return lf||(lf=of.CreateGraphic("text",{})),lf.initAttributes(t),lf.AABBBounds}var df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},pf=function(t,e){return function(i,s){e(i,s,t)}};class gf{constructor(){this.time=Xo.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=oc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),oc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const ff=new gf;let mf=class{constructor(t){this.subRenderContribitions=t,this.time=Xo.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)}))}};mf=df([Ua(),pf(0,Na(ao)),pf(0,Ga(rg)),uf("design:paramtypes",[Object])],mf);const vf=new class{constructor(){this.time=Xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const _f=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class yf{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=oc.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])),oc.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,jt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=oc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:uh(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(),$p(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"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},Sf=bf,kf=ff;const Af=new class{constructor(){this.time=Xo.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{radius:m=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:uh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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"),f&&M(p,"innerBorder")}},Mf=bf,wf=ff;const Tf=new class extends gf{constructor(){super(...arguments),this.time=Xo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Cf=Dt/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Ht(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ht(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ht(t[0]),i=Ht(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ht(l[0]),l[1]=Ht(l[1]),l[2]=Ht(l[2]),l[3]=Ht(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Cf,Dt,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Dt,Dt+Cf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ef{constructor(){this.time=Xo.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,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:uh(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(),Bf(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),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&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Rf=class{constructor(){this.time=Xo.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)}};Rf=Pf([Ua()],Rf);let Of=class{constructor(){this.time=Xo.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,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x: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 Bf(e,i,s,b,x,v,"bevel"!==y,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ua()],Of);const If=new Ef,Lf=bf,Df=ff;const Ff=new class extends Ef{constructor(){super(...arguments),this.time=Xo.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)}},zf=ff;const jf=new class{constructor(){this.time=Xo.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:_=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:uh(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()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Hf=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Vf=bf,Nf=ff;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Uf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(vf),this.builtinContributions.push(_f),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===Xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Xo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Np(d,u,h),y=Up(d,g),b=Hp(h),x=Vp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Zo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Np(o,l,n),p=Up(o,c),g=Hp(n,r),f=Vp(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),qu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&qu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let $f=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Au,this.builtinContributions=[xf,kf,Sf],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(nLt){const t=Ut(b,y),r=Ut(x,y),a=Yp(v,_,f,m,n,t,Number(u)),o=Yp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Vt(o.y11,o.x11),Vt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Lt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Lt){const t=Ut(P,T),n=Ut(E,T),a=Yp(M,w,k,A,r,-n,Number(u)),o=Yp(f,m,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,Vt(a.y01,a.x01),Vt(a.y11,a.x11),!u);const t=Vt(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*Nt(B),s+r*Gt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{fill:c=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:_,doStroke:y}=f,{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=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ht(s-i){var e;let i=!0;if(h(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((_||B)&&(e.beginPath(),$p(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),$p(t,e,i,s,A,M,P),C||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())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ht(h-r)>=jt-Lt){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,m,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+=jt;for(;i>jt;)i-=jt;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),op(o.color,l.color,h,!1)}(0,0,h,n);a||Np&&(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,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};$f=Gf([Ua(),Xf(0,Na(ao)),Xf(0,Ga(Kp)),Yf("design:paramtypes",[Object])],$f);var 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},qf=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 Jf=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[Af,wf,Mf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Qf(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]=nl(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 tm(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 em(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=tm(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),Qf(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Go.ROW:"y"===s?u=Go.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 sm=class extends Uf{constructor(){super(...arguments),this.numberType=Eu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();em(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Fl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Ut(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function nm(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),Qf(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),Qf(t,l,1,s),o=!1):o=!0}t.closePath()}sm=im([Ua()],sm);const rm=new class extends yf{constructor(){super(...arguments),this.time=Xo.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Zc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Zc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Zc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Zc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},am=ff;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 Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[rm,am],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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function P(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,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=Fl(P(t.points,x),B,{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=Fl(P(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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=P(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Fl(e,B,{curveTension:b}),n=Fl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Ut(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Go.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Ht(y.x-b.x),k=Ht(y.y-b.y);x=null==y.x1?Go.ROW:null==y.y1?Go.COLUMN:Number.isFinite(S+k)?S>k?Go.ROW:Go.COLUMN:Go.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Go.ROW:Go.COLUMN,Number.isFinite(c)||(o=Go.COLUMN),Number.isFinite(d)||(o=Go.ROW);const u=i*(o===Go.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),em(t,i[0]?e.top:e.bottom,l,x===Go.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};cm=om([Ua(),hm(0,Na(ao)),hm(0,Ga(qp)),lm("design:paramtypes",[Object])],cm);const dm=bf,um=ff;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},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[um,dm],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zo(t.pathShape.commandList,e,i,s,1,1,f);else{Zo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};mm=pm([Ua(),fm(0,Na(ao)),fm(0,Ga(tg)),gm("design:paramtypes",[Object])],mm);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},_m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Df,Lf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Wp(g,f,w,T,h),B=Gp(g,v,w,T,M),P=Hp(h,c),E=Vp(d,m);if(!t.valid||!y)return;if(!P&&!E)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Bf(e,i,s,w,T,u,"bevel"!==p));const R={doFill:P,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,P,E,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,P,E,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};bm=vm([Ua(),ym(0,Na(ao)),ym(0,Ga(ig)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[jf,Nf,Vf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Am=xm([Ua(),km(0,Na(ao)),km(0,Ga(sg)),Sm("design:paramtypes",[Object])],Am);const Mm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new je)}allocate(t,e,i,s){if(!this.pools.length)return(new je).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 je(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends gf{constructor(){super(...arguments),this.time=Xo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=p(T)&&T.background,E=t.transMatrix.onlyTranslate();if(P){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(g=T.dx)&&void 0!==g?g: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!==(_=T.height)&&void 0!==_?_:e.height();if(B=Mm.allocate(i,s,i+n,s+r),T=T.background,!E){const t=B.width(),e=B.height();B.set((null!==(y=T.x)&&void 0!==y?y: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 B=t.AABBBounds,E||(B=cf(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(),E&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Bf(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}P&&Mm.free(B),C()}};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},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=td(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Ku.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Ku.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(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,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:ag(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Em(t,e,i,s){if(e&&e.length){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},Fm=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 jm=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Lm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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))?Em(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Em(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),k=Om(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Rm(A,M),T=Om(h,Rm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let P=B-C;P<0&&(C=B,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,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=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};jm=Dm([Ua(),zm(0,Na(ao)),zm(0,Ga(eg)),Fm("design:paramtypes",[Object])],jm);var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Tf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Wp(p,m,g,f,c),C=Gp(p,v,g,f),B=Hp(c,u),P=Vp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!P)return;if(!(T||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Tf));const E={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Xo.beforeFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o,E)})),h&&e.clip();const R=()=>{E.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{E.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Xo.afterFillStroke&&r.drawShape(t,e,i,s,B,P,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=vo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(i,p||i,n),a.modelMatrix=i,qu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&qu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Hm([Ua(),Nm(0,Na(ao)),Nm(0,Ga(Jp)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let $m=class extends Uf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Ff,zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Bf(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Hc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};$m=Um([Ua(),Ym(0,Na(ao)),Ym(0,Ga(Qp)),Gm("design:paramtypes",[Object])],$m);const Km=Symbol.for("IncrementalDrawContribution"),qm=Symbol.for("ArcRender"),Zm=Symbol.for("AreaRender"),Jm=Symbol.for("CircleRender"),Qm=Symbol.for("GraphicRender"),tv=Symbol.for("GroupRender"),ev=Symbol.for("LineRender"),iv=Symbol.for("PathRender"),sv=Symbol.for("PolygonRender"),nv=Symbol.for("RectRender"),rv=Symbol.for("SymbolRender"),av=Symbol.for("TextRender"),ov=Symbol.for("RichTextRender"),lv=Symbol.for("GlyphRender"),hv=Symbol.for("ImageRender"),cv=Symbol.for("DrawContribution"),dv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Mu,!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+=jt;for(;o<0;)o+=jt;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 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},pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gv=Symbol.for("DrawItemInterceptor"),fv=new je,mv=new je;class vv{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){fv.copy(s.dirtyBounds),mv.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,Ku.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(fv),s.backupDirtyBounds.copy(mv)),!0}}class _v{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 yv=class{constructor(){this.order=1,this.interceptors=[new vv,new xv,new bv,new _v]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&qu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Av=function(t,e){return function(i,s){e(i,s,t)}};let Mv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Mv=Sv([Ua(),Av(0,Na(cv)),kv("design:paramtypes",[Object])],Mv);var wv=new Ea((t=>{t(mo).to(Mv)}));const Tv=Symbol.for("PickerService"),Cv=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");var Ev=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Ev([Ua()],Rv);let Ov=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Ku.allocateByObj(a),u=new ie(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}};Ov=Ev([Ua()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ie(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}};Iv=Ev([Ua()],Iv);let Lv=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=dv(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()}};Lv=Ev([Ua()],Lv);var Dv=new Ea(((t,e,i)=>{i(Tv)||(t(Cv).toSelf(),t(Tv).toService(Cv)),t(Lv).toSelf().inSingletonScope(),t(Bv).toService(Lv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),lo(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),lo(t,Pv)})),Fv=new Ea((t=>{t(zu).to(ug),t(ju).toConstantValue(of)}));const zv=Symbol.for("AutoEnablePlugins"),jv=Symbol.for("PluginService");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},Vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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&&fo.isBound(zv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Hv([Ua(),Nv(0,Na(ao)),Nv(0,Ga(zv)),Vv("design:paramtypes",[Object])],Wv);var Uv=new Ea((t=>{t(jv).to(Wv),function(t,e){t(ao).toDynamicValue((({container:t})=>new oo(e,t))).whenTargetNamed(e)}(t,zv)})),Gv=new Ea((t=>{lo(t,po)})),Yv=new Ea((t=>{t(Ch).to(Bh).inSingletonScope(),lo(t,Ch)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kv=class{constructor(){this.type="static",this.offscreen=!1,this.global=vo.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=Rh({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()}};Kv=Xv([Ua(),$v("design:paramtypes",[])],Kv);var qv=new Ea((t=>{t(Kv).toSelf(),t(Rp).toService(Kv)}));var Zv=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 Jv(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 Qv(t,e,i,s=!1,n=!1){let 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}=Jv(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;t{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}=Jv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var i_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},s_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},n_=function(t,e){return function(i,s){e(i,s,t)}};let r_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):Qv(e,$l.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new ze,this.backupDirtyBounds=new ze,this.global=vo.global,this.layerService=vo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=me(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:$l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:$l.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ku.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=e_(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&&!be(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Mm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Ku.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Mm.free(n),Ku.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||fo.get(Km);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 o_=class extends sm{constructor(){super(...arguments),this.numberType=Eu}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=wc(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=Np(u,p,c),_=Up(u,g),y=Hp(c),b=Vp(d,f);if(!t.valid||!m)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())}};o_=a_([Ua()],o_);var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 h_=class extends cm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Np(u,d,c),f=Hp(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())}};h_=l_([Ua()],h_);var c_,d_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},u_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},p_=function(t,e){return function(i,s){e(i,s,t)}},g_=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"}(c_||(c_={}));let f_=class extends r_{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=c_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new uo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return g_(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 g_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return g_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>g_(this,void 0,void 0,(function*(){if(2!==t.count)yield t_(t,$l.zIndex,((i,s)=>{if(this.status===c_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return g_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return g_(this,void 0,void 0,(function*(){this.rendering&&(this.status=c_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=c_.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 g_(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:()=>g_(this,void 0,void 0,(function*(){yield t_(t,$l.zIndex,(t=>g_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};f_=d_([Ua(),p_(0,Wa(Qm)),p_(1,Na(o_)),p_(2,Na(h_)),p_(3,Na(ao)),p_(3,Ga(gv)),u_("design:paramtypes",[Array,Object,Object,Object])],f_);var m_=new Ea((t=>{t(gf).toSelf().inSingletonScope(),t(yf).toSelf().inSingletonScope(),t(cv).to(r_),t(Km).to(f_),t(tv).to(Wm).inSingletonScope(),t(Qm).toService(tv),lo(t,Jp),t(mf).toSelf().inSingletonScope(),lo(t,rg),lo(t,Qm),t(yv).toSelf().inSingletonScope(),t(gv).toService(yv),lo(t,gv)}));function v_(){v_.__loaded||(v_.__loaded=!0,fo.load(jp),fo.load(Fv),fo.load(wv),fo.load(Dv),fo.load(Uv),function(t){t.load(Gv),t.load(Yv),t.load(qv)}(fo),function(t){t.load(m_)}(fo))}v_.__loaded=!1,v_();const __=fo.get(go);vo.global=__;const y_=fo.get(Pp);vo.graphicUtil=y_;const b_=fo.get(Bp);vo.transformUtil=b_;const x_=fo.get(zu);vo.graphicService=x_;const S_=fo.get(Ep);vo.layerService=S_;class k_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class A_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=vo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vo.global.getRequestAnimationFrame();this.rafId=t((()=>{vo.global.devicePixelRatio!==this.dpr&&(this.dpr=vo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=vo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class M_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vo.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 w_=new je;class T_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(w_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(w_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let C_;function B_(){!function(){if(null==C_)try{const t=document.createElement("canvas"),e=t.getContext("2d");C_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),C_&&(C_=!!document.createElement)}catch(t){C_=!1}}();const t=vo.global&&vo.global.env;return t?"browser"===t:C_}let P_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};P_._pluginClasses={};const E_="white";class R_ extends wp{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:E_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ac,this.hooks={beforeRender:new uo(["stage"]),afterRender:new uo(["stage"]),afterClearScreen:new uo(["stage"]),afterClearRect:new uo(["stage"])},this.global=vo.global,!this.global.env&&B_()&&this.global.setEnv("browser"),this.window=fo.get(cc),this.renderService=fo.get(mo),this.pluginService=fo.get(jv),this.layerService=fo.get(Ep),this.graphicService=fo.get(zu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:E_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new jc(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(t=!1){t&&(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,_=(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=P_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,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=P_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=P_.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 k_))}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 A_))}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 M_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new ze;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new T_,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=P_.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=P_.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=P_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ie(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=fo.get(cc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=fo.get(Tv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var O_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},I_=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 L_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new je}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}}loadFont(t,e,i){return I_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};L_=O_([Ua()],L_);var D_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},F_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let z_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new je,this.modelMatrix=new Ve(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};z_=D_([Ua(),F_("design:paramtypes",[])],z_);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},H_=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)}};let N_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=vo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 je).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 Ve(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ie(e.x,e.y),a=wc(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 ie(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&qu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Ku.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function W_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function U_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function q_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ey=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},iy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new ze;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ey(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ey(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);iy(n[0],s,i),iy(n[1],e-s,i)}};let sy=!1;const ny=new Ea((t=>{sy||(sy=!0,t($f).toSelf().inSingletonScope(),t(qm).to($f).inSingletonScope(),t(Qm).toService(qm),t(Kp).toService(mf),lo(t,Kp))}));let ry=!1;const ay=new Ea((t=>{ry||(ry=!0,t(bm).toSelf().inSingletonScope(),t(nv).to(bm).inSingletonScope(),t(Qm).toService(nv),t(Of).toSelf(),t(Rf).toSelf(),t(ig).toService(Of),t(ig).toService(Rf),t(ig).toService(mf),lo(t,ig))}));let oy=!1;const ly=new Ea((t=>{oy||(oy=!0,t(sm).toSelf().inSingletonScope(),t(o_).toSelf().inSingletonScope(),t(ev).to(sm).inSingletonScope(),t(Qm).toService(ev))}));let hy=!1;const cy=new Ea((t=>{hy||(hy=!0,t(cm).toSelf().inSingletonScope(),t(Zm).to(cm).inSingletonScope(),t(Qm).toService(Zm),t(qp).toService(mf),lo(t,qp),t(h_).toSelf().inSingletonScope())}));let dy=!1;const uy=new Ea((t=>{dy||(dy=!0,t(Am).toSelf().inSingletonScope(),t(rv).to(Am).inSingletonScope(),t(Qm).toService(rv),t(sg).toService(mf),lo(t,sg))}));let py=!1;const gy=new Ea((t=>{py||(py=!0,t(Jf).toSelf().inSingletonScope(),t(Jm).to(Jf).inSingletonScope(),t(Qm).toService(Jm),t(Zp).toService(mf),lo(t,Zp))}));let fy=!1;const my=new Ea((t=>{fy||(fy=!0,t(av).to(Pm).inSingletonScope(),t(Qm).toService(av),t(ng).toService(mf),lo(t,ng))}));let vy=!1;const _y=new Ea((t=>{vy||(vy=!0,t(mm).toSelf().inSingletonScope(),t(iv).to(mm).inSingletonScope(),t(Qm).toService(iv),t(tg).toService(mf),lo(t,tg))}));let yy=!1;const by=new Ea((t=>{yy||(yy=!0,t(sv).to(jm).inSingletonScope(),t(Qm).toService(sv),t(eg).toService(mf),lo(t,eg))}));var xy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Sy=class{constructor(){this.numberType=Cu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Sy=xy([Ua()],Sy);let ky=!1;const Ay=new Ea((t=>{ky||(ky=!0,t(lv).to(Sy).inSingletonScope(),t(Qm).toService(lv))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ty=class extends Uf{constructor(){super(),this.numberType=Lu,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Np(o,l,!0),d=Np(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};Ty=My([Ua(),wy("design:paramtypes",[])],Ty);let Cy=!1;const By=new Ea((t=>{Cy||(Cy=!0,t(ov).to(Ty).inSingletonScope(),t(Qm).toService(ov))}));let Py=!1;const Ey=new Ea((t=>{Py||(Py=!0,t(hv).to($m).inSingletonScope(),t(Qm).toService(hv),t(Qp).toService(mf),lo(t,Qp))}));function Ry(t){const e=[];for(let i=0;i=0&&n>=0&&snt.getInstance().info(`[VChart log]: ${t}`,...e),Ly=(t,e)=>(c(Fy.warnHandler)&&Fy.warnHandler.call(null,t,e),e?nt.getInstance().warn(`[VChart warn]: ${t}`,e):nt.getInstance().warn(`[VChart warn]: ${t}`)),Dy=(t,e,i)=>{if(!c(Fy.errorHandler))throw new Error(t);Fy.errorHandler.call(null,t,e)},Fy={silent:!1,warnHandler:!1,errorHandler:!1},zy=B_(),jy=zy&&globalThis?globalThis.document:void 0;function Hy(t){return("desktop-browser"===t||"mobile-browser"===t)&&zy}function Vy(t){return Ny(t)||"mobile-browser"===t}function Ny(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Wy=0;function Uy(){return Wy>=9999999&&(Wy=0),Wy++}function Gy(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function Yy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Xy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class $y extends wp{constructor(t,e){super(t),this._skipRenderAttributes=Xy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},Sb=(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 kb extends o{constructor(t,e={}){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.startTime=Ic.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=Ic.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||xb(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=Sb(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=Ic.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=Sb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=xb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Sb(s[0],t){vo.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){if(!this.element)return;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},Mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const wb=[0,0,0];let Tb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Nl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ul),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Gl),{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ve(1,0,0,1,0,0),this._clearMatrix=new Ve(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&nt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ve(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Ku.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&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=jt;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(f,-2*y),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&&fp.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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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,e=vo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Gl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Gl.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&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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=ph(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:uh(this,a,this.dpr),r.strokeStyle=ph(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};Tb.env="browser",Tb=Ab([Ua(),Mb("design:paramtypes",[Object,Number])],Tb);var Cb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pb=class extends sp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Tb(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 Eb(t,e){return new Ea((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Eh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Pb.env="browser",Pb=Cb([Ua(),Bb("design:paramtypes",[Object])],Pb);const Rb=Eb(Pb,Tb);var 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},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lb=function(t,e){return function(i,s){e(i,s,t)}};let Db=class extends N_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=oc.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 zb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};zb=Fb([Ua()],zb);const jb=new Ea(((t,e,i,s)=>{jb.__vloaded||(jb.__vloaded=!0,t(yb).to(zb).inSingletonScope(),t(bb).toService(yb),lo(t,bb))}));jb.__vloaded=!1;var Hb=jb;const Vb=new Ea(((t,e,i,s)=>{i(Db)||t(Db).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(Db):t(Tv).toService(Db)}));var Nb,Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ub=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Gb=Nb=class extends z_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Nb.idprefix}_${Nb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vo.global,this.viewBox=new je,this.modelMatrix=new Ve(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:Nb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Pb(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 Pb({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)}};Gb.env="browser",Gb.idprefix="visactor_window",Gb.prefix_count=0,Gb=Nb=Wb([Ua(),Ub("design:paramtypes",[])],Gb);const Yb=new Ea((t=>{t(Gb).toSelf(),t(dc).toDynamicValue((t=>t.container.get(Gb))).whenTargetNamed(Gb.env)}));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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kb=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 qb{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 Zb(t,e=!1){const i=document.createElement("img");if(vo.global.isImageAnonymous&&(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 Jb=class extends L_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 qb(t)}return new je}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Zb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Zb(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:Pa.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(...t){}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}}loadFont(t,e,i){return Kb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Jb=Xb([Ua(),$b("design:paramtypes",[])],Jb);const Qb=new Ea((t=>{Qb.isBrowserBound||(Qb.isBrowserBound=!0,t(Jb).toSelf().inSingletonScope(),t(po).toService(Jb))}));function tx(t,e=!0){tx.__loaded||(tx.__loaded=!0,t.load(Qb),t.load(Rb),t.load(Yb),e&&function(t){t.load(Hb),t.load(Vb)}(t))}Qb.isBrowserBound=!1,tx.__loaded=!1;var ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ix=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sx=function(t,e){return function(i,s){e(i,s,t)}};let nx=class extends N_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 ep(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}};nx=ex([Ua(),sx(0,Na(ao)),sx(0,Ga(Ky)),sx(1,Na(ao)),sx(1,Ga(Bv)),sx(2,Na(ao)),sx(2,Ga(Pv)),ix("design:paramtypes",[Object,Object,Object])],nx);const rx=new Ea((t=>{rx.__vloaded||(rx.__vloaded=!0,lo(t,Ky))}));rx.__vloaded=!1;var ax=rx;class ox{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:uh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var lx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cx=function(t,e){return function(i,s){e(i,s,t)}};let dx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Au}};dx=lx([Ua(),cx(0,Na(qm)),hx("design:paramtypes",[Object])],dx);let ux=!1;const px=new Ea(((t,e,i,s)=>{ux||(ux=!0,t(qy).to(dx).inSingletonScope(),t(Ky).toService(qy))}));var gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fx=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 vx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};vx=gx([Ua(),mx(0,Na(Zm)),fx("design:paramtypes",[Object])],vx);let _x=!1;const yx=new Ea(((t,e,i,s)=>{_x||(_x=!0,t(Zy).to(vx).inSingletonScope(),t(Ky).toService(Zy))}));var bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sx=function(t,e){return function(i,s){e(i,s,t)}};let kx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Tu}};kx=bx([Ua(),Sx(0,Na(Jm)),xx("design:paramtypes",[Object])],kx);let Ax=!1;const Mx=new Ea(((t,e,i,s)=>{Ax||(Ax=!0,t(Jy).to(kx).inSingletonScope(),t(Ky).toService(Jy))}));class wx{constructor(){this.type="glyph",this.numberType=Cu}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 Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Px=class extends wx{constructor(t){super(),this.canvasRenderer=t}};Px=Tx([Ua(),Bx(0,Na(lv)),Cx("design:paramtypes",[Object])],Px);let Ex=!1;const Rx=new Ea(((t,e,i,s)=>{Ex||(Ex=!0,t(ab).to(Px).inSingletonScope(),t(Px).toService(ab))}));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};let Ix=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Ix=Ox([Ua()],Ix);let Lx=!1;const Dx=new Ea(((t,e,i,s)=>{Lx||(Lx=!0,t(Qy).to(Ix).inSingletonScope(),t(Ix).toService(Qy))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jx=function(t,e){return function(i,s){e(i,s,t)}};let Hx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Eu}};Hx=Fx([Ua(),jx(0,Na(ev)),zx("design:paramtypes",[Object])],Hx);let Vx=!1;const Nx=new Ea(((t,e,i,s)=>{Vx||(Vx=!0,t(tb).to(Hx).inSingletonScope(),t(Ky).toService(tb))}));var Wx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Gx=function(t,e){return function(i,s){e(i,s,t)}};let Yx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};Yx=Wx([Ua(),Gx(0,Na(sv)),Ux("design:paramtypes",[Object])],Yx);let Xx=!1;const $x=new Ea(((t,e,i,s)=>{Xx||(Xx=!0,t(rb).to(Yx).inSingletonScope(),t(Ky).toService(rb))}));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},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};Jx=Kx([Ua(),Zx(0,Na(iv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Ea(((t,e,i,s)=>{Qx||(Qx=!0,t(eb).to(Jx).inSingletonScope(),t(Ky).toService(eb))})),eS=new je;class iS{constructor(){this.type="rect",this.numberType=Iu}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||x(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:uh(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;eS.setValue(i.x1,i.y1,i.x2,i.y2),eS.expand(-r/2),h=!eS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class extends iS{constructor(t){super(),this.canvasRenderer=t}};aS=sS([Ua(),rS(0,Na(nv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new Ea(((t,e,i,s)=>{oS||(oS=!0,t(ib).to(aS).inSingletonScope(),t(Ky).toService(ib))}));let hS=!1;const cS=new Ea(((t,e,i,s)=>{hS||(hS=!0,t(Qy).to(Ix).inSingletonScope(),t(Ix).toService(Qy))}));var dS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pS=function(t,e){return function(i,s){e(i,s,t)}};let gS=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}};gS=dS([Ua(),pS(0,Na(rv)),uS("design:paramtypes",[Object])],gS);let fS=!1;const mS=new Ea(((t,e,i,s)=>{fS||(fS=!0,t(sb).to(gS).inSingletonScope(),t(Ky).toService(sb))}));var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{constructor(){this.type="text",this.numberType=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};_S=vS([Ua()],_S);let yS=!1;const bS=new Ea(((t,e,i,s)=>{yS||(yS=!0,t(nb).to(_S).inSingletonScope(),t(Ky).toService(nb))})),xS=new Ea(((t,e,i,s)=>{i(nx)||t(nx).toSelf().inSingletonScope(),i(Tv)?s(Tv).toService(nx):t(Tv).toService(nx)}));class SS{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 kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let MS=class extends Tb{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 Ve(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};MS.env="node",MS=kS([Ua(),AS("design:paramtypes",[Object,Number])],MS);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 sp{constructor(t){super(t)}init(){this._context=new MS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};CS.env="node",CS=wS([Ua(),TS("design:paramtypes",[Object])],CS);const BS=Eb(CS,MS);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},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class extends z_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new CS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new CS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};OS.env="node",OS=PS([Ua(),RS(0,Na(go)),ES("design:paramtypes",[Object])],OS);const IS=new Ea((t=>{t(OS).toSelf(),t(dc).toDynamicValue((t=>t.container.get(OS))).whenTargetNamed(OS.env)}));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 DS=class extends L_{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 Qc.call(t)}}getCancelAnimationFrame(){return t=>{Qc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};DS=LS([Ua()],DS);const FS=new Ea((t=>{FS.isNodeBound||(FS.isNodeBound=!0,t(DS).toSelf().inSingletonScope(),t(po).toService(DS))}));function zS(t,e=!0){zS.__loaded||(zS.__loaded=!0,t.load(FS),t.load(BS),t.load(IS))}FS.isNodeBound=!1,zS.__loaded=!1;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};let HS=class extends Tb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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(a>1e-12&&o>1e-12){const{lineWidth:l=n.lineWidth,stroke:h=n.stroke,lineJoin:c=n.lineJoin,lineDash:d=n.lineDash,lineCap:u=n.lineCap,miterLimit:p=n.miterLimit,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:uh(this,l,this.dpr),r.strokeStyle=ph(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=vo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,vo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Oe(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Oe(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};HS.env="harmony",HS=jS([Ua()],HS);var VS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends sp{constructor(t){super(t)}init(){this._context=new HS(this,this._dpr)}resize(t,e){}release(...t){}};WS.env="harmony",WS=VS([Ua(),NS("design:paramtypes",[Object])],WS);var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},YS=function(t,e){return function(i,s){e(i,s,t)}};class XS{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 $S=class extends z_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new XS}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{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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new WS(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}this.canvas=new WS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};$S.env="harmony",$S=US([Ua(),YS(0,Na(go)),GS("design:paramtypes",[Object])],$S);const KS=new Ea((t=>{t($S).toSelf(),t(dc).toDynamicValue((t=>t.container.get($S))).whenTargetNamed($S.env)})),qS=Eb(WS,HS);var ZS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let QS=class extends L_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new Jc(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new SS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};QS=ZS([Ua(),JS("design:paramtypes",[])],QS);const tk=new Ea((t=>{tk.isHarmonyBound||(tk.isHarmonyBound=!0,t(QS).toSelf().inSingletonScope(),t(po).toService(QS))}));function ek(t,e=!0){ek.__loaded||(ek.__loaded=!0,t.load(tk),t.load(qS),t.load(KS),e&&function(t){t.load(ax),t.load(xS),t.load(px),t.load(yx),t.load(Mx),t.load(Rx),t.load(Dx),t.load(Nx),t.load($x),t.load(tS),t.load(lS),t.load(cS),t.load(mS),t.load(bS)}(t))}tk.isHarmonyBound=!1,ek.__loaded=!1;var ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nk=function(t,e){return function(i,s){e(i,s,t)}};let rk=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Au}};rk=ik([Ua(),nk(0,Na(qm)),sk("design:paramtypes",[Object])],rk);let ak=!1;const ok=new Ea(((t,e,i,s)=>{ak||(ak=!0,t(ob).to(rk).inSingletonScope(),t(bb).toService(ob))}));var lk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ck=function(t,e){return function(i,s){e(i,s,t)}};let dk=class extends iS{constructor(t){super(),this.canvasRenderer=t}};dk=lk([Ua(),ck(0,Na(nv)),hk("design:paramtypes",[Object])],dk);let uk=!1;const pk=new Ea(((t,e,i,s)=>{uk||(uk=!0,t(pb).to(dk).inSingletonScope(),t(bb).toService(pb))}));class gk extends Uf{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:uh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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},mk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vk=function(t,e){return function(i,s){e(i,s,t)}};let _k=class extends gk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Eu}};_k=fk([Ua(),vk(0,Na(ev)),mk("design:paramtypes",[Object])],_k);let yk=!1;const bk=new Ea(((t,e,i,s)=>{yk||(yk=!0,t(db).to(_k).inSingletonScope(),t(bb).toService(db))}));var xk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Ak=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};Ak=xk([Ua(),kk(0,Na(Zm)),Sk("design:paramtypes",[Object])],Ak);let Mk=!1;const wk=new Ea(((t,e,i,s)=>{Mk||(Mk=!0,t(lb).to(Ak).inSingletonScope(),t(bb).toService(lb))}));class Tk extends Uf{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&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Pk=function(t,e){return function(i,s){e(i,s,t)}};let Ek=class extends Tk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}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:uh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&qu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Ek=Ck([Ua(),Pk(0,Na(rv)),Bk("design:paramtypes",[Object])],Ek);let Rk=!1;const Ok=new Ea(((t,e,i,s)=>{Rk||(Rk=!0,t(gb).to(Ek).inSingletonScope(),t(bb).toService(gb))}));var Ik=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dk=function(t,e){return function(i,s){e(i,s,t)}};let Fk=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Tu}};Fk=Ik([Ua(),Dk(0,Na(Jm)),Lk("design:paramtypes",[Object])],Fk);let zk=!1;const jk=new Ea(((t,e,i,s)=>{zk||(zk=!0,t(hb).to(Fk).inSingletonScope(),t(bb).toService(hb))}));var Hk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nk=function(t,e){return function(i,s){e(i,s,t)}};let Wk=class extends Tk{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Fu}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=og(a,u,n),v=ag(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&&qu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Wk=Hk([Ua(),Nk(0,Na(av)),Vk("design:paramtypes",[Object])],Wk);let Uk=!1;const Gk=new Ea(((t,e,i,s)=>{Uk||(Uk=!0,t(fb).to(Wk).inSingletonScope(),t(bb).toService(fb))}));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},Xk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$k=function(t,e){return function(i,s){e(i,s,t)}};let Kk=class extends gk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};Kk=Yk([Ua(),$k(0,Na(iv)),Xk("design:paramtypes",[Object])],Kk);let qk=!1;const Zk=new Ea(((t,e,i,s)=>{qk||(qk=!0,t(ub).to(Kk).inSingletonScope(),t(bb).toService(ub))}));var Jk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},tA=function(t,e){return function(i,s){e(i,s,t)}};let eA=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};eA=Jk([Ua(),tA(0,Na(sv)),Qk("design:paramtypes",[Object])],eA);let iA=!1;const sA=new Ea(((t,e,i,s)=>{iA||(iA=!0,t(mb).to(eA).inSingletonScope(),t(bb).toService(mb))}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends wx{constructor(t){super(),this.canvasRenderer=t}};oA=nA([Ua(),aA(0,Na(lv)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new Ea(((t,e,i,s)=>{lA||(lA=!0,t(_b).to(oA).inSingletonScope(),t(bb).toService(_b))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Lu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};pA=cA([Ua(),uA(0,Na(ov)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new Ea(((t,e,i,s)=>{gA||(gA=!0,t(vb).to(pA).inSingletonScope(),t(bb).toService(vb))}));var mA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_A=function(t,e){return function(i,s){e(i,s,t)}};let yA=class extends ox{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};yA=mA([Ua(),_A(0,Na(hv)),vA("design:paramtypes",[Object])],yA);let bA=!1;const xA=new Ea(((t,e,i,s)=>{bA||(bA=!0,t(cb).to(yA).inSingletonScope(),t(bb).toService(cb))})),SA=B_();function kA(){kA.__loaded||(kA.__loaded=!0,of.RegisterGraphicCreator("arc",tf),fo.load(ny),fo.load(SA?ok:px))}kA.__loaded=!1;const AA=kA;function MA(){MA.__loaded||(MA.__loaded=!0,of.RegisterGraphicCreator("area",Zg),fo.load(cy),fo.load(SA?wk:yx))}MA.__loaded=!1;const wA=MA;function TA(){TA.__loaded||(TA.__loaded=!0,of.RegisterGraphicCreator("circle",mg),fo.load(gy),fo.load(SA?jk:Mx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,of.RegisterGraphicCreator("glyph",Rg),fo.load(Ay),fo.load(SA?hA:Rx))}BA.__loaded=!1;const PA=BA;function EA(){EA.__loaded||(EA.__loaded=!0,of.RegisterGraphicCreator("group",Tp))}EA.__loaded=!1;const RA=EA;function OA(){OA.__loaded||(OA.__loaded=!0,of.RegisterGraphicCreator("image",zg),fo.load(Ey),fo.load(SA?xA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,of.RegisterGraphicCreator("line",wg),fo.load(ly),fo.load(SA?bk:Nx))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,of.RegisterGraphicCreator("path",$g),fo.load(_y),fo.load(SA?Zk:tS))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,of.RegisterGraphicCreator("polygon",nf),fo.load(by),fo.load(SA?sA:$x))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,of.RegisterGraphicCreator("rect",Pg),fo.load(ay),fo.load(SA?pk:lS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,of.RegisterGraphicCreator("richtext",Gg),fo.load(By),fo.load(SA?fA:cS))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,of.RegisterGraphicCreator("shadowRoot",af))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,of.RegisterGraphicCreator("symbol",kg),fo.load(uy),fo.load(SA?Ok:mS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,of.RegisterGraphicCreator("text",bg),fo.load(my),fo.load(SA?Gk:bS))}KA.__loaded=!1;const qA=KA;function ZA(){RA(),NA()}const JA=-.5*Math.PI,QA=1.5*Math.PI,tM="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 eM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(eM||(eM={}));const iM={[eM.selectedReverse]:{},[eM.selected]:{},[eM.hover]:{},[eM.hoverReverse]:{}},sM={container:"",width:30,height:30,style:{}},nM="scrollDrag";function rM(){return"browser"===__.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const aM={debounce:yt,throttle:bt};ZA();let oM=class t extends $y{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=rM(),a="browser"===__.env?__:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:aM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:mt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=mt(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(nM,{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",aM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(mt(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:si(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]=si(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]=mt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?mt([a+i*n,a+s*n],a,n-l):mt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=rM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};oM.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};var lM,hM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 cM=lM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new ze).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ht(t.deltaX)>Ht(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new je,e.addEventListener("wheel",this.scroll),this.params=lM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(nM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new oM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(cM)||(t(cM).toSelf(),t(zv).toService(cM))}));function uM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&uM(t,e)}))}const pM=t=>!d(t)&&!1!==t.visible;function gM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function fM(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 vM=["#ffffff","#000000"];function _M(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Qe(t).toHex(),o=new Qe(e).toHex();return yM(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(...vM);for(const n of a)if(t!==n&&yM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function yM(t,e,i,s,n){if("lightness"===n){const i=Qe.getColorBrightness(new Qe(e));return Qe.getColorBrightness(new Qe(t))<.5?i>=.5:i<.5}return s?bM(t,e)>s:"largeText"===i?bM(t,e)>3:bM(t,e)>4.5}function bM(t,e){const i=xM(t),s=xM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function xM(t){const e=ei(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 SM(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 kM(t,e){return[t[0]*e,t[1]*e]}function AM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function MM(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=qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const wM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:tM,fontSize:14},s),getTextBounds:i?void 0:cf,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function TM(t,e,i={}){if(!t)return{width:0,height:0};const s=cf({text:t,fontFamily:e.fontFamily||i.fontFamily||tM,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 CM(t,e="type"){var i,s;return p(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 BM(t){var e,i;return u(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,e="type"){const i=CM(t,e);return"rich"===i?of.richtext(BM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),of.text(t))}function EM(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 RM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function OM(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 IM(t,e){const{dx:i,dy:s}=OM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function LM(){RA(),NA(),$A(),UA(),qA()}var DM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),P(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=DM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new zl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},FM.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))}}FM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const zM={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}},jM={poptip:z({},zM)};var HM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Ut(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Ut(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Dt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Dt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Dt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Dt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Dt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Dt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}XM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let KM=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,XM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new XM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,jM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};KM=$M([Ua()],KM);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};class ZM{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 JM=class extends ZM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};JM=qM([Ua()],JM);let QM=class extends ZM{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)}};QM=qM([Ua()],QM);const tw=new Ea(((t,e,i,s)=>{i(KM)||(t(KM).toSelf().inSingletonScope(),t(rg).toService(KM)),i(JM)||(t(JM).toSelf(),t(zv).toService(JM)),i(QM)||(t(QM).toSelf(),t(zv).toService(QM))}));class ew extends $y{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}RA(),DA();class iw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},iw.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})}}iw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},RA(),NA();class sw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sw.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})}}sw.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},RA(),AA();class nw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},nw.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=se.distancePP(t,e);this.setAttribute("radius",i)}}nw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},RA(),AA();class rw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rw.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=JA,endAngle:s=QA}=this.attribute,n=s-i,r=re(he(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}rw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},RA(),zA();class aw extends ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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=oe(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=se.distancePP(t,e);this.setAttribute("radius",i)}}function ow(){RA(),DA(),HA(),$A()}function lw(){RA(),DA(),AA(),$A()}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},ow();class hw extends $y{getStartAngle(){return ce(this._startAngle)}getEndAngle(){return ce(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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(k(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=of.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),P(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=of.line;G(i)[0].cornerRadius&&(t=of.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=of.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}hw.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}}},lw();class cw extends hw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=of.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var dw,uw;!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"}(dw||(dw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uw||(uw={}));const pw={[uw.selectedReverse]:{},[uw.selected]:{},[uw.hover]:{},[uw.hoverReverse]:{}},gw={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}}},fw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const mw=Math.sin(Math.PI/10);function vw(t,e=mw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function _w(t,e=mw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function yw(t){const e={};return uM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function bw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function xw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return kM(r,(s?-1:1)*(n?-1:1)*t/AM(r))}function Sw(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 Aw(t,e,i){var s;if(_w(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Le(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Le(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>De(n,r)}function Mw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(eM.hover,!0),uM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(eM.hoverReverse,!0)})),s):i},Tw=(t,e,i)=>i?(uM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(eM.hoverReverse),t.removeState(eM.hover))})),null):i,Cw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(eM.selected)?(uM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(eM.selectedReverse),t.removeState(eM.selected))})),null):s.name&&!P(s.states)?(s.addState(eM.selected,!0),uM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(eM.selectedReverse,!0)})),s):i};class Bw extends $y{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Pw={type:"default",duration:300,easing:"linear"};class Ew extends Bw{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=Tw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Cw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=of.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._prepare(),this._prevInnerView=this._innerView&&yw(this._innerView),this.removeAllChild(!0),this._innerView=of.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Pw)}_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=of.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=dw.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=of.group({x:0,y:0,pickable:!1});t.name=dw.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=of.group({x:0,y:0,pickable:!1});i.name=dw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=of.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=dw.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=iM;else{const t=this.data[s],e=z({},iM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=of.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=dw.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=iM;else{const i=z({},iM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=of.group({x:0,y:0,pickable:!1});return r.name=`${dw.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=dw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=iM;else{const s=z({},iM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new FM(Object.assign({},e));i.name=dw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return bw(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&&c(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;Ht(s[0])>Ht(s[1])?o=Dt/2*(l.x>e.x?1:-1):h=Dt/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+E(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+E(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:_}=this.attribute.label;_=c(_)?z({},gw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d: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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},uM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Rw={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&&Aw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Ow(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Iw(t,e,i,s,n=!1){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=c(n)?n:Rw[n]||Rw.parity;if(s.length>=3&&Mw(s,r)){do{s=a(s,r)}while(s.length>=3&&Mw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Aw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Iw(l,s,n,(t=>Aw(t,l,r))),Iw(h,s,o,(t=>Aw(t,h,r)||!(!n||t===l)&&Aw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Dw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},jw(t,e.attribute.angle)),{angle:zw(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({},Hw(t,e.attribute.angle)),{angle:zw(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=ke({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 zw(t=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 jw(t,e=0){let 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=zw(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 Hw(t,e=0){let 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=zw(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 Vw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=_w(h),m=vw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);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(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(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 Nw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Ww{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=AM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return kM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Uw{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-Uw.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Uw.bounceIn(2*t):.5*Uw.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/jt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*jt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/jt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*jt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*jt/e)*.5+1}}static registerFunc(t,e){Uw[t]=e}}function Gw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Uw.quadIn=Uw.getPowIn(2),Uw.quadOut=Uw.getPowOut(2),Uw.quadInOut=Uw.getPowInOut(2),Uw.cubicIn=Uw.getPowIn(3),Uw.cubicOut=Uw.getPowOut(3),Uw.cubicInOut=Uw.getPowInOut(3),Uw.quartIn=Uw.getPowIn(4),Uw.quartOut=Uw.getPowOut(4),Uw.quartInOut=Uw.getPowInOut(4),Uw.quintIn=Uw.getPowIn(5),Uw.quintOut=Uw.getPowOut(5),Uw.quintInOut=Uw.getPowInOut(5),Uw.backIn=Uw.getBackIn(1.7),Uw.backOut=Uw.getBackOut(1.7),Uw.backInOut=Uw.getBackInOut(1.7),Uw.elasticIn=Uw.getElasticIn(1,.3),Uw.elasticOut=Uw.getElasticOut(1,.3),Uw.elasticInOut=Uw.getElasticInOut(1,.3*1.5),Uw.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Uw.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Uw.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Uw[`flicker${t}`]=e=>Gw(e,t);for(let t=2;t<10;t++)Uw[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Yw(t,e,i){return t+(e-t)*i}const Xw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Yw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Yw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Yw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Yw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Yw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Yw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Yw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Yw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Yw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=op(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?hp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=op(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?hp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Yw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Yw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Yw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Yw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Yw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Yw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Yw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Yw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Yw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Yw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=qc(e,i,s),r.addUpdateBoundTag()}}};function $w(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Uw[s])&&void 0!==n?n:Uw.linear:Uw.linear,"wait"===t&&(this.onUpdate=Kw),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=Kw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=rp.Get(i,np.Color255),r=rp.Get(s,np.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Xw["fill"===e?"fillPure":"strokePure"])}else Xw[e]?t.push(Xw[e]):t.push($w)}else Xw[e]?t.push(Xw[e]):t.push($w)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class Zw extends qw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class Jw extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bo.END?this.removeAnimate(t,!0):t.status!==Bo.RUNNING&&t.status!==Bo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const Qw=new Jw;Qw.isGlobal=!0;class tT{constructor(t=Pa.GenAutoIncrementId(),e=Qw,i){this.id=t,this.status=Bo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new qw(Co.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new Zw(Co.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new qw(Co.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bo.RUNNING&&(this.status=Bo.PAUSED)}resume(){this.status===Bo.PAUSED&&(this.status=Bo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Bo.END&&this.onEnd(),this.status=Bo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Bo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Bo.END);this.status=Bo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const eT=new yo;class iT{constructor(){this.released=!1}tick(t,e){eT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class sT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===To.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=To.INITIAL,vo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),vo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new iT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==To.INITIAL&&(this.status=To.PAUSE,!0)}resume(){return this.status!==To.INITIAL&&(this.status=To.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===To.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===To.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=To.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=To.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===To.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===To.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}aT.getInstance();class oT{static registerBuiltInAnimate(t,e){oT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:oT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&c(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),d=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+d:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:oT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&c(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+d+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=d*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const P=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,E=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;E&&R&&(i=null!==(h=E[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+P;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_;if(e&&i){const d=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=c(h)?h.call(null,null!==(m=d&&(null===(f=d.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,d):h;d.options=y,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:oT.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}oT.builtInAnimateMap={};const lT="appear",hT="disappear",cT="update",dT="highlight",uT="unhighlight";class pT{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class gT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=aT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new oT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new oT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([lT],[{name:lT,animation:t}],e)}applyDisappearState(t,e){this.applyState([hT],[{name:hT,animation:t}],e)}applyUpdateState(t,e){this.applyState([cT],[{name:cT,animation:t}],e)}applyHighlightState(t,e){this.applyState([dT],[{name:dT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([uT],[{name:uT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class fT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new gT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new pT(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new fT)._getAnimationStateManager(t),t}}class mT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new tT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:Qw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new Jw}createTicker(t){return new sT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new oT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function vT(){U(Ap,fT),U(Ap,mT)}class _T extends qw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class yT extends _T{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class bT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new oT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function xT(t){return new bT(t)}class ST extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kT=1e3,AT="quadInOut",MT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],wT=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=op(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},TT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?K_(t):[],n=K_(e);i&&s&&(i.fromTransform&&q_(s,i.fromTransform.clone().getInverse()),q_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},BT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],PT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!BT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?rp.Get(t,np.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class ET extends _T{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;TT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&wT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const RT=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=CT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=PT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new ET({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:AT);return c.play(d),c};class OT extends _T{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;TT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&wT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const IT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MT.includes(t))(i)||(e[i]=t[i])})),e},LT=(t,e,i)=>{const s=IT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=vo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},DT=(t,e,i)=>{const s=[],n=i?null:IT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:IT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Tg(t.attribute),n=J_(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(vo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=J_(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=J_(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return Q_(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return Q_(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(vo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ty(i)}];const s=[];return iy(i,e,s),s})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&x(t.x)&&x(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return iy(l,e,h),h})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=K_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(vo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&<(t,s,e),s};class zT extends _T{constructor(t,e,i,s,n){super(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(){super.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:Uo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Uo.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:Uo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class jT extends zT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=vo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 HT extends zT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=vo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class VT extends _T{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ie(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Kc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class NT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class WT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class UT extends NT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class GT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class YT extends NT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class XT extends WT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const $T=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class KT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qT extends KT{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$T(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class ZT extends KT{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class JT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QT extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Kc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class xC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class SC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class kC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class AC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends AC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class wC extends AC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class TC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class CC extends TC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class BC extends TC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=dt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class PC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class EC extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=vo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new zl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=vo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=nl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=nl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(se.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=of.group({zIndex:999});e.name=dw.axisBreak,e.id=this._getNodeId(`${dw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},fw,s),a=null!==(e=r.size)&&void 0!==e?e:fw.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=of.symbol(Object.assign({x:s.x,y:s.y},o));l.name=dw.axisBreakSymbol;const h=of.symbol(Object.assign({x:n.x,y:n.y},o));h.name=dw.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=of.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=dw.background,n.id=this._getNodeId("background"),n.states=z({},pw,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=LC(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];P(l)||(c.state={line:z({},pw,l),symbol:z({},pw,l)});const d=new hw(c);d.name=dw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return dt(t[0],0)?dt(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:u}=s,p=LC(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),_=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=+E(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",d(T)&&o){T=MM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),w=this.getTextBaseline(A,!1);let C=u;if(d(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(k(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},pw,c.text),shape:z({},pw,c.shape),panel:z({},pw,c.background)}});return B.angle=T,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return dt(t[1],0)?i=!dt(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 jw(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Hw(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(P(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=ne(e)})),Fw(i,t),!Dw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=_w(a),l=vw(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=Nw(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);k(i)&&(c=Ut(c,i))}}else{if(l){const i=Nw(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);k(i)&&(c=Ut(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&&k(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);Vw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&Lw(t,{orient:o,method:m,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(k(c)&&(!k(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=of.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=dw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(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=TM(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=si(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}}DC.defaultAttributes=gw,U(DC,Ww);class FC{isInValidValue(t){const{startAngle:e=JA,endAngle:i=QA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=JA,endAngle:i=QA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return oe(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return xw(t,i,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 zC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=zC(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 VC=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),k(l)&&l>=3){const t=Sw(n,l,c,e,i);h=of.path(Object.assign(Object.assign({},a.style),{path:kw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=of.circle(t)}h.name=dw.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=z({},pw,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:u={}}=a,p=VC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=E(this.attribute.label,"style.fontSize",12)+E(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},pw,u.text),shape:z({},pw,u.shape),panel:z({},pw,u.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(dt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=zC(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&&jC(e,c,i)}else e.AABBBounds.width()>r&&jC(e,r,i)}else o>a.x&&h.x2>n.x2?(jC(e,n.x2-o,i),r&&HC(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return dt(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}}NC.defaultAttributes=gw,U(NC,FC);const WC=t=>t.map(((t,e)=>({index:e,value:t}))),UC=(t,e,i=0)=>{const s=new je(t).expand(i/2),n=new je(e).expand(i/2);return s.intersects(n)},GC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ne(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=wM(a),_=t.range();let y=[];for(let i=0;i{$C[t]=!0}));const QC=t=>-Math.log(-t),tB=t=>-Math.exp(-t),eB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,iB=t=>10===t?eB:t===Math.E?Math.exp:e=>Math.pow(t,e),sB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),nB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),rB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function aB(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 oB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function lB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function hB(t,e,i,s){return 1===i&&(i=0),lB(t,i,s)*(e/(1-i))}function cB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function dB(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]{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 pB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=cB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 gB=Symbol("implicit");class fB extends pB{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=XC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=gB}clone(){const t=(new fB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==gB)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 mB(t,e,r,n)}class _B extends fB{constructor(t){super(),this.type=XC.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=hB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:vB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return vB(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=vt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new _B(!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:yB}=ii;function bB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return xt(t,e);if("string"===i){if(s=Qe.parseColorString(e)){const e=yB(Qe.parseColorString(t),s);return t=>e(t).formatRgb()}return xt(Number(t),Number(e))}return e instanceof ti?yB(t,e):e instanceof Qe?yB(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):xt(Number(t),Number(e))}class xB extends pB{constructor(t=JC,e=JC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=JC,this._piecewise=oB,this._interpolate=bB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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),xt)),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,tt);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=St,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=vt(i[0],i[r-1])),this._piecewise=r>2?dB:oB,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:JC),this.rescale(i)):this._clamp!==JC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const SB=Math.sqrt(50),kB=Math.sqrt(10),AB=Math.sqrt(2),MB=[1,2,5,10],wB=(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=PB(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)),J(0,e).map((t=>n+t*s))):t>0?CB(0,-(e-1)/s,s):CB((e-1)/s,0,s)},TB=gt(((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 wB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return wB(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=CB(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=CB(t,e,l);return n&&r.reverse(),r})),PB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=MB[0];return i>=SB?s=MB[3]:i>=kB?s=MB[2]:i>=AB&&(s=MB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function EB(t,e,i){const s=(e-t)/Math.max(0,i);return PB(s)}function RB(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;e0;){if(s=EB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function IB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const LB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),DB=gt(((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})),FB=gt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=BB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?LB(t,e,n):LB(t,e,uB(n)),h=LB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),zB=gt(((t,e,i,s,n)=>RB(s(t),s(e),i).map((t=>uB(n(t))))));class jB extends xB{constructor(){super(...arguments),this.type=XC.Linear}clone(){var t;const e=new jB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return TB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=BB(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(t=10){const e=this.calculateVisibleDomain(this._range);return RB(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 VB(t){return e=>-t(-e)}function NB(t=Number.EPSILON){return e=>Math.max(e,t)}class WB extends xB{constructor(){super(sB(10),iB(10)),this.type=XC.Log,this._limit=NB(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new WB).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=sB(this._base),s=iB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=VB(i),this._pows=VB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=QC,this.untransformer=tB):(this._logs=i,this._pows=s,this._limit=NB(),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 JC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return DB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return zB(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(WB,HB);class UB extends jB{constructor(){super(nB(1),rB(1)),this.type=XC.Symlog,this._const=1}clone(){return(new UB).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=nB(t),this.untransformer=rB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return DB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return zB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(UB,HB);class GB{constructor(){this.type=XC.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!d(t)&&k(+t)?this._range[rt(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 GB).domain(this._domain).range(this._range).unknown(this._unknown)}}function YB(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 XB(t,e,i,s,n=!1){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,n,r;if(!KC(t.type))return WC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return WC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=YB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=YB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=YB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=YC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=YC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?KB.greedy:KB.parity;for(;l.length>=3&&Mw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Aw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),XB(t,l,a,(e=>Aw(e,t,i))),XB(n,l,o,(e=>Aw(e,n,i)||!(!a||e===t)&&Aw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return WC(m)},KB={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Aw(i,t,e)||(i=t,0))))}},qB=(t,e,i,s)=>{const n=YC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},ZB=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,JB=(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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?WC([s[s.length-1]]):WC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=qB(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=tP(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=qB(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!ZB(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?JB(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=wM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=oe({x:0,y:0},i,t),a=bw(r,xw(s,r,e,n));return o=a,l=xw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(dt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 WC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=eP(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=sP(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return WC(d)},sP=(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&&UC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},nP=new Uint32Array(33),rP=new Uint32Array(33);rP[0]=0,nP[0]=~rP[0];for(let t=1;t<=32;++t)rP[t]=rP[t-1]<<1|1,nP[t]=~rP[t];function aP(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&nP[31&o]&rP[1+(31&l)])return!0}else{if(i[h]&nP[31&o])return!0;if(i[c]&rP[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,nP[31&o]&rP[1+(31&l)]);else for(s(h,nP[31&o]),s(c,rP[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,rP[31&a]|nP[1+(31&o)]);else for(n(l,rP[31&a]),n(h,nP[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 oP(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ft(i,-o,t.width+l),d=ft(s,-o,t.width+l),u=ft(n,-a,t.height+h),p=ft(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function lP(t,e,i=!1){return i?oP(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function hP(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=lP(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=oP(t,r)),e.getRange(r)))}function cP(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>u(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return cP(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return cP(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return cP(t,e,n,s,h,d)}return!1}const uP=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],pP=["top","inside-top","inside"];function gP(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const fP={mode:"same-time",duration:300,easing:"linear"};function mP(t){return 3===t||4===t}function vP(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 _P=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 yP(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)}}var bP=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const kP=(t,e)=>Math.ceil(t)>Math.floor(e),AP=([t,e],[i,s])=>s>t&&e>i;function MP(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 wP=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||P(e.states)||(e.addState(eM.hover,!0),uM(this,(t=>{t===e||P(t.states)||t.addState(eM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(uM(this,(t=>{P(t.states)||(t.removeState(eM.hoverReverse),t.removeState(eM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void uM(this,(t=>{P(t.states)||(t.removeState(eM.selectedReverse),t.removeState(eM.selected))}));P(e.states)||(e.addState(eM.selected,!0),uM(this,(t=>{t===e||P(t.states)||t.addState(eM.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)===Uo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Uo.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(be(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[yP(g,f,c,d,a,o),yP(-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=of.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new zl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),c(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(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=c(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&kP(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&kP(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(dt(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(MP([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])&&!AP([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 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},h),{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(lP(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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(lP(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(lP(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{CP[t]=e};var PP=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{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,i,s)}}EP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const RP=()=>{BP("symbol",EP),BP("line-data",EP)};var OP=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{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}}}IP.tag="rect-label",IP.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var LP=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};DP.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const FP=()=>{BP("line",DP),BP("area",DP)};var zP=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=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=ue(h.endAngle-d/2),g=oe(c,h.outerRadius,o),f=oe(c,a+e.line.line1MinLength,o),m=new jP(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=oe(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):mP(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=oe(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ut(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=mP(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=mP(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&&(pt(t.pointB.x,this._line2MinLength+h)||ut(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=mP(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?d(h)||"auto"===h?"edge"===c?mP(t.quadrant)?"left":"right":mP(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(mP(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(dt(l/2,u))g=0,f=1,m=-p;else if(dt(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?dt(v[0].y,v[1].y)?ut(t.middleAngle,-Math.PI)&&pt(t.middleAngle,0)||ut(t.middleAngle,Math.PI)&&pt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 WP(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=se.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 UP(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=kw(t,!!n),o=kw(r,!!n);const h=se.distancePP(s,l),c=se.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=WP(e,t,!1,!!n),o=WP(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=kw(t,!!n),o=kw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}NP.defaultAttributes={pickable:!1};class GP extends $y{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&yw(this._innerView),this.removeAllChild(!0),this._innerView=of.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 bw(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?`${dw.grid}-sub`:`${dw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=kw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=WP(t,o,!1,!!a)}const u=of.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:GP.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=kw(o,!!a),m=Ht(o[0].x-o[1].x),v=Ht(o[0].y-o[1].y),_=of.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Dt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:GP.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),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=!dt(a.value,0)&&!dt(l.value,0),d=!dt(a.value,1)&&!dt(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}}GP.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},RA(),zA();class YP extends GP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},GP.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=JA,endAngle:r=QA}=this.attribute;i=Sw(t,s,se.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(YP,Ww);var XP=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($P,FC);const KP="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",qP={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:KP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:KP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},ZP={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 JP;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(JP||(JP={}));var QP=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=JP.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=JP.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=JP.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=JP.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=JP.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===__.env?__:this.stage,s=rM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===JP.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===JP.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=JP.endHandler):h+=l:this._activeTag===JP.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===JP.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===__.env?__:this.stage,e=rM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===JP.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===JP.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=QP(c,["formatMethod"]),{formatMethod:g}=d,f=QP(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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+m*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==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*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==f?void 0:f.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({},f,{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 ze).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:W}=this.attribute,{start:U,end:G}=this.state,{position:Y,width:X,height:$}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:X,height:$,cursor:N?"crosshair":"auto"},L),{pickable:!W&&(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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y,width:(G-U)*X,height:$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(r=z.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+U*$,width:X,height:(G-U)*$,cursor:N?"crosshair":"move"},F),{pickable:!W&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+U*X,y:Y.y-t,width:(G-U)*X,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!W&&(null===(p=null===(u=null===(d=j.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+(U+G)/2*X,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!W&&(null===(m=j.icon.pickable)||void 0===m||m)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*X,y:Y.y+$/2,size:$,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},ZP.horizontal),H),{pickable:!W&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*X,y:Y.y+$/2,size:$,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},ZP.horizontal),V),{pickable:!W&&(null===(b=V.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+U*X-t/2,y:Y.y+$/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},ZP.horizontal),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*X-i/2,y:Y.y+$/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},ZP.horizontal),{pickable:!W}),"rect")}else{if(j.visible){const t=(null===(x=j.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+X,y:Y.y+U*$,width:t,height:(G-U)*$},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!W&&(null===(M=null===(A=null===(k=j.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+X+t/2,y:Y.y+(U+G)/2*$,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=j.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},j.icon),{pickable:!W&&(null===(B=null===(C=j.icon)||void 0===C?void 0:C.pickable)||void 0===B||B)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+U*$,size:X,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},ZP.vertical),H),{pickable:!W&&(null===(E=H.pickable)||void 0===E||E)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+X/2,y:Y.y+G*$,size:X,symbolType:null!==(R=V.symbolType)&&void 0!==R?R:"square"},ZP.vertical),V),{pickable:!W&&(null===(O=V.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+X/2+t/2,y:Y.y+U*$-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},ZP.vertical),{pickable:!W}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+X/2+i/2,y:Y.y+G*$-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},ZP.vertical),{pickable:!W}),"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 FM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;u(t)&&u(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,...G(a))}setPreviewPointsX(t){c(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._statePointToData=t)}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var iE,sE,nE,rE;function aE(){RA(),LM(),vT()}eE.defaultAttributes=qP,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"}(iE||(iE={})),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"}(sE||(sE={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(nE||(nE={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(rE||(rE={}));class oE extends $y{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Tw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Cw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=of.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=of.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=of.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 lE(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 hE(t,e,i,s){t&&(lE(t.startSymbol,e,i,s),t.lines.forEach((t=>lE(t,e,i,s))),lE(t.line,e,i,s),lE(t.endSymbol,e,i,s))}function cE(t,e,i,s){t&&(lE(t.getTextShape(),e,i,s),lE(t.getBgRect(),e,i,s))}function dE(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 uE(t,e,i,s){t&&(dE(t.startSymbol,e,i,s),t.lines.forEach((t=>dE(t,e,i,s))),dE(t.line,e,i,s),dE(t.endSymbol,e,i,s))}function pE(t,e,i,s){t&&(dE(t.getTextShape(),e,i,s),dE(t.getBgRect(),e,i,s))}function gE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;lE(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)})),lE(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;lE(t.getTextShape(),e,l,n),lE(t.getBgRect(),e,l,n)}))}function fE(t,e,i,s,n){hE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function mE(t,e,i,s,n){lE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function vE(t,e,i,s,n){lE(t,s,i,n),G(e).forEach((t=>{cE(t,s,i,n)}))}function _E(t,e,i,s,n,r){var a;hE(t,n,s,r),lE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cE(i,n,s,r):lE(i,n,s,r)}function yE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;lE(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)})),lE(e,n+o+l,h,r),lE(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(lE(i.getTextShape(),n+o+l+h+c,d,r),lE(i.getBgRect(),n+o+l+c,d,r)):lE(i,n+o+l+c,d,r)}function bE(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?gE(t,e,s,r,a):"fadeIn"===i&&fE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?gE(t,e,s,n,a):"fadeIn"===i&&fE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){uE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function xE(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&&mE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&mE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){dE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function SE(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&&vE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&vE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){dE(t,s,i,n),G(e).forEach((t=>{pE(t,s,i,n)}))}(t,e,i,s,n)}}function kE(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?_E(n,r,e,i,s,o):"callIn"===t&&yE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?_E(n,r,e,i,s,a):"callIn"===t&&yE(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;uE(t,n,s,r),dE(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?pE(i,n,s,r):dE(i,n,s,r)}(n,r,e,t,i,s)}}const AE={type:"clipIn",duration:500,easing:"linear",delay:0},ME={type:"fadeIn",duration:500,easing:"linear",delay:0},wE={type:"callIn",duration:500,easing:"linear",delay:0},TE={type:"fadeOut",duration:500,easing:"linear",delay:0};class CE{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new FM(Object.assign(Object.assign({},h),{state:{panel:z({},iM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},iM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},iM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},iM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class BE extends oE{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=AE,this.defaultExitAnimation=TE}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;IM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(BE,CE);const PE=.001,EE={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:iE.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]}},RE={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"}}},OE={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:{autoRotate:!0,position:nE.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]}},IE={interactive:!0,label:{position:sE.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}},LE={interactive:!0,label:{autoRotate:!0,position:nE.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}},DE={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"}},FE={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"}},zE={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 jE(){HE._animate=bE}aE(),ow(),vT();class HE extends BE{markerAnimate(t){HE._animate&&this._animationConfig&&HE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(gM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return fM(Math.abs(e),Math.PI/2,PE)||fM(Math.abs(e),3*Math.PI/2,PE)?mM(i,e,t):gM(e)?RE.postiveXAxis[t]:RE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new hw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},iM,null==a?void 0:a.line),startSymbol:z({},iM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},iM,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({},iM,null==a?void 0:a.line),startSymbol:z({},iM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},iM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HE.defaultAttributes.label)}}function VE(){NE._animate=xE}HE.defaultAttributes=EE,aE(),HA(),vT();class NE extends oE{markerAnimate(t){NE._animate&&this._animationConfig&&NE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},NE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=TE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},FE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;IM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=of.polygon(Object.assign({points:e},i));n.states=z({},iM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",NE.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},iM,null==i?void 0:i.area)),this._updateMarkLabels(NE.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}NE.defaultAttributes=IE,U(NE,CE),aE(),lw(),vT();class WE extends BE{markerAnimate(t){WE._animate&&this._animationConfig&&WE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},WE.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case nE.arcInnerStart:l=n;case nE.arcOuterStart:l=n;break;case nE.arcInnerEnd:l=r;case nE.arcOuterEnd:l=r;break;case nE.center:case nE.arcInnerMiddle:case nE.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return DE[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new cw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},iM,null==o?void 0:o.line),startSymbol:z({},iM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},iM,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({},iM,null==o?void 0:o.line),startSymbol:z({},iM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},iM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",WE.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(WE.defaultAttributes.label)}}WE.defaultAttributes=OE,aE(),AA(),vT();class UE extends oE{markerAnimate(t){UE._animate&&this._animationConfig&&UE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},UE.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=ME,this.defaultExitAnimation=TE}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case nE.center:h=(s+n)/2,c=(r+a)/2;break;case nE.arcInnerStart:h=s,c=r;break;case nE.arcOuterStart:h=n,c=r;break;case nE.arcInnerEnd:h=s,c=a;break;case nE.arcOuterEnd:h=n,c=a;break;case nE.arcInnerMiddle:h=s,c=(r+a)/2;break;case nE.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},DE[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;IM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=of.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},iM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",UE.defaultAttributes.label)}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({},iM,null==o?void 0:o.area)),this._updateMarkLabels(UE.defaultAttributes.label)}isValidPoints(){return!0}}function GE(){YE._animate=kE}UE.defaultAttributes=LE,U(UE,CE),aE(),ow(),lw(),$A(),IA(),DA(),vT();class YE extends oE{markerAnimate(t){YE._animate&&this._animationConfig&&YE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},YE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=wE,this.defaultExitAnimation=TE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return fM(Math.abs(s),Math.PI/2,PE)||fM(Math.abs(s),3*Math.PI/2,PE)?mM(t,s,n):gM(s)?zE.postiveXAxis[n]:zE.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,style:d,position:u=rE.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},iM,null==p?void 0:p.textBackground),text:z({},iM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},iM,null==p?void 0:p.itemContent));const v=gM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=of.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"text"===n?o=new FM(Object.assign(Object.assign({},i),{state:{panel:z({},iM,null==s?void 0:s.textBackground),text:z({},iM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=of.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"image"===n?(o=of.image(Object.assign(Object.assign({},i),r)),o.states=z({},iM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},iM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=fM(c,0,PE)||fM(d,0,PE),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=RM(e-u,t-d),o=RM(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(eR.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(eR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===eR.focus||"focus"===o){const s=a.hasState(QE.focus);a.toggleState(QE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[QE.unSelected,QE.unSelectedHover,QE.focus],t),this._setLegendItemState(e,QE.selected,t)})):(this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[QE.selected,QE.selectedHover,QE.focus],t),this._setLegendItemState(e,QE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(QE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(QE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(tR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[QE.selected,QE.selectedHover],t),this._setLegendItemState(a,QE.unSelected,t)):(this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t))}else this._setLegendItemState(a,QE.selected,t),this._removeLegendItemState(a,[QE.unSelected,QE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[QE.selected,QE.selectedHover],t),this._setLegendItemState(e,QE.unSelected,t))}))}this._dispatchLegendEvent(tR.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,QE.selected),this._removeLegendItemState(e,[QE.unSelected,QE.unSelectedHover])):(this._removeLegendItemState(e,[QE.selected,QE.selectedHover]),this._setLegendItemState(e,QE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=qE,spaceRow:l=ZE,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=of.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+E(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";p(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";p(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:p,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),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=si(c);let T;!1===x.visible?(T=of.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,eR.item,t,T)):(T=of.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,eR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?QE.selected:QE.unSelected);const C=of.group({x:0,y:0,pickable:!1});T.add(C);let B,P=0,R=0,O=0;if(v&&!1!==v.visible){const i=E(S,"style.size",10);R=_(i)?i[0]||0:i,O=E(v,"space",8);const s=of.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,eR.itemShape,t,T,S.state),s.addState(e?QE.selected:QE.unSelected),C.add(s)}let I=0;if(p){const e=E(g,"size",10);B=of.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,eR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=PM(Object.assign(Object.assign({x:R/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:y.formatMethod?o:void 0}));this._appendDataToShape(D,eR.itemLabel,t,T,k.state),D.addState(e?QE.selected:QE.unSelected),C.add(D);const F=E(y,"space",8);if(u(l)){const s=E(b,"space",p?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,eR.itemValue,t,T,A.state),r.addState(e?QE.selected:QE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/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]-R-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",P),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.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 KE(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 KE(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 oM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new oM(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",bt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+E(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=qE,spaceRow:o=ZE}=n,l=this._itemsContainer,{space:h=JE,defaultCurrent:c=1}=r,d=rR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=of.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+E(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=qE,spaceRow:a=ZE}=s,o=this._itemsContainer,{space:l=JE,defaultCurrent:h=1}=n,c=rR(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 _=of.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=of.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=[];dt(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),dt(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(QE.selected)?this._setLegendItemState(t,QE.selectedHover,e):this._setLegendItemState(t,QE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===eR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(tR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(QE.unSelectedHover)||t.hasState(QE.selectedHover))&&(i=!0),t.removeState(QE.unSelectedHover),t.removeState(QE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(QE.unSelectedHover)&&!t.hasState(QE.selectedHover)||(i=!0),t.removeState(QE.unSelectedHover),t.removeState(QE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===eR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(tR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(tR.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!==eR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(tR.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!==eR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(tR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(QE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},aR,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(QE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(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 lR;function hR(t){return _(t)?t:[t,t]}function cR(t){return t?"ew-resize":"ns-resize"}oR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:qE,spaceRow:ZE,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:JE,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"}(lR||(lR={})),sR();class dR extends $y{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({},dR.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=rM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=rM(),n="browser"===__.env?__:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:hR(p)[0],endValue:hR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=of.group({x:0,y:0});f.name=lR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=of.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)),m.name=lR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=of.group({x:g?v:0,y:g?0:v});f.add(_);const y=of.group({x:0,y:0});let b;if(y.name=lR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=of.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=lR.endText,f.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=of.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=lR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=hR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":cR(p)},r));if(v.name=lR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=lR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":cR(p)},r));if(i.name=lR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=lR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=mt(h,i,s);c=t[0],u=t[1]}else c=i,u=ft(h,i,s);const g=this._isHorizontal;e||(c=i);const f=of.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=lR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":cR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=of.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=lR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return of.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":cR(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),of.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=of.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=of.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=rM(),e="browser"===__.env?__:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===lR.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===lR.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===lR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===lR.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}}release(t){super.release(t),("browser"===__.env?__:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}dR.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}}},nR(),sR();class uR extends iR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},uR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function pR(t="bottom"){let 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`}uR.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"}}},nR(),sR(),zA();class gR extends iR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},gR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=of.group({x:0,y:0});this._innerView.add(x);const S=new dR({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:pR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=of.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+E(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))}}gR.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)"}},RA(),qA(),UA();let fR=class t extends $y{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:P,maxWidth:E,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=si(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},sM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},sM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(P)&&UE&&(U=E),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};fR.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 mR={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"}}};RA(),qA(),UA();let vR=class extends $y{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},E(mR,n),e.style,{visible:e.visible});a.lineHeight=u(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&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(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 p=TM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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",u(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;G(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 _R extends Sg{constructor(t){super(t)}}var yR,bR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(yR||(yR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(bR||(bR={}));class xR extends $y{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},xR.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"},xR.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"},xR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},xR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},xR.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=()=>{d(this._playController)&&(this._playController=new _R(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new _R(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new _R(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(yR.OnPlay)},this.pause=()=>{this._dispatchEvent(yR.OnPause)},this.forward=()=>{this._dispatchEvent(yR.OnForward)},this.backward=()=>{this._dispatchEvent(yR.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()}}xR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},xR.defaultAttributes={[bR.Start]:{},[bR.Pause]:{},[bR.Backward]:{},[bR.Forward]:{}};const SR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},kR=[200,10];var AR,MR;!function(t){t.Default="default",t.Reverse="reverse"}(AR||(AR={})),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"}(MR||(MR={}));const wR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===AR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===AR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),TR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===AR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===AR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),CR=t=>"top"===t||"bottom"===t;class BR extends $y{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BR.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(CR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:kR[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:kR[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 dR(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=CR(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 xR(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=CR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:kR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(CR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:CR(this._orient)?t+s:(this._size.width-r)/2,y:CR(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:CR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:CR(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=x(n)?n:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:CR(this._orient)?t+s:(this._size.width-r)/2,y:CR(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 PR(){sR(),RA(),$A()}BR.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({},SR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},SR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},SR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},SR),{key:"backward",position:"start"})}},PR();class ER extends BR{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:AR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(yR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(yR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(yR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(yR.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(MR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||TR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===AR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(MR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=__.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(MR.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(MR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=__.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(),__.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(MR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.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(MR.change),this.dispatchCustomEvent(MR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var RR,OR=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())}))};PR();class IR extends BR{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(yR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(yR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(yR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(yR.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(MR.change))},this.play=()=>OR(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(MR.play),this._rafId=__.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=__.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,__.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(MR.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(MR.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(MR.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.brushActive="brushActive",t.brushClear="brushClear"}(RR||(RR={}));const LR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},DR=5;const FR={debounce:yt,throttle:bt};RA(),HA();let zR=class t extends $y{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=LR.updateTrigger,endTrigger:i=LR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:FR[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LR.trigger,resetTrigger:e=LR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(RR.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(RR.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=DR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(RR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(RR.brushActive,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._dispatchBrushEvent(RR.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=DR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(RR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LR.updateTrigger,endTrigger:e=LR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=of.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};zR.defaultAttributes=LR;const jR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},HR=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}},VR={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:tM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:tM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:tM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new je).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},NR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];RA(),NA(),$A(),qA(),UA();let WR=class t extends $y{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=si(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:pM(p)&&pM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:pM(p)&&pM(p.value)},HR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:pM(p)&&pM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:pM(p)&&pM(p.value)},HR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},sM),p.value),visible:pM(p)&&pM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=pM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=pM(p)?p.height+p.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(!pM(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 p="right"===c?(o?d:0)+(pM(n.key)?r+n.key.spacing:0)+(pM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(EM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:pM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),EM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(pM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=td(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(pM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},HR(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},HR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},sM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(pM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},HR(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},HR(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=>NR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&pM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=pM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=wM(d),_=wM(u);let y=0;if(pM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(pM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&nu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 jR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return jR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};WR.defaultAttributes=VR;const UR=dt;function GR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function YR(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function XR(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function $R(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function KR(t,e){const i=$R(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 qR(t,e){const i=ZR(t),s=ZR(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 ZR(t,e={x:0,y:0}){return se.distancePP(t,e)}function JR(t){return k(t.x)&&k(t.y)}function QR(t,e,i){let s=!1;if(e&&c(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 tO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const eO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function sO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&sO(t[i],e)}}var nO,rO,aO;function oO(t){var e,i;const{type:s}=t;return s===rO.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(nO||(nO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(rO||(rO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(aO||(aO={}));const lO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},hO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function cO(t,e){var i;if(!t)return[];const s=vO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?fO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>gO(i)?uO(t,i,e):i)).filter(u)}))):i.map((i=>gO(i)?uO(t,i,e):i)).filter(u):[]}return[]}function dO(t,e){var i,s;return fO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 uO(t,e,i){var s;const n=vO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=lO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=hO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new Qe(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ue(t,i,s),a=We(n,r,e.l),l=new Qe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const pO=(t,e)=>{if(e&&gO(t)){const i=uO(e,t);if(i)return i}return t};function gO(t){return t&&"palette"===t.type&&!!t.key}function fO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function mO(t){return _(t)?{dataScheme:t}:t}function vO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=oO(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 _O extends fB{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(!fO(this._range))return void super.range(this._range);const t=dO(this._range,this._domain);super.range(t)}}const yO={linear:jB,band:_B,point:class extends _B{constructor(t){super(!1),this.type=XC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:fB,threshold:GB,colorOrdinal:_O};function bO(t){const e=yO[t];return e?new e:null}function xO(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 SO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function kO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function AO(t){return!!v(t)&&(!!t.endsWith("%")&&Gy(t.substring(0,t.length-1)))}function MO(t){return!!p(t)&&("percent"in t||"offset"in t)}function wO(t,e,i,s=0){var n,r;return x(t)?t:AO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function TO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=wO(t[s],e.size,i)}))})),o}function CO(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}}function BO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||AO(t)||c(t)||MO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function PO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const EO=(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},RO=[{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"]}];function OO(t,e){return t&&e.key in t?t[e.key]:e.default}function IO(t){return t&&"token"===t.type&&!!t.key}const LO={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%"},DO={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:RO,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"}}},token:LO,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},FO={name:"dark",colorScheme:{default:{dataScheme:RO,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}}}}}},zO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>zO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>zO(t[i],e[i])))),jO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),jO(t[s],e.slice(1),i))},HO=t=>t instanceof Ma||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 VO(t,e=["data"]){return I(t,HO,e)}function NO(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=mO(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)})}WO._charts={},WO._series={},WO._components={},WO._graphicComponents={},WO._marks={},WO._regions={},WO._animations={},WO._implements={},WO._chartPlugin={},WO._vChartPlugin={},WO._componentPlugin={},WO.transforms={fields:Ur,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}},WO.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Jr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=zr(ta,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return Zr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t))},WO._layout={},WO._grammarTransforms={},WO._stageEventPlugins={},WO.registerStageEventPlugin=(t,e)=>{WO._stageEventPlugins[t]=e},WO.getStageEventPlugin=t=>WO._stageEventPlugins[t],WO._interactionTriggers={},WO.registerInteractionTrigger=(t,e)=>{WO._interactionTriggers[t]=e},WO._composedEventMap={},WO.registerComposedEvent=(t,e)=>{WO._composedEventMap[t]=e},WO._tooltipProcessors={},WO.registerTooltipProcessor=(t,e)=>{WO._tooltipProcessors[t]=e},WO.createTooltipProcessor=(t,e)=>{const i=WO._tooltipProcessors[t];return i?new i(e):null};const YO=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},XO=YO(),$O={[DO.name]:DO},KO=DO.name,qO=new Map(Object.keys($O).map((t=>[t,$O[t]]))),ZO=new Map,JO=new Map(Object.keys($O).map((t=>[t,t===KO]))),QO=(t,e)=>{if(!t)return;const i=sI(e);qO.set(t,i),JO.set(t,!0)},tI=(t=KO)=>(JO.has(t)&&!JO.get(t)&&QO(t,qO.get(t)),qO.get(t)),eI=t=>qO.delete(t)&&ZO.delete(t)&&JO.delete(t),iI=t=>!!v(t)&&qO.has(t),sI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:KO;return UO({},tI(i),t)};class nI{static registerInstance(t){nI.instances.set(t.id,t)}static unregisterInstance(t){nI.instances.delete(t.id)}static getInstance(t){return nI.instances.get(t)}static instanceExist(t){return nI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return nI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}nI.instances=new Map;class rI{static registerTheme(t,e){QO(t,e)}static getTheme(t,e=!1){return tI(t)}static removeTheme(t){return eI(t)}static themeExist(t){return iI(t)}static getDefaultTheme(){return rI.themes.get(KO)}static setCurrentTheme(t){rI.themeExist(t)&&(rI._currentThemeName=t,nI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return rI.getTheme(rI._currentThemeName,t)}static getCurrentThemeName(){return rI._currentThemeName}}function aI(t){return v(t)?rI.themeExist(t)?rI.getTheme(t):{}:p(t)?t:{}}rI.themes=qO,rI._currentThemeName=KO;const oI=["animationThreshold","colorScheme","name","padding"];function lI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];oI.includes(n)?s[n]=r:f(r)?gO(r)?s[n]=pO(r,e):IO(r)?s[n]=OO(i,r):s[n]=lI(r,e,i):s[n]=r})),s}function hI(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]=hI(t[s],e)}return i}return _(t)?t.map((t=>hI(t,e))):t}function cI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=cI(t[s],e)}return i}return _(t)?t.map((t=>cI(t,e))):t}const dI=(t,e,i,s)=>((t,e,i)=>wM(t,e,i,{fontFamily:LO.fontFamily,fontSize:LO.fontSize}))(e,i,s).measure(t),uI="__VCHART",pI=500,gI=500,fI=`${uI}_MEASURE_CANVAS_ID`,mI=`${uI}_DEFAULT_DATA_INDEX`,vI=`${uI}_DEFAULT_DATA_KEY`,_I=`${uI}_DEFAULT_DATA_SERIES_FIELD`,yI=`${uI}_DEFAULT_SERIES_STYLE_NAME`,bI=`${uI}_STACK_KEY`,xI=`${uI}_STACK_START`,SI=`${uI}_STACK_END`,kI=`${uI}_STACK_START_PERCENT`,AI=`${uI}_STACK_END_PERCENT`,MI=`${uI}_STACK_START_OffsetSilhouette`,wI=`${uI}_STACK_END_OffsetSilhouette`,TI=`${uI}_STACK_TOTAL`,CI=`${uI}_STACK_TOTAL_PERCENT`,BI=`${uI}_STACK_TOTAL_TOP`,PI=`${uI}_STACK_TOTAL_BOTTOM`,EI=`${uI}_MOSAIC_VALUE_START_PERCENT`,RI=`${uI}_MOSAIC_VALUE_END_PERCENT`,OI=`${uI}_MOSAIC_CAT_START_PERCENT`,II=`${uI}_MOSAIC_CAT_END_PERCENT`,LI=`${uI}_SEGMENT_START`,DI=`${uI}_SEGMENT_END`,FI=`${uI}_KEY`;function zI(t,e){for(let i=0;it.key===e))}function HI(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 VI(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:{}},YI(t,a,n[o],l,e,r))})),s?NI(n):n}function NI(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))):NI(t[e].nodes);return t}function WI(t,e){if("values"in t&&t.values.length){const i=XR(t.values,e),s=YR(t.values,AI);t.values.forEach((t=>{t[TI]=i,t[CI]=s}))}else for(const i in t.nodes)WI(t.nodes[i],e)}function UI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][SI]/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)GI(t.nodes[r],e,i,s,n)}function YI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[SI]=function(t){if(k(t))return t;const e=+t;return k(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},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),YI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const XI=(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]=KI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function qI(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>QI(t.style(e,i,s,n)):P(t.style)||(e.style=QI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>QI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=QI(t.state[e]))})),e.state=i}return e}function ZI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>QI(t[i](e,s,n,r)):P(t[i])||(e[i]=QI(t[i]))})),e}function JI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),QI(i)}function QI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ne(t.angle)}):t}const tL=t=>"line"===t||"area"===t,eL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return tL(i)?e:null==e?void 0:e[0]},iL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let sL=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},n=WO.getComposedEvent(t);if(n){const e=new n(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(WO.getComposedEvent(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()}};var nL;!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"}(nL||(nL={}));const rL=["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 aL,oL,lL;!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.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(aL||(aL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(oL||(oL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(lL||(lL={}));const hL=[lL.mark,lL.model,lL.chart,lL.vchart];class cL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(lL.vchart,[]),this._levelNodes.set(lL.chart,[]),this._levelNodes.set(lL.model,[]),this._levelNodes.set(lL.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 dL={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 uL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=E(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>eL(t)))};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)||oL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||oL.chart);o.get(t)||o.set(t,new cL);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)||oL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||oL.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)||oL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||oL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?hL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[oL.chart,oL.window,oL.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(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&E(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 dL[a]&&(a=dL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?lL.model:lL.vchart:lL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=bt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=yt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=oL.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!==lL.model&&s!==lL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=lL.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 oL.chart:return this._viewBubbles;case oL.window:return this._windowBubbles;case oL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case oL.chart:return this._viewListeners;case oL.window:return this._windowListeners;case oL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return rL.includes(t)||Object.values(nL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&WO.hasInteractionTrigger(e)}}function pL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function gL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const fL=new Map;let mL;function vL(){mL||(mL=new Aa,gL(mL,"geojson",_a),gL(mL,"topojson",ba),pL(mL,"simplify",Nr))}function _L(t,e,i={type:"geojson",centroid:!0}){fL.has(t)&&Ly(`map type of '${t}' already exists, will be overwritten.`),vL();const s=new Ma(mL),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"}):p(r)&&s.transform({type:"simplify",options:r}),fL.set(t,s)}function yL(t){fL.has(t)?fL.delete(t):Ly(`map type of '${t}' does not exists.`)}function bL(t,e=!1){let i=e;return t.latestData instanceof Ma&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const xL=(t,e)=>0===t.length?[]:1===t.length?bL(t[0],null==e?void 0:e.deep):t.map((t=>bL(t,null==e?void 0:e.deep)));function SL(t,e,i){pL(e=e instanceof Aa?e:t.dataSet,"copyDataView",xL);const s=new Ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:ML.copyDataView}),s}function kL(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?I(t.parser):{clone:!0},c=I(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 Ly(`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 Ly(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Ly("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 AL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var ML,wL,TL,CL;!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"}(ML||(ML={})),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"}(wL||(wL={})),function(t){t.data="data",t.mark="mark"}(TL||(TL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(CL||(CL={}));const BL=["line","area","trail"];function PL(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:[FI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const EL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function RL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{RL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function IL(t,e,i,s){const n=PL(t,(t=>i(t))),r=PL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 LL{getRootGroup(){return this._rootGroup}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(aL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;__.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new R_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Tp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Vy(o))&&!1!==c&&WO.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=CL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(__.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=__.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>RL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>RL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{RL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Iy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===CL.before&&(this._layoutState=CL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=CL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Iy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=OL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=IL(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=IL(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=PL(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=PL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===oL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:eL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===oL.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===oL.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===oL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===oL.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===oL.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{RL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=OL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Hy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return mu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{RL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=__.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){__.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function DL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Dy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function FL(t){t.crosshair=G(t.crosshair||{}).map((e=>NO({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function zL(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ni(l,i.width,i.height);a=t,o=e}else if(h&&Hy(e.mode)){let t;t=v(h)?__.getElementById(h):h;const{width:e,height:s}=ni(t,i.width,i.height);a=e,o=s}else if(Ny(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 jL(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 HL(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}}const VL=9,NL=0,WL=-1;var UL,GL,YL,XL,$L,KL;!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"}(UL||(UL={})),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"}(GL||(GL={})),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"}(YL||(YL={}));class qL{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},qL.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]))))}}qL.defaultMarkInfo={};class ZL{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class JL{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=>NO({},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 QL extends ZL{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=JL,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new qL,this._lastLayoutRect=null,this.id=Uy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new sL(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${uI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=WO.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return E(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class tD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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=GL.Region,this._willLayoutTag=!0,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){let a=TO(BO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:wO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:wO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:wO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:wO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:wO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:wO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=wO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=wO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=wO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(CO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class eD extends QL{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,this._transformLayoutPadding=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 tD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 iD extends JL{_initTheme(t,e){return{spec:t,theme:this._theme}}}class sD extends eD{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=iD,this.modelType="region",this.specKey="region",this.type=sD.type,this._series=[],this.layoutType="region",this.layoutZIndex=UL.Region,this.seriesDataFilterOver=()=>{this.event.emit(aL.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"}_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._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",UL.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",YL.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:UL.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:UL.Mark+1}))}_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",YL.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",YL.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}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",YL.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",YL.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",YL.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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))&&(!u(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function nD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 rD(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 aD(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 oD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=dD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),aD(d,!0,p,l),s&&rD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function lD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=dD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=dD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),aD(d,!1,p,o),s&&rD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function cD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=dD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=dD(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&oD(n,e,i,!1,"left",s),r.length&&oD(r,e,i,!0,"left",s),a.length&&lD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&hD(n,e,i,!1,"top",s),r.length&&hD(r,e,i,!0,"top",s),a.length&&cD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&oD(n,e,i,!1,"right",s),r.length&&oD(r,e,i,!0,"right",s),a.length&&lD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=nD(t);n.length&&hD(n,e,i,!1,"bottom",s),r.length&&hD(r,e,i,!0,"bottom",s),a.length&&cD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=dD(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{N(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=dD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Dy)("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}}}uD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(XL||(XL={})),function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}($L||($L={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(KL||(KL={}));const pD=["linear","radial","conical"],gD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const fD={};Object.values($L).forEach((t=>{fD[t]=!0})),$L.STATE_HOVER,$L.STATE_HOVER_REVERSE,$L.STATE_SELECTED,$L.STATE_SELECTED_REVERSE,$L.STATE_DIMENSION_HOVER,$L.STATE_DIMENSION_HOVER_REVERSE;class mD extends ZL{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class vD extends mD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,BL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!fD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(uI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(uI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(KC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class _D extends ZL{constructor(){super(...arguments),this.id=Uy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=WO.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class yD extends _D{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const bD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,xD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=bD(l.delay,n,a,o),d=bD(l.duration,n,a,o),u=bD(l.oneByOne,n,a,o),p=bD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?DT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:FT)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);RT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?DT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:FT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>CT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>PT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Uo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new ET({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kT,null!==(l=i.easing)&&void 0!==l?l:AT))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Uo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new OT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:AT))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):RT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},SD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},kD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class AD extends _D{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new yD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Tp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:UL.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new zl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==XL.enter&&t.context.diffState!==XL.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=t,this.model=e.model,this.key=e.key,this.state=new vD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ne)}isUserLevel(t){return[YL.User_Mark,YL.User_Series,YL.User_Chart,YL.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&NO(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(qC(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=bO(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):pD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):qC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",YL.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,YL.User_Mark)}else this.setStyle(i,t,YL.User_Mark)}))}_computeGradientAttr(e){var i,s;const{gradient:n,scale:r,field:a}=e,o=t(e,["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 d=dO(cO(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()),p=Object.assign(Object.assign({},gD[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(p).forEach((s=>{const n=p[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=Qe.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||d[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)pD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=dO(cO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return PL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return WO.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[vI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=PL(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{kD(t),s.push(...t.getGraphics())})),e.forEach((t=>{kD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);xD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=SD(e,n),r=SD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===wL.exit?wL.exit:i===wL.update?wL.update:wL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===XL.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===XL.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=XL.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=XL.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=XL.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=wL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=wL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return EL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=EL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=iL(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===$L.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=WO.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=WO.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===CL.before||(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===XL.exit&&!e.isExiting)if(e.context.animationState===XL.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:XL.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Tp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var MD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(MD||(MD={}));class wD extends AD{constructor(){super(...arguments),this.type=wD.type,this._marks=[],this._diffState=XL.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ly("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?(Ly("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))}getMarkInUserId(t){let e;return RL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===XL.update){const t=this.hasAnimation(),e=iL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=XL.update}render(){this._isCommited&&(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}wD.type="group";const TD={measureText:dI};class CD{static instance(){return CD.instance_||(CD.instance_=new CD),CD.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 BD{constructor(){this.id=Uy(),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))?Ly("不要重复添加相同的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 PD extends BD{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}}const ED={type:"fadeIn"};function RD(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 ED;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const OD={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"}},ID={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},LD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},DD=()=>{WO.registerAnimation("scaleInOut",(()=>ID))},FD=()=>{WO.registerAnimation("fadeInOut",(()=>LD))},zD=(t,e)=>({appear:RD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:VT,duration:OD.update.duration,easing:OD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),jD=()=>{WO.registerAnimation("line",zD)},HD=()=>{oT.registerBuiltInAnimate("growPointsIn",rC),oT.registerBuiltInAnimate("growPointsOut",aC),oT.registerBuiltInAnimate("growPointsXIn",lC),oT.registerBuiltInAnimate("growPointsXOut",hC),oT.registerBuiltInAnimate("growPointsYIn",dC),oT.registerBuiltInAnimate("growPointsYOut",uC),oT.registerBuiltInAnimate("clipIn",UT),oT.registerBuiltInAnimate("clipOut",GT)},VD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};$L.STATE_HIGHLIGHT,$L.STATE_BLUR;class ND{constructor(t){this._markSet=new qL,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 WD={highlightState:$L.STATE_HIGHLIGHT,blurState:$L.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class UD extends ND{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},WD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}UD.type="element-highlight",UD.defaultOptions=WD;const GD=()=>{WO.registerInteractionTrigger(UD.type,UD)},YD={state:$L.STATE_SELECTED,trigger:"click"};class XD extends ND{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},YD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}XD.type="element-select",XD.defaultOptions=YD;const $D=()=>{WO.registerInteractionTrigger(XD.type,XD)};class KD extends BD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class qD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>WO.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>WO.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>WO.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return WO.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>WO.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){WO.registerTransform(t,e)}static registerFunction(t,e){t&&e&&CD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&CD.instance().unregisterFunction(t)}static getFunction(t){return t?CD.instance().getFunction(t):null}static getFunctionList(){return CD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=WO.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=WO.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,fL.get(e);var e}static registerSVG(t,e,i){const s=WO.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=WO.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){nI.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 nt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=Uy(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=jL(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?WO.getSeriesBuiltInTheme(e):WO.getComponentBuiltInTheme(e);i=i?NO({},s,i[e]):s}s===t.length-1&&u(i)&&(i=lI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},sO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Hy(_);if(S?tx(fo):"node"===_&&zS(fo),S&&f&&(this._container=v(f)?__.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=rI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new nt(null!==(a=this._option.logLevel)&&void 0!==a?a:st.Error);nt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new LL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new uL(this,this._compiler),this._event=new sL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),nI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=NO({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=hI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;qD.getFunctionList()&&qD.getFunctionList().length&&(t=cI(t,qD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=WO.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=WO.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=WO.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._chartSpecTransformer),this._chart.init(),this._event.emit(aL.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)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(aL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=bt(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 zL(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:pI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:gI})}_initDataSet(t){this._dataSet=t instanceof Aa?t:new Aa,gL(this._dataSet,"dataview",xa),gL(this._dataSet,"array",i),pL(this._dataSet,"copyDataView",xL);for(const t in WO.transforms)pL(this._dataSet,t,WO.transforms[t]);for(const t in WO.dataParser)gL(this._dataSet,t,WO.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(aL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?wL.none:wL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,nI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,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 e(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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ma?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=kL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.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,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?NO({},t[n][e.index],i):i):t[n]=s?NO({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?NO({},t[n][r],i):i)}else t.id===e&&(t[n]=s?NO({},t[n],i):i)}))}(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=NO({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(aL.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=UO({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=aI(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=UO({},aI(this._currentThemeName),aI(n),aI(r));this._currentTheme=o(a,t)}else{const t=UO({},aI(this._currentThemeName),aI(n),aI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(jM.poptip,zM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Hy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return aI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!rI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield DL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Hy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?__.getElementById(this._canvas):this._canvas,u(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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?PO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||P(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return Ly("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 u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?PO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ly("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return CD.instance().getFunction(t)}registerFunction(t,e){t&&e&&CD.instance().registerFunction(t,e)}unregisterFunction(t){t&&CD.instance().unregisterFunction(t)}getFunctionList(){return CD.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(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.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=WO.getChartPlugins();t.length>0&&(this._chartPlugin=new PD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=WO.getVChartPlugins();e.length>0&&(this._vChartPlugin=new KD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}qD.InstanceManager=nI,qD.ThemeManager=rI,qD.globalConfig={uniqueTooltip:!0},qD.Utils=TD,qD.vglobal=__;WO.registerRegion("region",sD),WO.registerLayout("base",uD),YA(),RA(),WO.registerMark(wD.type,wD),WO.registerStageEventPlugin("gesture",kb),GD(),$D(),QO(FO.name,FO);const ZD="monotone",JD="linear",QD="bevel";var tF;function eF(t,e){return e("component",t)}function iF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=WO.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(tF||(tF={}));const sF=(t,e,i,s)=>{if(d(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},nF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},rF="2.0.6",aF=(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},oF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?E(e,t.field):t,s){const{formatFunc:i,args:r}=iF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},lF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const hF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function cF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=uF(oF(h,r,a,c),p,g),o.value=uF(oF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=oF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function dF(t,e,i,s,n,r,a){if(c(e)){cF(t,e(n,a),i,s,r,a)}else e&&cF(t,e,i,s,r,a)}const uF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=pi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class pF{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:u(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(u(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(u(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=>{dF(a,t,e,i,s,n,r)})):c(t)?dF(a,t,e,i,s,n,r):t&&cF(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=c(e)?e(s,n):e;if(r?d(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:oF(r.visible,t,n),value:uF(oF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:oF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=oF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&hF(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 gF={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}},fF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=zI([],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 mF(a,n,o)},mF=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Gy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Gy(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=gF[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},vF=(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=>{Gy(t[e])||(t[e]=0)}))})),t},_F=`${uI}_HIERARCHY_DEPTH`,yF=`${uI}_HIERARCHY_ROOT`,bF=`${uI}_HIERARCHY_ROOT_INDEX`;function xF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function SF(t,e,i){t&&(i.needDefaultSeriesField&&(t[_I]=i.defaultSeriesField),t[mI]=e,t[vI]=i.getKey(t,e,i))}function kF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function AF(t,e,i,s=0,n,r){void 0===r&&(r=e),SF(t,e,i),t[_F]=s,t[yF]=n||t[i.categoryField],t[bF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>AF(e,s,i,t[_F]+1,t[yF],r)))}const MF={label:{name:"label",type:"text"}},wF=`${uI}_rect_x`,TF=`${uI}_rect_x1`,CF=`${uI}_rect_y`,BF=`${uI}_rect_y1`,PF={data:!0},EF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},RF=[...Object.keys(OD),"normal"];function OF(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 zF(n)&&delete n.type,n.oneByOne&&(n=LF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:DF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=NO({},o[e],a);return zF(n)&&delete n.type,n.oneByOne&&(n=LF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:DF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function IF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(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;const i=["custom","customParameters"];return t=I(t,null,i),jF(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function LF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function DF(t,e){var i;return null!==(i=null==t?void 0:t[mI])&&void 0!==i?i:e.context.graphicIndex}function FF(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 zF(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function jF(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),jF(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),jF(t[s],e,i))}function HF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class VF extends JL{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=oO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=WO.getSeriesMarkMap(o)?function(t,e,i){const s=WO.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=NO({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return NO({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(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:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=NO({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>NO({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class NF extends QL{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){u(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:`${uI}_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=VF,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=UL.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(aL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=HF(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(aL.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 d(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),u(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)&&(pL(this._rawData.dataSet,"invalidTravel",vF),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=kL(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=SL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=SL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new yD(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=mF(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(){pL(this._dataSet,"dimensionStatistics",fF);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&&zI(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){pL(this._dataSet,"dimensionStatistics",fF);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=zI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&zI(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(pL(this._rawData.dataSet,"addVChartProperty",aF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:xF.bind(this),call:SF}},!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(aL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(aL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(aL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(aL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=OF({},IF(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Vy(i)||Ny(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=NO(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=NO(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=VD(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=VD(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:$L.STATE_HOVER_REVERSE,highlightState:$L.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:$L.STATE_SELECTED_REVERSE,state:$L.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=VD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:_I;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:yI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,yI,YL.User_SeriesStyle)}))}afterInitMark(){this.event.emit(aL.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",YL.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new pF(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)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},PF),EF),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=>EF[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ma||AL(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();HF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:_I,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new _O).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return cO(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:_I}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,NO({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:vI}_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!==SI&&t!==AI&&t!==xI&&t!==kI||(t=this.getStackValueField()),null!==(e=HI(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=>Gy(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:_I]}}function WF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();KC(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 UF(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}}}NF.mark=MF,NF.transformerConstructor=VF;class GF extends NF{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);KC(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:`${uI}_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(SI),this.setFieldX2(xI)):(this.setFieldY(SI),this.setFieldY2(xI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(AI),this.setFieldX2(kI)):(this.setFieldY(AI),this.setFieldY2(kI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(wI),this.setFieldX2(MI)):(this.setFieldY(wI),this.setFieldY2(MI))}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),u(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(),u(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(aL.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)&&(WF("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function YF(t){return"bottom"===t||"top"===t}function XF(t){return"left"===t||"right"===t}function $F(t){return"z"===t}function KF(t,e){return kO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function qF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function ZF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?YF(t)?"linear":"band":YF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const JF=(t,e,i)=>{var s;const n=null!==(s="band"===e?eF("axisBand",i):["linear","log","symlog"].includes(e)?eF("axisLinear",i):{})&&void 0!==s?s:{},r=YF(t)?eF("axisX",i):XF(t)?eF("axisY",i):eF("axisZ",i);return NO({},eF("axis",i),n,r)};class QF{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:Dy)("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:Dy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>ZC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return YF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class tz extends QF{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:oL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const ez=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},iz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},sz=(t,e,i,s)=>{var n;const r=e.getScale(),a=ZC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:nz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,rz=(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};class az extends QF{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)=>!ez(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:oL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:oL.canvas}),callback:this.onMouseOut}),Vy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:oL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Vy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var oz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(oz||(oz={}));const lz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class hz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(lz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{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",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.event.on(aL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:QD,curveType:JD,closePath:!0},"normal",YL.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===ZD?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",YL.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",YL.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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(lz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:FF(this._spec,lz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ma(this._option.dataSet,{name:`${uI}_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()},{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(oz.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:YL.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$L.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",YL.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",YL.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[lz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(oz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,NO({},this._spec[lz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$L.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",YL.Series),this.event.on(aL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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",YL.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",YL.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const cz=Object.assign(Object.assign({},MF),lz),dz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>dz(t,e[i])));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]))},uz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class pz extends AD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return uz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(qC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?dz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:XL.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[vI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class gz extends pz{constructor(){super(...arguments),this.type=gz.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)===rO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}gz.type="line";const fz=()=>{WO.registerMark(gz.type,gz),YA(),DA(),FP(),RP(),HD(),WO.registerGraphicComponent("line",wg)};class mz extends AD{constructor(){super(...arguments),this.type=mz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}mz.type="symbol";const vz=()=>{WO.registerMark(mz.type,mz),YA(),$A(),RP(),WO.registerGraphicComponent("symbol",kg)};class _z extends VF{_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 yz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function bz(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:!k(o.min),extendable_max:!k(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 xz(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 Sz(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 kz(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 Az(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 Mz=(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=>function(t,e,i,s,n){const r=ee(t,e),a=Math.max(Qt(i),Qt(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return WC(v)};class wz{constructor(t){this.id=Uy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Tz extends wz{constructor(){super(Tz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!KC(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(aL.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&&yz(c)&&yz(d)))return;const u=bz(t,c),p=bz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!Sz(u,p))return}else if(0===y&&0===b){if(!Sz(p,u))return}else if(_||k)if(_&&!k){if(!xz(u,p))return}else if(k&&!_){if(!xz(p,u))return}else{if(f===b)return;if(f>b){if(!kz(u,p))return}else if(!kz(p,u))return}else{if(0===f&&0===y){if(!Az(u,p))return}else if(0===b&&0===g&&!Az(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){pL(e.getOption().dataSet,"tickAlign",Mz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Tz.pluginType="component",Tz.type="AxisSyncPlugin";const Cz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Bz(t){let e=0;return E(t,"tick.visible")&&(e+=E(t,"tick.tickSize")),E(t,"label.visible")&&(e+=E(t,"label.space")),e}function Pz(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 Ez(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Rz=t=>"band"===t||"ordinal"===t||"point"===t;function Oz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Iz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Lz extends BD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Dz=`${uI}_ARC_TRANSFORM_VALUE`,Fz=`${uI}_ARC_RATIO`,zz=`${uI}_ARC_START_ANGLE`,jz=`${uI}_ARC_END_ANGLE`,Hz=`${uI}_ARC_K`,Vz=`${uI}_ARC_MIDDLE_ANGLE`,Nz=`${uI}_ARC_QUADRANT`,Wz=`${uI}_ARC_RADIAN`,Uz=-Math.PI/2,Gz=3*Math.PI/2,Yz=.6,Xz=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(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 de(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},$z=(t,e,i)=>{var s;const n=null!==(s="band"===e?eF("axisBand",i):"linear"===e?eF("axisLinear",i):{})&&void 0!==s?s:{},r=eF("angle"===t?"axisAngle":"axisRadius",i);return NO({},eF("axis",i),n,r)};function Kz(t,e,i,s){switch(t){case n.cartesianBandAxis:return JF(KF(i,["z"]),"band",e);case n.cartesianLinearAxis:return JF(KF(i,["z"]),"linear",e);case n.cartesianLogAxis:return JF(KF(i,["z"]),"log",e);case n.cartesianSymlogAxis:return JF(KF(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return JF(KF(i),void 0,e);case n.polarBandAxis:return $z(i.orient,"band",e);case n.polarLinearAxis:return $z(i.orient,"linear",e);case n.polarAxis:return $z(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=eF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>YF(t.orient)));let g;g=u(p)?NO({},Rz(p.type)?a:o,l):l;const f=r.find((t=>XF(t.orient)));let m;return m=u(f)?NO({},ZC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=eF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?NO({},Rz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?NO({},ZC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return qz(i,eF(t,e));default:return eF(t,e)}}const qz=(t,e)=>{var i;const s=NO({},e,e[qF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Zz extends JL{getTheme(t,e){return Kz(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({},BO(e)),{[s]:0}))}}class Jz extends eD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Zz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:oL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Lz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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}}getDatum(t){}}var Qz,tj;Jz.transformerConstructor=Zz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Qz||(Qz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(tj||(tj={}));class ej extends AD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=WO.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(nL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}ej.type="component";const ij=()=>{WO.registerMark(ej.type,ej)},sj=t=>t;class nj extends Jz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Qz.circleAxis:Qz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),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()?tj.circleAxisGrid:tj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),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:UL.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==E(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=OF(null===(l=WO.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:E(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:E(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:E(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:E(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:E(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:E(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:E(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:E(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:E(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:E(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()),e=new yD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return QR(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?KC(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===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.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 QR(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;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(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(aL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=tO(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()})),QR(this._regions,(t=>{t.event.on(aL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(aL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(QR(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 e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=qI(s=e.domainLine)).startSymbol=qI(s.startSymbol),s.endSymbol=qI(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return QI(NO({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:QI(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>QI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=QI(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return QI(NO({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:QI(e.tick.style)),e.tick.state&&(i.tick.state=ZI(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return QI(NO({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:QI(e.subTick.style)),e.subTick.state&&(i.subTick.state=ZI(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Cz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ne(p):null,textStyle:NO({},u,QI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:QI(h.style)}),h.state&&(i.title.state.shape=ZI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:QI(o.style)}),o.state&&(i.title.state.background=ZI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=ZI(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=QI(e.background.style)),e.background.state&&(i.panel.state=ZI(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:c(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 QI(NO({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:QI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:QI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=iF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){gL(this._option.dataSet,"scale",sj);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)}getDatum(t){var e;return t&&t.name===dw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}nj.specKey="axes";const rj=()=>{ij(),WO.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},aj=[Tz];class oj extends nj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=UL.Axis,this.layoutLevel=GL.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),QR(this._regions,(t=>{const e=this.getOrient();YF(e)?Iz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):XF(e)?Iz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):$F(e)&&Iz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=NO({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(NO({x:e.x,y:e.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=YF(this.getOrient()),n=t=>{var e;return(s?!YF(t.getOrient()):YF(t.getOrient()))&&KC(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(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=KF(e,["z"]),$F(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(!Ez(e))return null;const{axisType:t,componentName:s}=ZF(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=>XF(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(!Ez(t))return;const{axisType:s,componentName:n}=ZF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=WO.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return YF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):$F(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(aj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){YF(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!YF(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!$F(this.getOrient())&&this._spec.innerOffset){const t=this._spec;XF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=wO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=wO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=YF(this.getOrient())?t.fieldX:$F(this.getOrient())?t.fieldZ:t.fieldY,KC(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:KC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(nL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(YF(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=YF(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)}))}collectScale(){const t=[];return QR(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]:YF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:$F(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();QR(this._regions,(e=>{YF(t)?Iz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):XF(t)?Iz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):$F(t)&&Iz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(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=YF(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=YF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=NO(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new ze).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=YF(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-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Oz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:KC(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(aL.layoutEnd,this._updateAxisLayout),this.event.on(aL.layoutEnd,this._fixAxisOnZero),this.event.on(aL.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}}}}oj.type=n.cartesianAxis,oj.specKey="axes";const lj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function hj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,dj=(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 uj(t,e,i="count"){const s=dj(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const pj=Math.sqrt(50),gj=Math.sqrt(10),fj=Math.sqrt(2);class mj{constructor(){this._extend={},this.niceLabelFormatter=null}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Pz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=YF(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=k(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(cj),e.sort(cj),{domain:hj(t,e),scope:uj(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=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Pz(this._spec);if(u(e)||u(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>=pj?10:n>=gj?5:n>=fj?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(aL.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(aL.scaleDomainUpdate,{model:this}),this.event.emit(aL.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=>k(+t)?Math.round(+t*s)/s:t}}const vj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},_j={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}}},yj={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}}},bj={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}}};class xj extends oj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new jB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(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(!$F(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=YF(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=AO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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]+(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 pL(this._option.dataSet,t,$B),t}}xj.type=n.cartesianLinearAxis,xj.specKey="axes",xj.builtInTheme={axis:bj,axisLinear:vj,axisX:_j,axisY:yj},U(xj,mj);const Sj=()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),rj(),WO.registerComponent(xj.type,xj)};class kj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new yD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(aL.scaleDomainUpdate,{model:this}),this.event.emit(aL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Oz(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=>Oz(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 Aj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Mj extends oj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new _B}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 pL(this._option.dataSet,t,QB),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=hB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),rj(),WO.registerComponent(Mj.type,Mj,!1)};class Tj extends xj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),QR(this._regions,(t=>{YF(this.getOrient())?Iz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Iz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=NO({},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 yD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=pi.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=>Oz(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=>Oz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Tj.type=n.cartesianTimeAxis,Tj.specKey="axes",Tj.builtInTheme={axis:bj,axisX:_j,axisY:yj};class Cj extends xj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new WB}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 pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Cj.type=n.cartesianLogAxis,Cj.specKey="axes",Cj.builtInTheme={axis:bj,axisLinear:vj,axisX:_j,axisY:yj},U(Cj,mj);class Bj extends xj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new UB}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 pL(this._option.dataSet,t,$B),t}transformScaleDomain(){}}Bj.type=n.cartesianSymlogAxis,Bj.specKey="axes",Bj.builtInTheme={axis:bj,axisLinear:vj,axisX:_j,axisY:yj},U(Bj,mj);const Pj=`${uI}_hide_`;function Ej(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Rj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Pj]&&(Ej(t,!0),t[Pj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Pj]=!0,Ej(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Oj=()=>{WO.registerGrammarTransform("symbolOverlap",{transform:Rj,runType:"afterEncode"})},Ij={min:$,max:X,average:$R,sum:XR};function Lj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Dj(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 Fj(t,e,i,s){return Dj(t,e,i,"min",s)}function zj(t,e,i,s){return Dj(t,e,i,"max",s)}function jj(t,e,i,s){return Dj(t,e,i,"average",s)}function Hj(t,e,i,s){return Dj(t,e,i,"sum",s)}const Vj=(t,e)=>{let i=c(t.size)?t.size():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=Lj;if("min"===n?l=Fj:"max"===n?l=zj:"average"===n?l=jj:"sum"===n&&(l=Hj),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[]},Nj=()=>{WO.registerGrammarTransform("dataSampling",{transform:Vj})};class Wj extends GF{constructor(){super(...arguments),this.type=rO.line,this.transformerConstructor=_z,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(OF(null===(i=WO.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),IF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=UF(this);this._symbolMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),IF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Wj.type=rO.line,Wj.mark=cz,Wj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Wj.transformerConstructor=_z,U(Wj,hz);class Uj{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)=>{AL(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];Ly(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ly(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Gj{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)=>{Yy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{zI(e,[{key:t,operations:KC(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&&zI(e,[{key:i.field,operations:KC(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?bO("colorOrdinal"):bO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Yy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(N(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(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Yy(s.domain)?e.reRender=!0:N(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(!Yy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=KC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=KC(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;KC(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(KC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=KC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));KC(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class Yj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Xj extends ZL{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Uy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:pI,height:gI},this._viewRect={width:pI,height:gI},this._viewBox={x1:0,y1:0,x2:pI,y2:gI},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=>u(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=BO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new sL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Uj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Yj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=WO.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=WO.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:UL.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=WO.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(aL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(aL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(aL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof QL)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 AD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof AD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&AL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=zL(this._spec,this._option,{width:pI,height:gI})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=cO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Gj(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){jL(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=cO(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(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{jL(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,jL(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):jL(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()];jL(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=TO(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(aL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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($L.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum($L.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState($L.STATE_SELECTED)}clearHovered(){this.clearState($L.STATE_HOVER)}_initEvent(){[aL.dataZoomChange,aL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(nL.AFTER_MARK_RENDER_END,e)};this._event.on(nL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:eL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(tL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===oz.dimensionHover||s===oz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>ZC(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.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(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const $j=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class Kj{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):jO(t,a,c.spec),jO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=$j(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=$j(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(WO.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(WO.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=WO.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=WO.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=WO.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):sF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=sF(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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class qj extends Kj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),E(i,"trimPadding")&&NO(i,HL(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 Zj extends qj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),FL(t)}}const Jj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=VI(t,!0);for(const e in o)for(const i in o[e].nodes)GI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)UI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&WI(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(aL.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 tH{_beforeInit(){this._dataSet&&pL(this._dataSet,"stackSplit",Jj)}_initStack(){this._stack=new Qj(this),this._stack.init()}}const eH={state:$L.STATE_DIMENSION_HOVER,reverseState:$L.STATE_DIMENSION_HOVER_REVERSE,trigger:oz.dimensionHover};class iH extends ND{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},eH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=eL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}iH.type="dimension-hover",iH.defaultOptions=eH;const sH=()=>{WO.registerInteractionTrigger(iH.type,iH)},nH=()=>{WO.registerComposedEvent(oz.dimensionHover,az),WO.registerComposedEvent(oz.dimensionClick,tz)},rH=t=>t.fieldX[0],aH=t=>t.fieldY[0],oH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},lH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},hH=(t,e)=>t?e?rH:oH:e?aH:lH,cH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=rz(t,(t=>YF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=rz(t,(t=>XF(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=>{ZC(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=dH(t,i,hH(e,ZC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=dH(t,i,hH(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},dH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:uH(t,s,i)},uH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=sz(e,t,"cartesian",null!=i?i:YF(t.getOrient())?rH:aH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},pH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(ZC(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(KC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Bz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};fH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&gH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),gH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=iF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},fH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},mH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=vH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},vH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},_H=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return pH(c,r,e),c.xField.cacheInfo?mH(c.xField):c.yField.cacheInfo?mH(c.yField):void 0},yH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],bH=(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])&&yH.forEach((e=>{u(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(xH(s).every((t=>{var e;return!hF("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},xH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},SH={dom:`${uI}_TOOLTIP_HANDLER_DOM`,canvas:`${uI}_TOOLTIP_HANDLER_CANVAS`},kH={key:"其他",value:"..."};var AH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(AH||(AH={}));class MH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(aL.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:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=bH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[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({},kH),t):kH;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!d(e)&&hF(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 wH extends MH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!ZC(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const TH=()=>{WO.registerTooltipProcessor("dimension",wH)};class CH extends MH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Wo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(eL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const BH=()=>{WO.registerTooltipProcessor("mark",CH)};class PH extends MH{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 EH=()=>{WO.registerTooltipProcessor("group",PH)};class RH extends Xj{constructor(){super(...arguments),this.transformerConstructor=Zj,this.type="line",this.seriesType=rO.line}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}RH.type="line",RH.seriesType=rO.line,RH.transformerConstructor=Zj,U(RH,tH);const OH=[...uz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class IH extends pz{constructor(){super(...arguments),this.type=IH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return OH}_getIgnoreAttributes(){return[]}}IH.type="area";const LH=()=>{WO.registerMark(IH.type,IH),YA(),wA(),FP(),RP(),HD(),WO.registerGraphicComponent("area",Zg)};class DH extends pF{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")),u(e))return e}return i}}}const FH=Object.assign(Object.assign(Object.assign({},MF),lz),{area:{name:"area",type:"area"}}),zH=()=>{WO.registerAnimation("area",zD),jD(),DD()};class jH extends _z{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=NO({},f.style,g.style),l.state=NO({},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 HH extends GF{constructor(){super(...arguments),this.type=rO.area,this.transformerConstructor=jH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(HH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===ZD?"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 xO(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",YL.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return xO(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",YL.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[SI]},"normal",YL.Series),this.setMarkStyle(o,{curveType:a},"normal",YL.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(OF(null===(e=WO.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),IF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(OF(null===(i=WO.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),IF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=UF(this);this._symbolMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),IF("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 DH(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(){super.onLayoutEnd(),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}}}HH.type=rO.area,HH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},HH.mark=FH,HH.transformerConstructor=jH,U(HH,hz);class VH extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),FL(t)}}class NH extends Xj{constructor(){super(...arguments),this.transformerConstructor=VH,this.type="area",this.seriesType=rO.area}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}NH.type="area",NH.seriesType=rO.area,NH.transformerConstructor=VH,U(NH,tH);function WH(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 UH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:WH(t,e)}),GH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:WH(t,e)}),YH={type:"fadeIn"},XH={type:"growCenterIn"};function $H(t,e){if(!1===e)return{};switch(e){case"fadeIn":return YH;case"scaleIn":return XH;default:return UH(t)}}class KH extends AD{constructor(){super(...arguments),this.type=KH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}KH.type="rect";const qH=()=>{YA(),NA(),BP("rect",IP),WO.registerMark(KH.type,KH),oT.registerBuiltInAnimate("growHeightIn",eC),oT.registerBuiltInAnimate("growHeightOut",iC),oT.registerBuiltInAnimate("growWidthIn",_C),oT.registerBuiltInAnimate("growWidthOut",yC),oT.registerBuiltInAnimate("growCenterIn",JT),oT.registerBuiltInAnimate("growCenterOut",QT),WO.registerGraphicComponent("rect",Pg)},ZH=Object.assign(Object.assign({},MF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function JH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=EO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[wF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):xO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[TF]):xO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=xO(this._dataToPosX(t),e,i),n=xO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[CF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):xO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):xO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=xO(this._dataToPosY(t),e,i),n=xO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},eV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:FF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(eV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",YL.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===n.cartesianBandAxis));let r;if(pL(this._option.dataSet,"addVChartProperty",aF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};pL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:xF.bind(this),call:SF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new yD(this._option,r)}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=BF,s=CF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=TF,s=wF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=VI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)JH(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=xO(this[r](t),l,i),u=xO(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",YL.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",YL.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[xI],n=t[SI],r=t[kI],h=t[AI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[xI]:i,[SI]:s}),a?{[kI]:o,[AI]:l}:void 0),d="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(Pg(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,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=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>xO(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",YL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",YL.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>xO(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",YL.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",YL.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=d(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",YL.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",YL.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=UF(this);this._barMark.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),IF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=EO(this._spec.barWidth,a)),l&&(c=Math.max(c,EO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,EO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(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=EO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=KC(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}eV.type=rO.bar,eV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},eV.mark=ZH,eV.transformerConstructor=tV;const iV=()=>{Nj(),qH(),WO.registerAnimation("bar",((t,e)=>({appear:$H(t,e),enter:UH(t,!1),exit:GH(t,!1),disappear:GH(t)}))),wj(),Sj(),WO.registerSeries(eV.type,eV)};class sV extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),FL(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=p(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 nV extends Xj{constructor(){super(...arguments),this.transformerConstructor=sV,this.type="bar",this.seriesType=rO.bar}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}nV.type="bar",nV.seriesType=rO.bar,nV.transformerConstructor=sV,U(nV,tH);const rV=[10,20],aV=XC.Linear,oV="circle",lV=XC.Ordinal,hV=["circle","square","triangle","diamond","star"],cV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},dV=Object.assign(Object.assign({},MF),{point:{name:"point",type:"symbol"}});class uV extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class pV extends GF{constructor(){super(...arguments),this.type=rO.scatter,this.transformerConstructor=uV,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(c(e))return e;if(_(e)){if(d(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=`${uI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${uI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:aV,defaultRange:rV},"size")}getShapeAttribute(t,e){return d(e)?oV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:lV,defaultRange:hV},"shape")}initMark(){this._symbolMark=this._createMark(pV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:FF(this._spec,pV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=UF(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(OF(null===(i=WO.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),IF("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:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:oV},$L.STATE_NORMAL,YL.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$L.STATE_NORMAL,YL.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$L.STATE_NORMAL,YL.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",YL.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",YL.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},$L.STATE_NORMAL,YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$L.STATE_NORMAL,YL.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}pV.type=rO.scatter,pV.mark=dV,pV.builtInTheme={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"}}}}},pV.transformerConstructor=uV;const gV=()=>{vz(),WO.registerAnimation("scatter",((t,e)=>Object.assign({appear:cV(0,e)},ID))),wj(),Sj(),WO.registerSeries(pV.type,pV)};class fV extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class mV extends Xj{constructor(){super(...arguments),this.transformerConstructor=fV,this.type="scatter",this.seriesType=rO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}mV.type="scatter",mV.seriesType=rO.scatter,mV.transformerConstructor=fV,U(mV,tH);class vV extends NF{constructor(){super(...arguments),this.type=rO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${uI}_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 _V=`${uI}_MAP_LOOK_UP_KEY`,yV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[mI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[_V]=e.nameMap[n]:t[_V]=n})),t.features);class bV extends pF{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 xV extends AD{constructor(){super(...arguments),this.type=xV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}xV.type="path";const SV=()=>{WO.registerMark(xV.type,xV),YA(),zA(),WO.registerGraphicComponent("path",$g)},kV=Object.assign(Object.assign({},MF),{area:{name:"area",type:"path"}});class AV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ta[i]?(wa[i]||(wa[i]=Ba(i,Ta[i])),wa[i]):null}(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 MV{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(){}}class wV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 TV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:MV}:Vy(t)||Ny(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:wV}:null}const CV={debounce:yt,throttle:bt};class BV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Vy(this._renderMode)||Ny(this._renderMode),TV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return TV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!xe({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:lL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:lL.chart,consume:!1}];l.on(...c,CV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,CV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||TV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||TV(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 d(r)&&d(a)?s:xe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:lL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:lL.chart,consume:!1}];l.on(...c,CV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,CV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){TV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||TV(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:lL.chart},(t=>{if(!t.event)return;const{event:n}=t;xe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:lL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||TV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:lL.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||TV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:lL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:lL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:lL.chart,source:oL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:lL.chart,source:oL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=CV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=CV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:lL.chart})}));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:lL.chart,source:oL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:lL.chart,source:oL.chart},this._handleDragMouseUp)}))}}function PV(t,e){return`${uI}_${e}_${t}`}class EV extends Jz{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=UL.Mark,this._projectionSpec={name:PV(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(d(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:n.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=NO(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(){var t,e,i;this.event.on(aL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 AV(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===rO.map||e.type===rO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),QR(this._regions,(t=>{var e;if(t.type===rO.map||t.type===rO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ve})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==rO.map&&e.type!==rO.pictogram||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[_V],s=t.getDatumCenter(e);i&&u(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=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}EV.type=n.geoCoordinate,U(EV,BV);const RV=()=>{WO.registerComponent(EV.type,EV)};class OV extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class IV extends vV{constructor(){super(...arguments),this.type=rO.map,this.transformerConstructor=OV,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 !`),fL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),pL(this._dataSet,"copyDataView",xL),pL(this._dataSet,"map",yV),pL(this._dataSet,"lookup",nF);const i=fL.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:ML.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:_V,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 yD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(IV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:FF(this._spec,IV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:_I])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:_I]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",YL.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",YL.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(OF(null===(t=WO.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),IF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new bV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[mI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[mI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ve}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ve}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 mI}getActiveMarks(){return[this._pathMark]}}IV.type=rO.map,IV.mark=kV,IV.builtInTheme={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"}}}}},IV.transformerConstructor=OV;const LV=`${uI}_waterfall_default_seriesField`,DV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[BI]=!0:delete t[BI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=FV([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 f=g[0];let{start:m,end:v}=zV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=te(_,e)):(t[c]=+y,y=te(y,e)),t[d]=te(t[c],e),m=te(m,e),b=ee(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=te(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=FV(r,t,n,a,c,h,i,e),a.push(n)})),a};function FV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=zV(t,i,s,n,u);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=te(i.positive,e)):(t[h]=+i.negative,i.negative=te(i.negative,e)),t[c]=te(t[h],e),i.end=te(i.end,e)}i.isTotal=e,(d(p)||p===LV)&&(t[LV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function zV(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&&!d(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?Ly("total.collectCountField error"):n=e[a].start;o<0?Ly("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&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=te(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 jV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>te(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},HV={type:"fadeIn"},VV={type:"growCenterIn"};function NV(t,e){switch(e){case"fadeIn":return HV;case"scaleIn":return VV;default:return UH(t,!1)}}class WV extends AD{constructor(){super(...arguments),this.type=WV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}WV.type="rule";const UV=()=>{WO.registerMark(WV.type,WV),YA(),DA(),WO.registerGraphicComponent("line",wg)},GV=Object.assign(Object.assign({},ZH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),YV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:XV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function XV(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)=>XV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class $V{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 Aa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),pL(e,"dimensionTree",YV),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 KV extends tV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const qV={rect:iN,symbol:tN,arc:nN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=tN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:rN,line:aN,area:aN,rect3d:iN,arc3d:nN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function ZV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=qV[t])&&void 0!==i?i:qV.point;return e.series.type===rO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=QV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(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&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:oN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function JV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==rO.sankey){const{formatFunc:t,args:n}=iF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function QV(t){return c(t)?e=>t(e.data):t}function tN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=QV(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:eN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function eN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function iN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=QV(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:sN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function sN(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 nN(t){var e;const{labelSpec:i}=t,s=null!==(e=QV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function rN(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=JV(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),bg(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 aN(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}))):[{index:0,[_I]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function oN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class lN extends eV{constructor(){super(...arguments),this.type=rO.waterfall,this.transformerConstructor=KV,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 $V(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]],d(this._seriesField)&&(this._seriesField=LV)}getSeriesKeys(){return this._seriesField===LV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),pL(this._dataSet,"waterfallFillTotal",jV),pL(this._dataSet,"waterfall",DV),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=SL(this.getViewData(),this._dataSet,{name:`${uI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new yD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:xI,endAs:SI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=UF(this);this._barMark.setAnimationConfig(OF(null===(i=WO.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),IF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),IF("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(){super.initMark();const t=this._createMark(lN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ee(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:ee(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return rN(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?xO(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):xO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",YL.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",YL.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}lN.type=rO.waterfall,lN.mark=GV,lN.builtInTheme={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}}}},lN.transformerConstructor=KV;const hN=()=>{UV(),qH(),WO.registerAnimation("waterfall",((t,e)=>({appear:NV(t,e),enter:UH(t,!1),exit:GH(t,!1),disappear:GH(t,!1)}))),FD(),wj(),Sj(),WO.registerSeries(lN.type,lN)},cN=`${uI}_BOX_PLOT_OUTLIER_VALUE`;var dN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(dN||(dN={}));const uN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[cN]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class pN extends pF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===dN.OUTLIER)return this.series.getOutliersField();if(t===dN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case dN.MIN:return this.series.getMinField();case dN.MAX:return this.series.getMaxField();case dN.MEDIAN:return this.series.getMedianField();case dN.Q1:return this.series.getQ1Field();case dN.Q3:return this.series.getQ3Field();case dN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===dN.OUTLIER)return e[cN];if(t===dN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case dN.MIN:return e[this.series.getMinField()];case dN.MAX:return e[this.series.getMaxField()];case dN.MEDIAN:return e[this.series.getMedianField()];case dN.Q1:return e[this.series.getQ1Field()];case dN.Q3:return e[this.series.getQ3Field()];case dN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[cN])}getDefaultContentList(t){return[{key:this.getContentKey(dN.OUTLIER),value:this.getContentValue(dN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(dN.MAX),value:this.getContentValue(dN.MAX)},{key:this.getContentKey(dN.Q3),value:this.getContentValue(dN.Q3)},{key:this.getContentKey(dN.MEDIAN),value:this.getContentValue(dN.MEDIAN)},{key:this.getContentKey(dN.Q1),value:this.getContentValue(dN.Q1)},{key:this.getContentKey(dN.MIN),value:this.getContentValue(dN.MIN)},{key:this.getContentKey(dN.SERIES_FIELD),value:this.getContentValue(dN.SERIES_FIELD)}]}}class gN extends AD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==XL.enter&&t.context.diffState!==XL.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=WO.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const fN=()=>{WO.registerGraphicComponent("glyph",Rg),YA(),PA()},mN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],vN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class _N extends gN{constructor(){super(...arguments),this.type=_N.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=mN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=vN,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}_N.type="boxPlot";const yN=Object.assign(Object.assign({},MF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),bN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},xN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},SN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),kN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,P;if("horizontal"===e){w=null===(r=null===(n=(null===(s=SN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=SN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=SN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=SN(t,"box").attribute.width,i=SN(t,"box").attribute.x;B=i,P=i+e}else{w=null===(m=null===(f=(null===(g=SN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=SN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=SN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=SN(t,"box").attribute.height,i=SN(t,"box").attribute.y;B=i,P=i+e}return k(w)?w:k(B)&&k(P)?(B+P)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},AN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=SN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=SN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=SN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=SN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=SN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=SN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=SN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=SN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=SN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=SN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class MN extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return bN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class wN extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return xN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TN extends MN{computeAttribute(){return bN(AN)(this.target,this.params,this.params.options)}}class CN extends wN{computeAttribute(){return xN(AN)(this.target,this.params,this.params.options)}}class BN extends GF{constructor(){super(...arguments),this.type=rO.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(){this._boxPlotMark=this._createMark(BN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(BN.mark.outlier,{key:mI,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={lineWidth:this._lineWidth,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"};r.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const 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,$L.STATE_NORMAL,YL.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:x(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$L.STATE_NORMAL,YL.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=>xO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>xO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>xO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>xO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>xO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$L.STATE_NORMAL,YL.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=>xO(t(this.getDatumPositionValues(e,cN),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>xO(t(this.getDatumPositionValues(e,cN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$L.STATE_NORMAL,YL.Series)}}initData(){if(super.initData(),!this._data)return;pL(this._dataSet,"foldOutlierData",uN),pL(this._dataSet,"addVChartProperty",aF);const t=new Ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${uI}_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:xF.bind(this),call:SF}},!1),this._outlierDataView=new yD(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(){super.onLayoutEnd(),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=UF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=WO.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(IF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(OF(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(OF(null===(a=WO.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new pN(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]}}BN.type=rO.boxPlot,BN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},BN.mark=yN;const PN=()=>{fN(),DA(),NA(),WO.registerGraphicComponent("line",(t=>wg(t))),WO.registerGraphicComponent("rect",(t=>Pg(t))),WO.registerMark(_N.type,_N),vz(),DD(),wj(),Sj(),oT.registerBuiltInAnimate("boxplotScaleIn",MN),oT.registerBuiltInAnimate("boxplotScaleOut",wN),oT.registerBuiltInAnimate("barBoxplotScaleIn",TN),oT.registerBuiltInAnimate("barBoxplotScaleOut",CN),WO.registerSeries(BN.type,BN)};class EN extends AD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=EN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Gg(t):bg(t)}}EN.type="text";const RN=()=>{WO.registerMark(EN.type,EN),YA(),qA(),UA(),WO.registerGraphicComponent("text",bg),WO.registerGraphicComponent("richtext",Gg)};class ON extends pF{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 IN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),LN={type:"fadeIn"},DN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function FN(t,e){return"fadeIn"===e?LN:IN(t)}const zN=Object.assign(Object.assign({},ZH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class jN extends tV{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 HN extends eV{constructor(){super(...arguments),this.type=rO.rangeColumn,this._barMarkType="rect",this._barName=rO.bar,this.transformerConstructor=jN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(HN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:FF(this._spec,HN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(HN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(HN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(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",YL.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=UF(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(OF(null===(i=WO.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),IF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),IF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(OF(null===(n=WO.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),IF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new ON(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)}}HN.type=rO.rangeColumn,HN.mark=zN,HN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},HN.transformerConstructor=jN;const VN=()=>{qH(),RN(),WO.registerAnimation("rangeColumn",((t,e)=>({appear:FN(t,e),enter:IN(t),exit:DN(t),disappear:DN(t)}))),FD(),wj(),Sj(),WO.registerSeries(HN.type,HN)};var NN,WN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(NN||(NN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(WN||(WN={}));class UN extends pF{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 GN=Object.assign({},FH);class YN extends HH{constructor(){super(...arguments),this.type=rO.rangeArea}initMark(){this._areaMark=this._createMark(YN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{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",YL.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",YL.Series),this.setMarkStyle(t,{stroke:!1},"normal",YL.Series))}initTooltip(){this._tooltipHelper=new UN(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))}}YN.type=rO.rangeArea,YN.mark=GN;class XN extends NF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Yz,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(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(d(t)||d(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:[]};KC(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:[]};KC(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(aL.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)&&WF(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 $N(t){return Gy(t)?Number.parseFloat(t):0}const KN=(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&&qN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ue(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(m.forEach(((t,e)=>{const i=t[Dz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[Dz]*t;v(e,k,i),k+=i}))}if(0!==_&&(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},qN=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===$N(t[e])))||!i&&0===t.reduce(((t,i)=>t+$N(i[e])),0)));function ZN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const JN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:ZN(t,!0,wL.appear)}),QN={type:"fadeIn"},tW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:ZN(t,!0,wL.enter)}),eW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:ZN(t,!0,wL.exit)}),iW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:ZN(t,!0,wL.exit)});function sW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return QN;case"growRadius":return JN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return JN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class nW extends AD{constructor(t,e){super(t,e),this.type=rW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>oe({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Vz])[t]+s,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 rW extends nW{constructor(){super(...arguments),this.type=rW.type}}rW.type="arc";const aW=()=>{YA(),AA(),BP("arc",HP),oT.registerBuiltInAnimate("growRadiusIn",fC),oT.registerBuiltInAnimate("growRadiusOut",mC),oT.registerBuiltInAnimate("growAngleIn",qT),oT.registerBuiltInAnimate("growAngleOut",ZT),WO.registerGraphicComponent("arc",tf),WO.registerMark(rW.type,rW)},oW=Object.assign(Object.assign({},MF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class lW extends VF{_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=NO({},this._theme,i,t);const n=(t,e)=>NO({},"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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const hW=`${uI}_LABEL_VISIBLE`;class cW extends XN{constructor(){super(...arguments),this.transformerConstructor=lW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:wO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:wO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Uz,this._endAngle=Gz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Vz];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return oe(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=u(t),r=u(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}}(u(this._spec.startAngle)?ne(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?ne(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?ne(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;pL(this._dataSet,"pie",KN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?ne(this._spec.minAngle):0,asStartAngle:zz,asEndAngle:jz,asRatio:Fz,asMiddleAngle:Vz,asRadian:Wz,asQuadrant:Nz,asK:Hz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ma(this._dataSet,{name:`${uI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new yD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},cW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:vI,groupKey:this._seriesField,isSeriesMark:!0},{morph:FF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return iO(zz)(t)}endAngleScale(t){return iO(jz)(t)}_computeLayoutRadius(){return Xz((()=>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:SO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:SO(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",YL.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",YL.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,YL.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",YL.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:iO(hW).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(aL.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*(d(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[Vz];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return oe(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===wL.appear)return this._startAngle;if(i===wL.disappear)return this._endAngle;const r=[wL.disappear,wL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[mI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[mI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Vz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Vz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+oe({x:0,y:0},a,e[Vz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+oe({x:0,y:0},a,e[Vz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=OF(null===(i=WO.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]}}cW.transformerConstructor=lW,cW.mark=oW,cW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class dW extends cW{constructor(){super(...arguments),this.type=rO.pie}}dW.type=rO.pie;const uW=()=>{aW(),WO.registerAnimation("pie",((t,e)=>({appear:sW(t,e),enter:tW(t),exit:eW(t),disappear:iW(t)}))),WO.registerAnimation("emptyCircle",((t,e)=>({appear:sW(t,e)}))),WO.registerSeries(dW.type,dW)};function pW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const gW=t=>({type:pW(t.growField),options:{overall:!0}}),fW={type:"fadeIn"},mW=t=>({type:pW(t.growField)}),vW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},_W=vW;function yW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return fW;case"growAngle":return gW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return gW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class bW extends XN{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(SI),this.setInnerRadiusField(xI)}setValueFieldToPercent(){this.setRadiusField(AI),this.setInnerRadiusField(kI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const xW=Object.assign(Object.assign({},MF),{rose:{name:"rose",type:"arc"}});class SW extends VF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class kW extends nj{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=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,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:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,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(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=WO.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=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=UL.Axis,this._tick=void 0,this._center=null,this._startAngle=Uz,this._endAngle=Gz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),QR(this._regions,(t=>{"radius"===this.getOrient()?Iz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Iz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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:wO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:wO(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=ne(this._spec.startAngle),this._endAngle=ne(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Bz(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(){QR(this._regions,(t=>{"radius"===this.getOrient()?Iz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Iz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(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 KC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:KC(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 oe(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return le(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=>Oz(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",scale:this._scale});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=se.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",scale:this._scale.clone()});(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(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Xz((()=>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=Yz,e=0;const i=this.getChart().getSpec();return QR(this.getRegions(),(s=>{const n=s;if(r=n.type,[rO.rose,rO.radar,rO.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(NO({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(NO({},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)}}kW.type=n.polarAxis,kW.specKey="axes";const AW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},MW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class wW extends kW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new jB}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 pL(this._option.dataSet,t,$B),t}}wW.type=n.polarLinearAxis,wW.specKey="axes",wW.builtInTheme={axis:bj,axisLinear:vj,axisAngle:MW,axisRadius:AW},U(wW,mj);const TW=()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),WO.registerGraphicComponent(Qz.circleAxis,((t,e)=>new NC(t,e))),WO.registerGraphicComponent(tj.circleAxisGrid,((t,e)=>new $P(t,e))),rj(),WO.registerComponent(wW.type,wW)};class CW extends kW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new _B}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 pL(this._option.dataSet,t,iP),t}transformScaleDomain(){}}CW.type=n.polarBandAxis,CW.specKey="axes",CW.builtInTheme={axis:bj,axisBand:Aj,axisAngle:MW,axisRadius:AW},U(CW,kj);const BW=()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),WO.registerGraphicComponent(Qz.circleAxis,((t,e)=>new NC(t,e))),WO.registerGraphicComponent(tj.circleAxisGrid,((t,e)=>new $P(t,e))),rj(),WO.registerComponent(CW.type,CW)};class PW extends bW{constructor(){super(...arguments),this.type=rO.rose,this.transformerConstructor=SW,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(){this._roseMark=this._createMark(PW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:FF(this._spec,PW.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=>xO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=xO(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(OF(null===(i=WO.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),IF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}PW.type=rO.rose,PW.mark=xW,PW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},PW.transformerConstructor=SW;const EW=()=>{WO.registerSeries(PW.type,PW),aW(),WO.registerAnimation("rose",((t,e)=>({appear:yW(t,e),enter:mW(t),exit:vW(t),disappear:_W(t)}))),BW(),TW()};class RW extends _T{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:oe(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=le(this.from,this._prevCenter),{angle:i,radius:s}=le(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,UR(this._fromAngle,this._toAngle)&&UR(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=oe({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class OW extends VT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!JR(t)&&!JR(e))return e;const s=le(t,this._prevCenter),n=le(e,this._center);let r=ce(s.angle),a=ce(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return oe({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 ie(s,n,r,a);return o.defined=e.defined,o}}const IW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function LW(t,e,i){return"fadeIn"===e?IW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function DW(t,e,i){return"fadeIn"===e?IW(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 FW=(t,e)=>({custom:jT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),zW=Object.assign(Object.assign(Object.assign({},MF),lz),{area:{name:"area",type:"area"}});class jW extends bW{constructor(){super(...arguments),this.type=rO.radar,this.transformerConstructor=_z,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(jW.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:JD,closePath:!0},"normal",YL.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",YL.Series),this.event.on(aL.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:u(this._spec.startAngle)?ne(this._spec.startAngle):Uz},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(OF(null===(s=WO.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),IF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=WO.getAnimationInKey(e);t.setAnimationConfig(OF(null==i?void 0:i(n,r),IF(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&&_(a)?a[0]:a}}}jW.type=rO.radar,jW.mark=zW,jW.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},jW.transformerConstructor=_z,U(jW,hz);const HW=()=>{WO.registerSeries(jW.type,jW),LH(),fz(),vz(),WO.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:LW(t,e,"in"),enter:LW(t,e,"in"),exit:LW(t,e,"out"),disappear:"clipIn"===e?void 0:LW(t,e,"out"),update:[{channel:["points","center"],custom:OW,customParameters:t,duration:OD.update.duration,easing:OD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),WO.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:DW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:DW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:RW,customParameters:t,duration:OD.update.duration,easing:OD.update.easing}]}))),WO.registerAnimation("radarGroup",((t,e)=>({appear:FW(t,"in"),disappear:FW(t,"out")}))),AA(),BW(),TW()};class VW extends pF{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=>pi.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 NW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(uI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[mI]:r,[vI]:`${s}_${e}`})),r++}))})),n},WW={fill:"#bbb",fillOpacity:.2},UW=Object.assign(Object.assign({},MF),{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 GW extends GF{constructor(){super(...arguments),this.type=rO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),pL(this._option.dataSet,"objFlat",NW),pL(this._option.dataSet,"copyDataView",xL),gL(this._option.dataSet,"dataview",xa),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:ML.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(NO(WW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(GW.mark.group),this._containerMark=this._createMark(GW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(GW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(GW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(GW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(GW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(GW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(GW.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",YL.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",YL.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",YL.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",YL.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",YL.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",YL.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",YL.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",YL.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",YL.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:_I}}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 _O).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:_I}}initTooltip(){this._tooltipHelper=new VW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}GW.type=rO.dot,GW.mark=UW,GW.builtInTheme={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"}}}}};class YW extends pF{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=>pi.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 XW=Object.assign(Object.assign({},MF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),$W=(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 KW extends GF{constructor(){super(...arguments),this.type=rO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),pL(this._option.dataSet,"linkDotInfo",$W),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:ML.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(KW.mark.group),this._containerMark=this._createMark(KW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(KW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(KW.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",YL.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",YL.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",YL.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",YL.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:_I}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new YW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}KW.type=rO.link,KW.mark=XW,KW.builtInTheme={link:{arrow:{style:{size:10}}}};const qW=Object.assign(Object.assign({},MF),{group:{name:"group",type:"group"}});class ZW extends XN{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()?xI:LI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle);let o;if(u(s)){const t=at(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 d(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()?SI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ne(i.offsetAngle),o=at(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=u(n)?ne(n):Uz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?ne(r):Gz,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)||u(null==s?void 0:s.startAngle)||u(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=xO(this.angleAxisHelper.dataToPosition([t[xI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=xO(this.angleAxisHelper.dataToPosition([t[SI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?xO(e,this.angleAxisHelper.getScale(0)):e}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",YL.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ne(a),o=ne(r)/2;return tf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 eU=()=>{WO.registerAnimation("circularProgress",((t,e)=>({appear:tU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class iU extends VF{constructor(){super(...arguments),this._supportStack=!0}}class sU extends ZW{constructor(){super(...arguments),this.type=rO.circularProgress,this.transformerConstructor=iU,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(k(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(k(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(){return this._progressMark=this._createMark(sU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:FF(this._spec,"progress")}),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",YL.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(sU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?xI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?SI: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",YL.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(OF(null===(i=WO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),IF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),IF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}sU.type=rO.circularProgress,sU.mark=JW,sU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},sU.transformerConstructor=iU;const nU=()=>{WO.registerSeries(sU.type,sU),aW(),eU(),FD(),BW(),TW()};function rU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:rU(t)}),oU={type:"fadeIn"};function lU(t,e="grow"){return!1===e?{}:"fadeIn"===e?oU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:rU(t)}))(t)}class hU extends pF{enableByType(t){return"dimension"!==t}}const cU=Object.assign(Object.assign({},MF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class dU extends GF{constructor(){super(...arguments),this.type=rO.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=u(e.width)?e.width:e.x1-e.x,o=u(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;return this._progressMark=this._createMark(dU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape: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 xO(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 xO(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?xO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",YL.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 xO(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 xO(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,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?xO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",YL.Series)}}_initTrackMark(){return this._trackMark=this._createMark(dU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return xO(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",YL.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return xO(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",YL.Series))}getInteractionTriggers(){const t=[];return 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(OF(null===(i=WO.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),IF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),IF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new hU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}dU.type=rO.linearProgress,dU.mark=cU,dU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const uU=()=>{qH(),WO.registerAnimation("linearProgress",((t,e)=>({appear:lU(t,e),enter:lU(t),disappear:aU(t)}))),FD(),WO.registerSeries(dU.type,dU)},pU=[0],gU=[20,40],fU=[200,500],mU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},vU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],_U=`${uI}_WORD_CLOUD_TEXT`,yU=Object.assign(Object.assign({},MF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),bU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class xU extends NF{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){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=gU}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:fU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:pU,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)?_U:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:mU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Hy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:pU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!vU.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;this._wordMark=this._createMark(xU.mark.word,{key:vI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(xU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:UL.Mark-1}))}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",YL.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",YL.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",YL.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(OF(WO.getAnimationInKey("wordCloud")(n,s),IF("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 _O).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:_I])}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 jB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new jB).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[mI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,aL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:vI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:__.createCanvas.bind(__),getTextBounds:cf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:zg,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(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:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}xU.mark=yU,xU.builtInTheme={wordCloud:bU};function SU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||OD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;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===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=kU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},AU=(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=AU(t.children,e,t,n))})),s},MU=(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=MU(t.children,e,t,n)),n=e(t,s,i,n)})),n},wU=(t,e=[],i)=>{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):wU(t.children,e,i)))})),e};function TU(t,e){let i,s;if(PU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function PU(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*B,y:n+A+M*B,radius:B}}function IU(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 LU(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 DU(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 FU(t){return{_:t,next:null,prev:null}}function zU(t,e){const i=(t=G(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];IU(n,s,r);let a,o,l,h,c,d,u,p=FU(s),g=FU(n),f=FU(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=kU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Mt)/Mt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:NU.defaultOpionts.nodeSort;AU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)AU([o],jU(h)),MU([o],HU(this._getPadding,.5,a)),AU([o],VU(1,this._maxDepth));else{const t=Math.min(s.width,s.height);AU([o],jU(NU.defaultOpionts.setRadius)),MU([o],HU(Pt,1,a)),d&&MU([o],HU(this._getPadding,o.radius/t,a)),AU([o],VU(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}NU.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const WU=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=WU(t.children):t.value=0),e+=Math.abs(t.value)})),e};function UU(t){return t.depth}function GU(t,e){return e-1-t.endDepth}const YU=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),XU=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},$U={left:UU,right:GU,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?$(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:UU,end:GU},KU=vt(0,1);class qU{constructor(t){this._ascendingSourceBreadth=(t,e)=>YU(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>YU(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},qU.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._logger=nt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):$U[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===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=[];WU(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=d(t.value)?0:kt(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=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=kt(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=!d(r.source),l=!d(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&&d(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=[XU(s[t.source]),XU(s[t.target],!0)].filter((t=>!d(t)));e.length&&(t.value=$(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=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,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*KU(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)}d(this.options.nodeSortBy)&&n.sort(YU),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(YU),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];ZU(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),JU);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},QU.defaultOpionts,t):Object.assign({},QU.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Ct(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Bt(t,n))):Bt(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Bt(t,n))):Bt(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Bt(r,n),i=(u-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-(_(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=kU(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=oe({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)}}}function tG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:ZU,slice:tG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?tG:ZU)(t,e,i,s,n)}};class sG{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=_(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=_(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=_(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=_(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({},sG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Ct(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?eG(this.options.aspectRatio):null!==(e=iG[this.options.splitType])&&void 0!==e?e:iG.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=kU(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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function nG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+oi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return nt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=nG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Mi(o.map(Mi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rAt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=rG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&nt.getInstance().error("Area "+r+" not represented on screen")}return i}function uG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ci((function(i){return-1*pG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},fG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:G(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||oG,s=e.lossFunction||aG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];li(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rse.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:gG(l),arcs:l})}))},mG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:vG,triangle:vG,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 vG(){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 _G(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 yG=t=>mG[t]?mG[t]():mG.circle(),bG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function xG(t){return c(t)?t:function(){return t}}class SG{constructor(t){var e,i;switch(this.options=z({},SG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=yG(this.options.shape),this.getText=null!==(e=xG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=xG(this.options.fontWeight),this.getTextFontSize=xG(this.options.fontSize),this.getTextFontStyle=xG(this.options.fontStyle),this.getTextFontFamily=xG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>bG(10,50);break;case"random-light":this.getTextColor=()=>bG(50,90);break;default:this.getTextColor=xG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return ne(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():At(e);return ne(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&&!d(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 AG extends SG{constructor(t){var e;super(z({},AG.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<=AG.defaultOptions.minFontSize&&(this.options.minFontSize=AG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=kG[this.options.spiral])&&void 0!==e?e:kG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=xG(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}=_G(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(TG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}CG(p,this._size)&&(p=BG(p,this._size))}else if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||wG(p,i))&&(!i||!MG(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 MG(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 wG(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,CG=(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 BG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},EG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>oe(t,e,i+r*n)))},RG=(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()},OG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=_G(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=yG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return oe(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)RG(n,EG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)RG(n,EG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)RG(n,EG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)RG(n,EG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)RG(n,EG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=EG({x:l,y:h},o,-Math.PI/2,5),e=EG({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]);RG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let LG=class t extends kG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),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 B=[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]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:B,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(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(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?EG(t,o,l.width,l.height,h):"geometric"===t.type&&IG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=yG(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()}};LG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class DG extends kG{constructor(t){super(z({},DG.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)}DG.defaultOptions={enlarge:!1};const zG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return nt.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?HG(t.fontFamily):"sans-serif",d=t.fontStyle?HG(t.fontStyle):"normal",u=t.fontWeight?HG(t.fontWeight):"normal",p=t.rotate?HG(t.rotate):0,g=HG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?HG(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},zG),t.as):zG,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?HG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=NG(WG(t,l),C);T=i=>e(t(i))}let B=MG;"fast"===t.layoutType?B=DG:"grid"===t.layoutType&&(B=LG);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},HG=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],VG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),NG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=VG(t[0]),n=VG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(VG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},WG=(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 UG(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{UO.registerGrammarTransform("wordcloud",{transform:jG}),ON(),UO.registerAnimation("wordCloud",((t,e)=>({appear:kU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),UO.registerSeries(GG.type,GG)},XG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},$G=(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},KG=`${pI}_FUNNEL_TRANSFORM_RATIO`,qG=`${pI}_FUNNEL_REACH_RATIO`,ZG=`${pI}_FUNNEL_HEIGHT_RATIO`,JG=`${pI}_FUNNEL_VALUE_RATIO`,QG=`${pI}_FUNNEL_LAST_VALUE_RATIO`,tY=`${pI}_FUNNEL_NEXT_VALUE_RATIO`,eY=`${pI}_FUNNEL_LAST_VALUE`,iY=`${pI}_FUNNEL_CURRENT_VALUE`,sY=`${pI}_FUNNEL_NEXT_VALUE`,nY=`${pI}_FUNNEL_TRANSFORM_LEVEL`;class rY extends gF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[qG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class aY extends MD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class oY extends aY{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}oY.type="polygon";const lY=()=>{UO.registerMark(oY.type,oY),XA(),VA(),lT.registerBuiltInAnimate("growPointsOut",oC),UO.registerGraphicComponent("polygon",sf)},hY=Object.assign(Object.assign({},wF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class cY extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class dY extends WF{constructor(){super(...arguments),this.type=aO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=cY,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;gL(this._dataSet,"funnel",XG),gL(this._dataSet,"funnelTransform",$G);const t=new Ma(this._dataSet,{name:`${pI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new bD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:iY,asTransformRatio:KG,asReachRatio:qG,asHeightRatio:ZG,asValueRatio:JG,asNextValueRatio:tY,asLastValueRatio:QG,asLastValue:eY,asNextValue:sY,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:nY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},dY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:zF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},dY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(dY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(dY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new rY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",XL.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",XL.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{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",XL.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",XL.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",XL.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===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",XL.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Iy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*sO(qG).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",XL.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(IF(null===(s=UO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),LF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IF(UO.getAnimationInKey("fadeInOut")(),LF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IF(UO.getAnimationInKey("funnel")({},o),LF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IF(null===(a=UO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),LF("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[QG])/2:this._getSecondaryAxisLength(t[JG])/2,n=this._getSecondaryAxisLength(t[JG])/2):(s=this._getSecondaryAxisLength(t[JG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[tY])/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[nY])}_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 u(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[_I]===t[_I]));if(!u(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(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{lY(),ON(),GV(),UO.registerSeries(dY.type,dY),UO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},DD))),UO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:VT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:VT,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),zD()},pY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},gY=t=>{const e=t.filter((t=>t.context.diffState===$L.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},fY=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},mY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),vY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},_Y=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},bY=(t,e={})=>{if(!t)return[];const i=[];return TU(t,i,e),i},xY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new tG(i).layout(t,{width:s,height:n})};class SY extends gF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var kY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(kY||(kY={}));const AY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===kY.DrillDown){return G($I(t,n,s,"children"))}if(i.type===kY.DrillUp){const e=KI(t,n,s,"children");if(e)return G(e)}return t};class MY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=CV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;gL(t,"drillFilter",AY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||P(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:kY.DrillDown},e().reRunAllTransform(),i.emit(oL.drill,{value:{path:t,type:kY.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(!_(n)||P(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:kY.DrillUp},i().reRunAllTransform(),s.emit(oL.drill,{value:{path:n,type:kY.DrillUp},model:this}),n}}const wY=Object.assign(Object.assign({},wF),{sunburst:{name:"sunburst",type:"arc"}}),TY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:yF,operations:["max","min","values"]}),t.push({key:bF,operations:["values"]}),t),CY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class BY extends $N{constructor(){super(...arguments),this.type=aO.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:bF),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:_I},getRawData:()=>this.getRawData()}),this._startAngle=ne(this._spec.startAngle),this._endAngle=ne(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),gL(this._dataSet,"sunburstLayout",xY),gL(this._dataSet,"flatten",bY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 TY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(gL(t.dataSet,"addVChartProperty",oF),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(BY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},KL.STATE_NORMAL,XL.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(BY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},KL.STATE_NORMAL,XL.Series)}initTooltip(){this._tooltipHelper=new SY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(IF(null===(e=UO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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}}BY.type=aO.sunburst,BY.mark=wY,BY.builtInTheme={sunburst:CY},U(BY,MY);const PY=()=>{UO.registerSeries(BY.type,BY),oW(),ON(),zD(),UO.registerAnimation("sunburst",((t,e)=>({appear:yY(0,e),enter:mY(t),exit:_Y(t),disappear:_Y(t)})))},EY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new WU(i).layout(t,{width:s,height:n})};class RY extends gF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const OY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},IY=Object.assign(Object.assign({},wF),{circlePacking:{name:"circlePacking",type:"arc"}});class LY extends YF{constructor(){super(...arguments),this.type=aO.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:bF),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:_I},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),gL(this._dataSet,"circlePackingLayout",EY),gL(this._dataSet,"flatten",bY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(gL(t.dataSet,"addVChartProperty",oF),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(LY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},KL.STATE_NORMAL,XL.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(LY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},KL.STATE_NORMAL,XL.Series)}getStatisticFields(){return TY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new RY(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(IF(null===(i=UO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}LY.type=aO.circlePacking,LY.mark=IY,LY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(LY,MY);const DY=()=>{UO.registerSeries(LY.type,LY),oW(),ON(),FD(),UO.registerAnimation("circlePacking",((t,e)=>({appear:OY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},FY=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&FY(t,e.children,i)}))},zY=t=>{var e;if(!t||!_(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},jY=(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 ZU(e),r=[];return r.push(n.layout(s,i)),r},HY=t=>{var e,i;return t&&_(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:[]},VY=t=>{var e,i;return t&&_(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 NY extends gF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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 WY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),UY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:WY(t),GY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YY extends yT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XY extends yT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const $Y=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},KY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qY extends fN{constructor(){super(...arguments),this.type=qY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?KY:$Y,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qY.type="linkPath";const ZY=Object.assign(Object.assign({},wF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JY extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class tX extends YF{constructor(){super(...arguments),this.type=aO.sankey,this.transformerConstructor=JY,this._nodeLayoutZIndex=GL.Node,this._labelLayoutZIndex=GL.Label,this._viewBox=new ze,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(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=iL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=iL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=iL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),QY(e,KL.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(KL.STATE_SANKEY_EMPHASIS),e.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=iL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=iL(n[0]))||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=iL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=iL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(KL.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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=iL(s),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(KL.STATE_SANKEY_EMPHASIS_REVERSE),void QY(s,KL.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(KL.STATE_SANKEY_EMPHASIS_REVERSE),void QY(s,KL.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(KL.STATE_SANKEY_EMPHASIS),s.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(iL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(KL.STATE_SANKEY_EMPHASIS),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=iL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=iL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void QY(t,KL.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void QY(t,KL.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(KL.STATE_SANKEY_EMPHASIS_REVERSE),void QY(t,KL.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(KL.STATE_SANKEY_EMPHASIS),t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,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){gL(this._dataSet,"sankeyLayout",jY),gL(this._dataSet,"sankeyFormat",zY),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:wL.sankeyLayout});const{dataSet:a}=this._option;gL(a,"sankeyNodes",HY),gL(a,"flatten",bY);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:SF.bind(this),call:kF}},!1),this._nodesSeriesData=o,gL(a,"sankeyLinks",VY);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:SF.bind(this),call:kF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(tX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(tX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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},KL.STATE_NORMAL,XL.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",XL.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},KL.STATE_NORMAL,XL.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",XL.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=sF(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(IF(null===(i=UO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),LF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),LF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:hL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([KL.STATE_SANKEY_EMPHASIS_REVERSE,KL.STATE_SANKEY_EMPHASIS]),e.includes(iL(t).key)?t.addState(KL.STATE_SANKEY_EMPHASIS,!0):t.addState(KL.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new NY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new yO;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=>{u(t[i])&&e.add(t[i]),u(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 FY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}tX.type=aO.sankey,tX.transformerConstructor=JY,tX.mark=ZY,tX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const eX=()=>{ZH(),mN(),jA(),UO.registerGraphicComponent("path",(t=>Xg(t))),UO.registerMark(qY.type,qY),ON(),UO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:UY(t,e)},DD))),UO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lT.registerBuiltInAnimate("linkPathGrowOut",XY),lT.registerBuiltInAnimate("linkPathGrowIn",YY),zD(),UO.registerSeries(tX.type,tX)},iX=(t,e)=>{let i={},s=e.fields;if(c(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=bY(n);return i=mF([{latestData:r}],e),i};class sX extends gF{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 nX=Object.assign(Object.assign({},wF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),rX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class aX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const oX=(t,e)=>{if(e.getViewBox()){const i=new nG(e).layout(t,e.getViewBox()),s=[];return TU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[bF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class lX extends YF{constructor(){super(...arguments),this.type=aO.treemap,this.transformerConstructor=aX,this._categoryField="name",this._valueField="value",this._viewBox=new ze,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:bF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ve),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:_I},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),gL(this._dataSet,"treemap",oX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(gL(this._rawData.dataSet,"addVChartProperty",oF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:MF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=iX([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){gL(this._dataSet,"hierarchyDimensionStatistics",iX),gL(this._dataSet,"flatten",bY);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 TY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(lX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(lX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},KL.STATE_NORMAL,XL.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()},KL.STATE_NORMAL,XL.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.Series),this._initRichStyleOfLabelMark(t))}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},KL.STATE_NORMAL,XL.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),LF(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 sX(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(rL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(rL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}lX.type=aO.treemap,lX.mark=nX,lX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},lX.transformerConstructor=aX,U(lX,MY),U(lX,PV);const hX=()=>{UO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),UO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),ZH(),ON(),UO.registerAnimation("treemap",((t,e)=>({appear:rX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),zD(),UO.registerSeries(lX.type,lX)},cX=Object.assign(Object.assign({},ZW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),dX=Object.assign(Object.assign({},wF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),uX={type:"fadeIn"};function pX(t,e){return"fadeIn"===e?uX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class gX extends NF{constructor(){super(...arguments),this._supportStack=!1}}class fX extends gF{enableByType(t){return"dimension"!==t}}const mX="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",vX={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:mX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:mX,fill:"#ddd"}}};class _X extends JW{constructor(){super(...arguments),this.type=aO.gaugePointer,this.transformerConstructor=gX,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(_X.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_X.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_X.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 fX(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 u(this.radiusAxisHelper)&&u(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=$(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(IF(null===(i=UO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_X.type=aO.gaugePointer,_X.mark=dX,_X.builtInTheme={gaugePointer:vX},_X.transformerConstructor=gX;const yX=()=>{UO.registerSeries(_X.type,_X),kV(),ZH(),UO.registerAnimation("gaugePointer",((t,e)=>{const i=pX(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),PW(),CW()};class bX extends NF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class xX extends JW{constructor(){super(...arguments),this.type=aO.gauge,this.transformerConstructor=bX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ne(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();gL(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[FI]=t[this._angleField[0]],t[DI]=e>0?i[e-1][FI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(xX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(xX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,XL.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?SO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?SO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[DI])?this.angleAxisHelper.dataToPosition([t[DI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[FI]])}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(IF(null===(i=UO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),LF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}xX.type=aO.gauge,xX.mark=cX,xX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},xX.transformerConstructor=bX;class SX extends MD{constructor(){super(...arguments),this.type=SX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Sg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}SX.type="cell";function kX(t){return!1===t?{}:{type:"fadeIn"}}class AX extends gF{enableByType(t){return"dimension"!==t}}const MX=Object.assign(Object.assign({},wF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class wX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class TX extends YF{constructor(){super(...arguments),this.type=aO.heatmap,this.transformerConstructor=wX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(TX.mark.cell,{isSeriesMark:!0},{morph:zF(this._spec,TX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(TX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",XL.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=si(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",XL.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=GF(this);this._cellMark.setAnimationConfig(IF(null===(i=UO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),LF("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 AX(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]}}TX.type=aO.heatmap,TX.mark=MX,TX.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},TX.transformerConstructor=wX;const CX=()=>{ON(),UO.registerMark(SX.type,SX),UO.registerGraphicComponent("symbol",Sg),XA(),KA(),OP(),UO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},DD),{appear:kX(e)}))),Tj(),kj(),UO.registerSeries(TX.type,TX)},BX=Object.assign(Object.assign({},wF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),PX=`${pI}_CORRELATION_X`,EX=`${pI}_CORRELATION_Y`,RX=`${pI}_CORRELATION_SIZE`,OX=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=ne(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=ne(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Bt(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Bt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Ct(e.field),C=t.map(T),[B,P]=Et(C),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),R=d(e.radiusField)?T:Ct(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Et(t.map(R)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=IX(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=E(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),LX({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,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},LX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[vI]:null==n?void 0:n[vI],[yI]:null==n?void 0:n[yI]}};class FX extends fN{constructor(){super(...arguments),this.type=FX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=ft(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}FX.type="ripple";const zX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class jX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class HX extends $N{constructor(){super(...arguments),this.type=aO.correlation,this.transformerConstructor=jX,this._viewBox=new ze}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;gL(this._dataSet,"correlation",OX);const s=new Aa;fL(s,"dataview",xa),gL(s,"correlationCenter",DX);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 bD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(HX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:vI});t&&(t.setMarkConfig({zIndex:GL.Node}),this._nodePointMark=t);const e=this._createMark(HX.mark.ripplePoint,{key:vI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(HX.mark.centerPoint,{key:vI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:GL.Node}),this._centerPointMark=i)}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[PX],y:t=>t[EX],size:t=>t[RX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.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)},KL.STATE_NORMAL,XL.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),LF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}HX.type=aO.correlation,HX.mark=BX,HX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},HX.transformerConstructor=jX;const VX=()=>{_z(),mN(),KA(),UO.registerMark(FX.type,FX),UO.registerGraphicComponent("symbol",(t=>Sg(t))),UO.registerSeries(HX.type,HX),UO.registerAnimation("correlation",((t,e)=>Object.assign({appear:zX(0,e)},LD)))},NX=Object.assign(Object.assign({},wF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class WX extends fN{constructor(){super(...arguments),this.type=WX.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}WX.type="liquid";const UX=(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 GX extends gF{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 YX extends WF{constructor(){super(...arguments),this.type=aO.liquid,this.transformerConstructor=yz,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Bg({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=Sg({x:s,y:n,size:r,symbolType:UX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=PO(this._spec.outlineMargin),this._paddingSpec=PO(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=Wt(...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(YX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(YX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(YX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(YX.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",XL.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",XL.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",XL.Series)}initTooltip(){this._tooltipHelper=new GX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IF(null===(i=UO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),LF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IF(null===(s=UO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),LF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(oL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=yM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}YX.type=aO.liquid,YX.mark=NX,YX.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},YX.transformerConstructor=yz;const XX=t=>G(t).join(",");class $X extends gF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>XX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>XX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const KX=Object.assign(Object.assign({},wF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class qX extends NF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const ZX=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?mG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class JX extends WF{constructor(){super(...arguments),this.type=aO.venn,this.transformerConstructor=qX,this._viewBox=new ze}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:_I)}initData(){var t;super.initData(),gL(this._dataSet,"venn",ZX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(JX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(JX.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()},KL.STATE_NORMAL,XL.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},KL.STATE_NORMAL,XL.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},KL.STATE_HOVER,XL.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>XX(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)}},KL.STATE_NORMAL,XL.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>XX(t.sets)},KL.STATE_NORMAL,XL.Series))}initTooltip(){this._tooltipHelper=new $X(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:XX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return XX(i)}legendSelectedFilter(t,e){if(t.type===n.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[XX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(XX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=UO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),LF(t.name,this._spec,this._markAttributeContext)))}))}}JX.type=aO.venn,JX.mark=KX,JX.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},JX.transformerConstructor=qX;class QX extends iV{constructor(){super(...arguments),this.type=aO.mosaic,this.transformerConstructor=eV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(OI),this.setFieldX2(RI)),this.setFieldY(LI),this.setFieldY2(II)):(t&&(this.setFieldY(OI),this.setFieldY2(RI)),this.setFieldX(LI),this.setFieldX2(II)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}QX.type=aO.mosaic,QX.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},QX.transformerConstructor=eV;class t$ extends qj{_isValidSeries(t){return t===aO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class e$ extends $j{constructor(){super(...arguments),this.transformerConstructor=t$,this.type="map",this.seriesType=aO.map}}e$.type="map",e$.seriesType=aO.map,e$.transformerConstructor=t$;class i$ extends qj{_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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class s$ extends i${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=Ez(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,WO({},s,l)),n&&Object.assign(o,WO({},n,o))}}class n$ extends i${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class r$ extends i${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class a$ extends $j{constructor(){super(...arguments),this.transformerConstructor=r$}}a$.transformerConstructor=r$;class o$ extends a${constructor(){super(...arguments),this.transformerConstructor=r$,this.type="pie",this.seriesType=aO.pie}}o$.type="pie",o$.seriesType=aO.pie,o$.transformerConstructor=r$;class l$ extends n${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Xz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Xz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>WO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const h$=(t,e)=>{if(!t)return null;const i=az(t,(t=>"angle"===t.getOrient()),e),s=az(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&&JC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=ZR({x:1,y:0},u);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=JR(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=nz(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&&JC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=ZR({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=JR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=nz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class c$ extends $j{constructor(){super(...arguments),this.transformerConstructor=l$,this.type="rose",this.seriesType=aO.rose}_setModelOption(){this._modelOption.getDimensionInfo=h$}}c$.type="rose",c$.seriesType=aO.rose,c$.transformerConstructor=l$,U(c$,eH);class d$ extends n${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=WO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>WO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class u$ extends $j{constructor(){super(...arguments),this.transformerConstructor=d$,this.type="radar",this.seriesType=aO.radar}_setModelOption(){this._modelOption.getDimensionInfo=h$}}u$.type="radar",u$.seriesType=aO.radar,u$.transformerConstructor=d$,U(u$,eH);class p$ extends qj{_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=p(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=>{E(e,"trimPadding")&&WO(e,VL(this.type,t))})),this._transformAxisSpec(t)}}class g$ extends $j{constructor(){super(...arguments),this.transformerConstructor=p$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=dH(t,e,i))&&void 0!==s?s:[],...null!==(n=h$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}g$.type="common",g$.transformerConstructor=p$,U(g$,eH);class f$ extends Zj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class m$ extends $j{constructor(){super(...arguments),this.transformerConstructor=f$}}m$.transformerConstructor=f$,U(m$,eH);class v$ extends f${transformSpec(t){super.transformSpec(t),zL(t)}}class _$ extends m${constructor(){super(...arguments),this.transformerConstructor=v$,this.type="histogram",this.seriesType=aO.bar}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}_$.type="histogram",_$.seriesType=aO.bar,_$.transformerConstructor=v$;class y$ extends s${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class b$ extends $j{constructor(){super(...arguments),this.transformerConstructor=y$,this.type="circularProgress",this.seriesType=aO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=h$}}b$.type="circularProgress",b$.seriesType=aO.circularProgress,b$.transformerConstructor=y$,U(b$,eH);class x$ extends s${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=aO.circularProgress,e}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===aO.gauge||t.type===aO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(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===aO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:GL.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)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=GL.Region+50)}}class S$ extends $j{constructor(){super(...arguments),this.transformerConstructor=x$,this.type="gauge",this.seriesType=aO.gaugePointer}}S$.type="gauge",S$.seriesType=aO.gaugePointer,S$.transformerConstructor=x$;class k$ extends qj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class A$ extends $j{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="wordCloud",this.seriesType=aO.wordCloud}}A$.transformerConstructor=k$;class M$ extends A${constructor(){super(...arguments),this.transformerConstructor=k$,this.type="wordCloud",this.seriesType=aO.wordCloud}}M$.type="wordCloud",M$.seriesType=aO.wordCloud,M$.transformerConstructor=k$;class w$ extends qj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class T$ extends $j{constructor(){super(...arguments),this.transformerConstructor=w$,this.type="funnel",this.seriesType=aO.funnel}}T$.type="funnel",T$.seriesType=aO.funnel,T$.transformerConstructor=w$;class C$ extends Zj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=Ez(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=Ez(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class B$ extends $j{constructor(){super(...arguments),this.transformerConstructor=C$,this.type="linearProgress",this.seriesType=aO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}B$.type="linearProgress",B$.seriesType=aO.linearProgress,B$.transformerConstructor=C$,U(B$,eH);class P$ extends Zj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),zL(t)}}class E$ extends $j{constructor(){super(...arguments),this.transformerConstructor=P$,this.type="rangeColumn",this.seriesType=aO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}E$.type="rangeColumn",E$.seriesType=aO.rangeColumn,E$.transformerConstructor=P$;class R$ extends qj{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+re(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class O$ extends $j{constructor(){super(...arguments),this.transformerConstructor=R$,this.type="sunburst",this.seriesType=aO.sunburst}}O$.type="sunburst",O$.seriesType=aO.sunburst,O$.transformerConstructor=R$;class I$ extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class L$ extends $j{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="circlePacking",this.seriesType=aO.circlePacking}}L$.type="circlePacking",L$.seriesType=aO.circlePacking,L$.transformerConstructor=I$;class D$ extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class F$ extends $j{constructor(){super(...arguments),this.transformerConstructor=D$,this.type="treemap",this.seriesType=aO.treemap}}F$.type="treemap",F$.seriesType=aO.treemap,F$.transformerConstructor=D$;class z$ extends nV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),zL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class j$ extends rV{constructor(){super(...arguments),this.transformerConstructor=z$,this.type="waterfall",this.seriesType=aO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}j$.type="waterfall",j$.seriesType=aO.waterfall,j$.transformerConstructor=z$;class H$ extends Zj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),zL(t)}}class V$ extends $j{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="boxPlot",this.seriesType=aO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}V$.type="boxPlot",V$.seriesType=aO.boxPlot,V$.transformerConstructor=H$;class N$ extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class W$ extends $j{constructor(){super(...arguments),this.transformerConstructor=N$,this.type="sankey",this.seriesType=aO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=iL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}W$.type="sankey",W$.seriesType=aO.sankey,W$.transformerConstructor=N$;class U$ extends Zj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),zL(t)}}class G$ extends $j{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="rangeArea",this.seriesType=aO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=dH,this._modelOption.getDimensionInfoByValue=pH,this._modelOption.getRectByDimensionData=yH}}G$.type="rangeArea",G$.seriesType=aO.rangeArea,G$.transformerConstructor=U$;class Y$ extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class X$ extends $j{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="heatmap",this.seriesType=aO.heatmap}}X$.type="heatmap",X$.seriesType=aO.heatmap,X$.transformerConstructor=Y$;class $$ extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class K$ extends $j{constructor(){super(...arguments),this.transformerConstructor=$$,this.type="correlation",this.seriesType=aO.correlation}}K$.type="correlation",K$.seriesType=aO.correlation,K$.transformerConstructor=$$;function q$(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=tL(t.style)),P(t.textStyle)||WO(s.textStyle,tL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&tL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&tL(s.background.style),s}const Z$=(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},J$=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:yI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class Q$ extends Qz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=GL.Legend,this.layoutLevel=YL.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),tO(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=AO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new bD(this._option,t),this._initSelectedData(),tO(this._regions,(t=>{t.event.on(oL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(tO(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(oL.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;k(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)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(WO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(WO({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(WO({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(oL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}Q$.specKey="legends";class tK extends Q${constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return nF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),tO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:wL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){gL(this._option.dataSet,"discreteLegendFilter",J$),gL(this._option.dataSet,"discreteLegendDataMake",Z$);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return tO(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!Xy(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 c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=VI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:p,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:_,padding:y}=e,b=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?b.title=q$(s):b.title={visible:!1},P(n.focusIconStyle)||tL(n.focusIconStyle),n.shape&&(n.shape=ZI(n.shape)),n.label&&(n.label=ZI(n.label)),n.value&&(n.value=ZI(n.value)),n.background&&(n.background=ZI(n.background)),MO(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),MO(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),MO(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||tL(r.railStyle),P(r.sliderStyle)||tL(r.sliderStyle)):(P(r.textStyle)||tL(r.textStyle),r.handler&&ZI(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(WO(b,a.style),u(a.padding)&&(b.padding=a.padding)),b}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return lR}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(eR.legendItemClick,(e=>{const i=E(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(oL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(eR.legendItemHover,(t=>{const e=E(t,"detail");this.event.emit(oL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(eR.legendItemUnHover,(t=>{const e=E(t,"detail");this.event.emit(oL.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:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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 c(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}=sF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=sF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}tK.specKey="legends",tK.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},tK.type=n.discreteLegend;const eK=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},iK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?qI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const sK={color:pR,size:fR},nK={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}},rK=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({},nK),{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"}}}})},aK={horizontal:rK(!0),vertical:rK(!1)},oK=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({},nK),{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"}}}})},lK={horizontal:oK(!0),vertical:oK(!1)},hK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],cK=[2,10];class dK extends Q${static getSpecInfo(t){const e=nF(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?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),tO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:wL.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(){gL(this._option.dataSet,"continuousLegendFilter",iK),gL(this._option.dataSet,"continuousLegendDataMake",eK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>eO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=VI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=VI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),P(a)&&(a="color"===this._legendType?hK:cK);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(e){const i=WO({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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=q$(s):T.title={visible:!1},T.showHandler=!1!==n.visible,P(n.style)||(T.handlerStyle=tL(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),P(r.style)||(T.railStyle=tL(r.style)),P(a.style)||(T.trackStyle=tL(a.style)),T.startText=ZI(o),T.endText=ZI(l),T.handlerText=ZI(h),P(c)||(T.sizeBackground=tL(c)),d.visible&&!P(d.style)&&(WO(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return sK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",yt((e=>{const i=E(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(oL.legendFilter,{model:this,value:i,event:e})}),30))}}}dK.specKey="legends",dK.builtInTheme={colorLegend:aK,sizeLegend:lK},dK.type=n.continuousLegend;const uK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,pK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),gK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function fK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(u(a.regionId)?[a.regionId]:void 0,u(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=mK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",p=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=>pK(i,s)(t)&&pK(n,r)(t)&&(d(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:p.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:p.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:[]}}))}];u(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:lL.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return ZD.globalConfig.uniqueTooltip&&ZD.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:lL.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return ZD.globalConfig.uniqueTooltip&&ZD.hideTooltip(l.id),c}return"none"}const mK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=uK(c,t);let _=uK(p,t);const y=gK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(pK(c,v));if(!y&&(_=uK(p,i),!gK(_)))return;const n=e.type===aO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=JC(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])=>d(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));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=uK(p,o),!gK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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&&(_=uK(p,r),!gK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===aO.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]===f));m.forEach((n=>{if(_=uK(p,i),!gK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},vK=t=>u(t)&&!_(t),_K=t=>u(t)&&_(t);class yK extends Jz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=WO({},this._theme,r.style),r.offset=WO({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(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:Wy(this._option.mode)||!Vy(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,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=__.getElementById(t.parentElement)):Vy(this._option.mode)&&(t.parentElement=null==Hy?void 0:Hy.body)}}const bK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class xK extends Qz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.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=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Vy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&vK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!d(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&&ZD.globalConfig.uniqueTooltip&&l&&ZD.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(oL.tooltipHide,Object.assign(Object.assign({},t),{source:lL.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=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:lL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(oL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(oL.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?kH.canvas:kH.dom,n=UO.getComponentPluginInType(t);n||Fy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=UO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Ny(s)||Wy(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))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(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=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,bt(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=fK(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(d(this._cacheInfo)||d(t))return!1;if(_K(t)){if(vK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>iz(t,e[i])))}if(_K(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}xK.type=n.tooltip,xK.transformerConstructor=yK,xK.builtInTheme={tooltip:bK},xK.specKey="tooltip";var SK,kK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(SK||(SK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kK||(kK={}));const AK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class MK extends Qz{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=GL.CrossHair_Grid,this.labelZIndex=GL.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),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=bt((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(p(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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{JC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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:hL.chart}:{source:lL.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Ny(t)||Wy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.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:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(oL.tooltipHide,{source:lL.chart},this._handleTooltipHideOrRelease),this.event.on(oL.tooltipShow,{source:lL.chart},this._handleTooltipShow),this.event.on(oL.tooltipRelease,{source:lL.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=E(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{AK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=E(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=E(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:E(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}MK.specKey="crosshair";const wK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class TK extends MK{static getSpecInfo(t){return nF(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=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=XF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){XF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:$F(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=iO(this._regions,"cartesian");e&&(gH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=vH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new sw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new nw(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}TK.specKey="crosshair",TK.builtInTheme={crosshair:wK},TK.type=n.cartesianCrosshair;class CK extends MK{static getSpecInfo(t){return nF(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=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=iO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Pz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=sF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:oe(d,a.getInnerRadius(),o),end:oe(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=he(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=oe(t,o,r),d=oe(t,o,h),m=fe([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=ft(se.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new sw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new aw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new ow(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new rw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ce(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}}(u):function(t){let e="center",i="middle";return e=(t=ce(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?oe(e,p[1]+m.offset,u):oe(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}CK.specKey="crosshair",CK.builtInTheme={crosshair:wK},CK.type=n.polarCrosshair;const BK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},PK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},EK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let u=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&(u=!0,r.domain.forEach((t=>{d(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),d(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=u?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class RK extends Qz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 tO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),tO(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=ft(this._start+f,0,1),_=ft(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ht(s/n)>=.5:Ht(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=qF(t),this._isHorizontal="horizontal"===ZF(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(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!qC(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(qC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(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?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];let s;if(this._relatedAxisComponent){const n={};tO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?G(u.xField):G(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?G(u.yField):G(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,qC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;qC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else tO(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:n}=this._option;fL(n,"dataview",xa),gL(n,"dataFilterComputeDomain",EK);const r=new Ma(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new bD(this._option,r),r.reRunAllTransform(),n.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(qC(e.type))return this._isReverse()?i[0]+(Y(i)-i[0])*(1-t):i[0]+(Y(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(Y(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&&qC(e.type)&&(s=s.slice().reverse()),(i-s[0])/(Y(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&u(this._spec.start)||"value"===e&&u(this._spec.startValue):"percent"===e&&u(this._spec.end)||"value"===e&&u(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,qC(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(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=qC(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new yB,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||(gL(this._option.dataSet,"dataFilterWithNewDomain",PK),gL(this._option.dataSet,"lockStatisticsFilter",BK),tO(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:()=>qC(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:()=>qC(this._stateScale.type)},level:wL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}_parseDomainFromState(t,e){if(qC(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,o;const l={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=bt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}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]:XL.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=this._getAxisBandSize(h);if(!this._dataUpdating&&JC(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,JC(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}clear(){this._throttledHide=null}}U(RK,PV);class OK extends Jz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=WO({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const IK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),LK={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:IK(!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:IK(!0)};class DK extends RK{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=OK,this.specKey="dataZoom",this.layoutZIndex=GL.DataZoom,this.layoutLevel=YL.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,c;super.setAttrFromSpec(),h(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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new HB;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?[$(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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(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(!qC(t.type)||e[0]!==Y(e))&&(!JC(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(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:u(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 iE(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);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(oL.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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:tL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:tL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:tL(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:tL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:tL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:tL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:tL(g.style)},selectedBackgroundStyle:tL(this._spec.selectedBackground.style),dragMaskStyle:tL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:WO(tL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},tL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:WO(tL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},tL(null===(d=m.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}=sF(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()}}DK.type=n.dataZoom,DK.transformerConstructor=OK,DK.builtInTheme={dataZoom:LK},DK.specKey="dataZoom";const FK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class zK extends RK{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=GL.DataZoom,this.layoutLevel=YL.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),h(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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return x(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:u(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 lM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=GR(this._start,t)&&GR(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this.statePointToData(t),n=this.statePointToData(e);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this.statePointToData(t),this.statePointToData(e)))&&this.event.emit(oL.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()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=tL(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=tL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}zK.type=n.scrollBar,zK.builtInTheme={scrollBar:FK},zK.specKey="scrollBar";const jK=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},HK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),VK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:HK("l1FontSize","primaryFontColor")},content:{visible:!0,style:HK("l2FontSize","tertiaryFontColor")}};class NK extends Qz{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=GL.Indicator,this.layoutLevel=YL.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return nF(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=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(iL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(iL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){gL(this._option.dataSet,"indicatorFilter",jK);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 bD(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 e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=WO({},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({},QI(j(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?RO(l,this._computeLayoutRadius()):0,dy:h?RO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(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({},QI(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_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)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new _R(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]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}NK.type=n.indicator,NK.builtInTheme={indicator:VK},NK.specKey="indicator";const WK=["sum","average","min","max","variance","standardDeviation","median"];function UK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function GK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&UK(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=MO(t.x)?KK(t.x,n)+r.x:qK(l.getXAxisHelper(),[t.x])+r.x,h}function YK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&UK(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=MO(t.y)?KK(t.y,n)+r.y:qK(l.getYAxisHelper(),[t.y])+r.y,h}function XK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&UK(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)),qK(a.angleAxisHelper,[t.angle])}function $K(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&UK(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)),qK(a.radiusAxisHelper,[t.radius])}function KK(t,e){return Number(t.substring(0,t.length-1))*e/100}function qK(t,e){const i=t.getScale(0);return qC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function ZK(t){return WK.includes(t)}function JK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=GK(t,_,n,p,c,o),r=YK(t,y,n,p,d,o),QK(s,b,S,g.length),QK(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=GK(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);QK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=YK(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);QK(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function QK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=XK(t,l,n,r),i=$K(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=XK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=$K(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function eq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=MO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=MO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&UK(_,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===S.length&&x(S[0])&&UK(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:qK(d.getXAxisHelper(),b)+p.x+m,y:qK(d.getYAxisHelper(),S)+p.y+v})})),n}function iq(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&UK(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&&x(u[0])&&UK(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:qK(l.angleAxisHelper,d),radius:qK(l.radiusAxisHelper,u)})})),s}function sq(t,e,i){let{x:s,y:n}=t;return MO(s)&&(s=KK(s,e)),MO(n)&&(n=KK(n,i)),{x:s,y:n}}function nq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(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}=sq(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=>sq(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 aq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},tL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},lq(tL(n.style),i,s)),u(n.padding)&&(t.padding=si(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=lq(tL(r),i,s)),t}return{visible:!1}}function oq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function lq(t,e,i){return c(t)?t(e,i):t}function hq(t,e){return c(t)?t(e):t}function cq(t,e,i){return u(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 dq(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=dq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function pq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=dq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function gq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function fq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(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;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&ZK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&ZK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&ZK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&ZK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>vq(i,e,t))):i.x=vq(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>vq(i,e,t))):i.y=vq(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>vq(i,e,t))):i.angle=vq(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>vq(i,e,t))):i.radius=vq(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=vq(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const mq={min:(t,e)=>YR(t[0].latestData,e.field),max:(t,e)=>XR(t[0].latestData,e.field),sum:function(t,e){return $R(t[0].latestData,e.field)},average:function(t,e){return KR(t[0].latestData,e.field)},variance:function(t,e){return qR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(qR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return lt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function vq(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return mq[i](e,{field:s})}return t}function _q(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 yq extends Qz{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 nF(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 v(e)&&ZK(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=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Aa;return e.registerParser("array",i),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(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=iO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=TO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=TO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();gL(this._option.dataSet,"markerAggregation",fq),gL(this._option.dataSet,"markerFilter",_q);const i=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function bq(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=YR(t,e),r=XR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class xq extends yq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=GL.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=uq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:lq(tL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>aq(t,this._markerData,this._markAttributeContext))),state:{line:oq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:oq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:oq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return oq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return oq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:lq(tL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:lq(tL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=rq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=uq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;gL(this._option.dataSet,"markerAggregation",fq),gL(this._option.dataSet,"markerRegression",bq),gL(this._option.dataSet,"markerFilter",_q);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ma(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}xq.specKey="markLine";const Sq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),kq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},Aq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Sq(!1),endSymbol:Sq(!0),label:kq};class Mq extends xq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new VE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=uq(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=JK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=eq(i,r,d,e.coordinatesOffset):c&&(y=nq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(MO(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:p}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&u(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=G(n.label),_=G(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:p,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=uq(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&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Mq.type=n.markLine,Mq.coordinateType="cartesian",Mq.builtInTheme={markLine:Aq};class wq extends xq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=uq(this._spec);return e||i?new UE(t):new VE(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}=uq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||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:f}:{points:p.map((t=>oe(f,t.radius,t.angle)))}}else u&&(p=iq(i,r,a),g={points:p.map((t=>oe(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=uq(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}}}wq.type=n.polarMarkLine,wq.coordinateType="polar",wq.builtInTheme={polarMarkLine:Aq};class Tq extends Qz{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=GL.Title,this.layoutLevel=YL.Title,this._orient="top",this._orient=AO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return nF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=TO(this._spec.width,l.width,null,l.width),c=TO(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),p=Object.assign(Object.assign({},j(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 u(this._spec.width)&&(p.textStyle.width=Math.max(h,l.width),p.subtextStyle.width=p.textStyle.width),p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new mR(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}}Tq.type=n.title,Tq.specKey=n.title,Tq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class Cq extends yq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=GL.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=pq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:lq(tL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>aq(t,this._markerData,this._markAttributeContext))),state:{area:oq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>oq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return oq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=rq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=pq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Cq.specKey="markArea";const Bq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class Pq extends Cq{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new WE(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=pq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=JK(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=JK(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=eq(s,a,p,i.coordinatesOffset):d&&(f=nq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=pq(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}}}Pq.type=n.markArea,Pq.coordinateType="cartesian",Pq.builtInTheme={markArea:Bq};class Eq extends Cq{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=pq(this._spec);return i||e||s?new GE(t):new WE(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}=pq(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=iq(i,r,c),u={points:d.map((t=>oe(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=pq(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}}}Eq.type=n.polarMarkArea,Eq.coordinateType="polar",Eq.builtInTheme={polarMarkArea:Bq};const Rq=t=>tL(Object.assign({},t)),Oq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},tL(t.style))}),Iq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Rq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Rq(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:{},tL(Object.assign({},y)));var y;const b=Oq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Oq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Oq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Oq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Lq=t=>"left"===t||"right"===t,Dq=t=>"top"===t||"bottom"===t,Fq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class zq extends Qz{constructor(){super(...arguments),this.layoutZIndex=GL.Player,this.layoutLevel=YL.Player,this.specKey="player",this.type=n.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({},Iq(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({},Iq(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new RR(t):this._playerComponent=new LR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=Lq(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=Lq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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(oL.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(wR.end,(()=>{var t;this.event.emit(oL.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(wR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(wR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(wR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(oL.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),k(t.x)){const e=Lq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Dq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Lq(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Dq(this._orient)?this._maxSize():t.height}_computeDx(t){return Lq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Dq(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];this._option.globalInstance.updateFullData(e.data),this.event.emit(oL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}zq.builtInTheme={player:Fq},zq.specKey="player",zq.type=n.player;class jq extends Qz{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=GL.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=gO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==$L.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}jq.type=n.label;class Hq extends RN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}Hq.type="text",Hq.constructorType="label";const Vq=()=>{ON(),UO.registerMark(Hq.constructorType,Hq)};class Nq extends Jz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Wq extends jq{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=Nq,this.layoutZIndex=GL.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(oL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(rL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(rL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),tO(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{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),c(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",XL.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=WO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},JV(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[EI])):t=>t.filter((t=>t.data[PI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?QV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}Wq.type=n.label,Wq.specKey="label",Wq.transformerConstructor=Nq;class Uq extends jq{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=GL.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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[CI]},"normal",XL.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return WO({textStyle:{pickable:!0===this._spec.interactive},position:Gq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[EI]:t.data[PI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>QV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Gq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Uq.type=n.totalLabel,Uq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Uq.specKey="totalLabel";class Yq extends yq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=GL.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=gq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R;const{itemContent:O={},itemLine:I={},targetSymbol:L={}}=this._spec,D=O,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:X,customMarkStyle:$,style:K={},state:q={}}=D,Z=t(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(e=null==j?void 0:j.state)&&void 0!==e?e:q,tt={dx:0,dy:0},Q=aq(z(tt,null!==(i=null!=j?j:U)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=lq(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:X)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=tL(lq(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=lq(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=lq(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:$)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:hq(O.offsetX,this._relativeSeries.getRegion()),offsetY:hq(O.offsetX,this._relativeSeries.getRegion())},Z),{style:lq(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=L.offset)&&void 0!==y?y:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:lq(L.style,this._markerData,this._markAttributeContext)},state:{line:oq(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:oq(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:oq(null!==(T=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),itemContent:oq(J,this._markerData,this._markAttributeContext),textBackground:oq(null===(B=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:oq(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=t(I,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:tL(st.style)}):{visible:!1};return new XE(et)}_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:cq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:cq(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}=gq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Yq.specKey="markPoint";const Xq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class $q extends Yq{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=JK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=eq(n,r,h,s.coordinatesOffset)[0]:l&&(c=nq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=gq(t),i=u(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}}}$q.type=n.markPoint,$q.coordinateType="cartesian",$q.builtInTheme={markPoint:Xq};class Kq extends Yq{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.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:oe({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}])]}}}Kq.type=n.polarMarkPoint,Kq.coordinateType="polar",Kq.builtInTheme={polarMarkPoint:Xq};class qq extends Yq{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}qq.type=n.geoMarkPoint,qq.coordinateType="geo",qq.builtInTheme={geoMarkPoint:Xq};const Zq="inBrush",Jq="outOfBrush";class Qq extends Qz{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=GL.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return nF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),Zq,XL.Series),i.setMarkStyle(s,Object.assign({},e),Jq,XL.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new jR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:tL(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),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(OR.brushActive,(i=>{this._initMarkBrushState(e,Jq),this._emitEvent(oL.brushActive,t)})),r.addEventListener(OR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(oL.brushStart,t)})),r.addEventListener(OR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(oL.brushStart,t)})),r.addEventListener(OR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(oL.brushChange,t)})),r.addEventListener(OR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(oL.brushChange,t)})),r.addEventListener(OR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(oL.brushClear,t)})),r.addEventListener(OR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(oL.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(oL.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(oL.brushEnd,t)}})),r.addEventListener(OR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(oL.brushEnd,t)}))}_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]}}_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({},tL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Zq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Zq),i.addState(Jq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Zq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Zq),i.addState(Jq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ce(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Zq),s.removeState(Jq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Qq.type=n.brush,Qq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Qq.specKey="brush";class tZ extends Qz{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=GL.CustomMark,this.layoutLevel=YL.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${pI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IF({},LF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(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 N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ze).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ze;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}tZ.type=n.customMark,tZ.specKey="customMark";class eZ{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||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>iZ(t))),a=n.filter((t=>!iZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>iZ(t))),h=o.filter((t=>!iZ(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function iZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}eZ.type="grid";const sZ="vchart-tooltip",nZ=`${sZ}-container`,rZ=`${sZ}-title`,aZ=`${sZ}-content-box`,oZ={offsetX:10,offsetY:10},lZ="99999999999999";function hZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const cZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,dZ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?hZ(t):"",uZ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},pZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},gZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=pZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class fZ extends Tz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=hF(null==w?void 0:w.position,b,e),C=null!==(r=hF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.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:gI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:fI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Vy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!E){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=cZ(e,F),V=cZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(gZ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=uZ(t,_),U.top=uZ(i,_),U.right=uZ(e,_),U.bottom=uZ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=uZ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?O:I,n="x"===t?A:M,r=gZ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",vZ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=mZ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=mZ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},_Z=(t={})=>{const{lineHeight:e}=t;return t.fontSize?TO(e,t.fontSize):0},yZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=si(r),a.padding=mZ(o)),{panelStyle:a,panelPadding:o}};function bZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const xZ=t=>{UO.registerComponentPlugin(t.type,t)};class SZ extends fZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(SZ.type),this.type=kH.dom,this._tooltipContainer=null==Hy?void 0:Hy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Hy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=yZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:mZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=vZ(h),x=vZ(u),S=vZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=mZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=mZ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=mZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(_Z(p),_Z(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(rZ))),l=a.find((t=>t.className.includes(aZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(rZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(bZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${sZ}-column`),e.classList.add(`${sZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(aZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];bZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));bZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${sZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=dZ(e.key),e.keyStyle&&vZ(e.keyStyle,l)):"value"===i?(o.innerHTML=dZ(e.value),e.valueStyle&&vZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?hZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?hZ(c):m,y=g,b=t=>new xg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ze));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=hh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?hZ(u):"currentColor",`\n \n \n \n `;const T=w?hh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),bZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(aZ))),h=[...o.children].find((t=>t.className.includes(rZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(rZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=TO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,bZ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{xZ(SZ)},AZ={fontFamily:DO.fontFamily,spacing:10,wordBreak:"break-word"},MZ=(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},lf||(lf=af.CreateGraphic("richtext",{})),lf.setAttributes(a),lf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function wZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:AZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const TZ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class CZ extends fZ{constructor(){super(CZ.type),this.type=kH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new UR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=si(d.padding),b=PO(d.padding),x=wZ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=wZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=wZ(m,i),A={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},M={panel:TZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!T.length;let R=0,O=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=WO({},S,wZ(b,void 0,{})),{width:s,height:n,text:r}=MZ(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(u(m)){const t=WO({},k,wZ(x,void 0,{})),{width:e,height:s,text:n}=MZ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=WO({},x,wZ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=MZ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(E?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=P||D:C+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}CZ.type=kH.canvas;const BZ=()=>{xZ(CZ)},PZ=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(aO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=UO.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=UO.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},EZ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=PZ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):jO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=WO({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:WO(f,m),hasChanged:!0};const i=WO({},t,m);HO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},RZ=t=>{UO.registerChartPlugin(t.type,t)};class OZ extends Tz{constructor(){super(OZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[OZ.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[OZ.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=NO(this._option.globalInstance.getSpec(),["data",OZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=NO(this._baseChartSpec,["data",OZ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=EZ(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=NO(i,["data",OZ.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()}}OZ.pluginType="chart",OZ.specKey="media",OZ.type="MediaQueryPlugin";const IZ=()=>{RZ(OZ)},LZ=/\{([^}]+)\}/,DZ=/\{([^}]+)\}/g,FZ=/:/;class zZ extends Tz{constructor(){super(zZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:pi.getInstance().timeUTCFormat,local:pi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=xi.getInstance().format,this._numericSpecifier=xi.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[zZ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),UO.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=LZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(DZ,((t,i)=>{if(!FZ.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(_i.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}}zZ.pluginType="chart",zZ.specKey="formatter",zZ.type="formatterPlugin";const jZ=()=>{RZ(zZ)};ZD.useRegisters([()=>{_T(),lT.registerBuiltInAnimate("scaleIn",xC),lT.registerBuiltInAnimate("scaleOut",SC),lT.registerBuiltInAnimate("fadeIn",XT),lT.registerBuiltInAnimate("fadeOut",$T),lT.registerBuiltInAnimate("moveIn",wC),lT.registerBuiltInAnimate("moveOut",TC),lT.registerBuiltInAnimate("rotateIn",BC),lT.registerBuiltInAnimate("rotateOut",PC),lT.registerBuiltInAnimate("update",AC),lT.registerBuiltInAnimate("state",kC),lT.registerBuiltInAnimate("fromTo",EC)},()=>{CH(),PH(),RH(),rH(),nH(),Wj(),Ij(),mz(),_z(),HD(),FD(),Tj(),kj(),UO.registerSeries(Uj.type,Uj),UO.registerChart(OH.type,OH)},()=>{CH(),PH(),RH(),nH(),Wj(),Ij(),mz(),DH(),_z(),jH(),Tj(),kj(),UO.registerSeries(VH.type,VH),rH(),UO.registerChart(WH.type,WH)},()=>{CH(),PH(),RH(),nH(),sV(),rH(),UO.registerChart(rV.type,rV)},()=>{CH(),PH(),rH(),nH(),fV(),UO.registerChart(vV.type,vV)},()=>{PH(),pW(),UO.registerChart(o$.type,o$)},()=>{CH(),PH(),rH(),nH(),RW(),UO.registerChart(c$.type,c$)},()=>{CH(),PH(),RH(),rH(),nH(),VW(),UO.registerChart(u$.type,u$)},()=>{CH(),PH(),RH(),rH(),nH(),sV(),UO.registerChart(_$.type,_$)},()=>{PH(),OV(),kV(),UO.registerSeries(LV.type,LV),UO.registerImplement("registerMap",yL),UO.registerImplement("unregisterMap",bL),zD(),UO.registerChart(e$.type,e$)},()=>{PH(),yX(),UO.registerSeries(xX.type,xX),oW(),iU(),CW(),rU(),UO.registerChart(S$.type,S$)},()=>{PH(),YG(),UO.registerChart(M$.type,M$)},()=>{PH(),uY(),UO.registerChart(T$.type,T$)},()=>{CH(),PH(),RH(),rH(),nH(),cN(),UO.registerChart(j$.type,j$)},()=>{CH(),PH(),rH(),nH(),EN(),UO.registerChart(V$.type,V$)},()=>{CH(),PH(),rH(),nH(),rU(),UO.registerChart(b$.type,b$)},()=>{CH(),PH(),rH(),nH(),pU(),UO.registerChart(B$.type,B$)},()=>{CH(),PH(),rH(),nH(),NN(),UO.registerChart(E$.type,E$)},()=>{CH(),PH(),RH(),rH(),nH(),DH(),Tj(),kj(),UO.registerSeries(XN.type,XN),UO.registerChart(G$.type,G$)},()=>{PH(),PY(),UO.registerChart(O$.type,O$)},()=>{PH(),DY(),UO.registerChart(L$.type,L$)},()=>{PH(),hX(),UO.registerChart(F$.type,F$)},()=>{PH(),Ch.load(uM),eX(),UO.registerChart(W$.type,W$)},()=>{PH(),CX(),UO.registerChart(X$.type,X$)},()=>{PH(),VX(),UO.registerChart(K$.type,K$)},()=>{CH(),PH(),RH(),rH(),UO.registerChart(g$.type,g$),nH()},kj,Tj,()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),aj(),UO.registerComponent(Cj.type,Cj)},()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),aj(),UO.registerComponent(Bj.type,Bj)},()=>{UO.registerGraphicComponent(tj.lineAxis,((t,e)=>new FC(t,e))),UO.registerGraphicComponent(ej.lineAxisGrid,((t,e)=>new XP(t,e))),aj(),UO.registerComponent(Pj.type,Pj)},PW,CW,()=>{UO.registerComponent(tK.type,tK)},()=>{UO.registerComponent(dK.type,dK)},()=>{UO.registerComponent(xK.type,xK)},()=>{UO.registerComponent(TK.type,TK)},()=>{UO.registerComponent(CK.type,CK)},()=>{UO.registerComponent(DK.type,DK)},()=>{UO.registerComponent(zK.type,zK)},()=>{UO.registerComponent(NK.type,NK)},OV,()=>{UO.registerComponent(Mq.type,Mq),HE()},()=>{UO.registerComponent(Pq.type,Pq),NE()},()=>{UO.registerComponent($q.type,$q),YE()},()=>{UO.registerComponent(wq.type,wq),UE._animate=xE,HE()},()=>{UO.registerComponent(Eq.type,Eq),GE._animate=kE,NE()},()=>{UO.registerComponent(Kq.type,Kq),YE()},()=>{UO.registerComponent(qq.type,qq),YE()},()=>{UO.registerComponent(Tq.type,Tq)},()=>{UO.registerComponent(zq.type,zq)},()=>{UO.registerGraphicComponent(Wq.type,(t=>new WP(t))),Vq(),sj(),UO.registerComponent(Wq.type,Wq,!0,1/0)},()=>{UO.registerGraphicComponent(Uq.type,(t=>new WP(t))),Vq(),sj(),UO.registerComponent(Uq.type,Uq,!0)},()=>{UO.registerComponent(Qq.type,Qq)},()=>{UO.registerComponent(tZ.type,tZ)},()=>{Ch.load(ew)},()=>{UO.registerLayout(eZ.type,eZ)},BZ,YD,KD]),ZD.useRegisters([()=>{ik(Ch)}]);export{XL as AttributeLevel,Cz as AxisSyncPlugin,CZ as CanvasTooltipHandler,oL as ChartEvent,fI as DEFAULT_CHART_HEIGHT,gI as DEFAULT_CHART_WIDTH,tF as DEFAULT_CLOSE_STROKE_JOIN,vI as DEFAULT_DATA_INDEX,_I as DEFAULT_DATA_KEY,yI as DEFAULT_DATA_SERIES_FIELD,zI as DEFAULT_KEY,WL as DEFAULT_LAYOUT_RECT_LEVEL,UL as DEFAULT_LAYOUT_RECT_LEVEL_MIN,QD as DEFAULT_LINEAR_INTERPOLATE,mI as DEFAULT_MEASURE_CANVAS_ID,bI as DEFAULT_SERIES_STYLE_NAME,JD as DEFAULT_SMOOTH_INTERPOLATE,nT as DefaultTicker,eF as Direction,SZ as DomTooltipHandler,UO as Factory,zZ as FormatterPlugin,YL as LayoutLevel,GL as LayoutZIndex,LI as MOSAIC_CAT_END_PERCENT,II as MOSAIC_CAT_START_PERCENT,OI as MOSAIC_VALUE_END_PERCENT,RI as MOSAIC_VALUE_START_PERCENT,aT as ManualTicker,OZ as MediaQuery,pI as PREFIX,s as RenderModeEnum,FI as SEGMENT_FIELD_END,DI as SEGMENT_FIELD_START,kI as STACK_FIELD_END,TI as STACK_FIELD_END_OffsetSilhouette,MI as STACK_FIELD_END_PERCENT,xI as STACK_FIELD_KEY,SI as STACK_FIELD_START,wI as STACK_FIELD_START_OffsetSilhouette,AI as STACK_FIELD_START_PERCENT,CI as STACK_FIELD_TOTAL,EI as STACK_FIELD_TOTAL_BOTTOM,BI as STACK_FIELD_TOTAL_PERCENT,PI as STACK_FIELD_TOTAL_TOP,KL as STATE_VALUE_ENUM,RC as StreamLight,aI as ThemeManager,wL as TransformLevel,NL as USER_LAYOUT_RECT_LEVEL,ZD as VChart,BO as boundsInRect,KO as builtinThemes,TO as calcLayoutNumber,CO as calcPadding,uO as computeActualDataScheme,EO as convertPoint,Qg as createArc,qg as createArea,wp as createGroup,Mg as createLine,Bg as createRect,Ug as createRichText,Sg as createSymbol,yg as createText,zO as darkTheme,OO as dataScheme,ZD as default,qO as defaultThemeName,gO as getActualColor,RO as getActualNumValue,_O as getColorSchemeBySeries,dO as getDataScheme,XO as getFunnelTheme,nI as getMergedTheme,nF as getSpecInfo,eI as getTheme,QO as hasThemeMerged,fO as isColorKey,MO as isPercent,wO as isPercentOffset,mO as isProgressiveDataColorScheme,LO as isTokenKey,AO as isValidOrient,FO as lightTheme,rF as lookup,uI as measureText,PO as normalizeLayoutPaddingSpec,pO as queryColorFromColorScheme,IO as queryToken,BZ as registerCanvasTooltipHandler,RZ as registerChartPlugin,fL as registerDataSetInstanceParser,gL as registerDataSetInstanceTransform,kZ as registerDomTooltipHandler,jZ as registerFormatPlugin,IZ as registerMediaQuery,tI as registerTheme,iI as removeTheme,sI as themeExist,ZO as themes,DO as token,vO as transformColorSchemeToStandardStruct,tL as transformToGraphic,aF as version,__ as vglobal,Dy as warn}; +let IG=class t extends SG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),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 B=[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]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:B,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),q(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(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?PG(t,o,l.width,l.height,h):"geometric"===t.type&&OG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=_G(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()}};IG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class LG extends SG{constructor(t){super(z({},LG.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)}LG.defaultOptions={enlarge:!1};const FG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},zG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return nt.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?jG(t.fontFamily):"sans-serif",d=t.fontStyle?jG(t.fontStyle):"normal",u=t.fontWeight?jG(t.fontWeight):"normal",p=t.rotate?jG(t.rotate):0,g=jG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?jG(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},FG),t.as):FG,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?jG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=VG(NG(t,l),C);T=i=>e(t(i))}let B=AG;"fast"===t.layoutType?B=LG:"grid"===t.layoutType&&(B=IG);const P=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},jG=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],HG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),VG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=HG(t[0]),n=HG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(HG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},NG=(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 WG(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{WO.registerGrammarTransform("wordcloud",{transform:zG}),RN(),WO.registerAnimation("wordCloud",((t,e)=>({appear:SU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),WO.registerSeries(UG.type,UG)},YG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},XG=(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},$G=`${uI}_FUNNEL_TRANSFORM_RATIO`,KG=`${uI}_FUNNEL_REACH_RATIO`,qG=`${uI}_FUNNEL_HEIGHT_RATIO`,ZG=`${uI}_FUNNEL_VALUE_RATIO`,JG=`${uI}_FUNNEL_LAST_VALUE_RATIO`,QG=`${uI}_FUNNEL_NEXT_VALUE_RATIO`,tY=`${uI}_FUNNEL_LAST_VALUE`,eY=`${uI}_FUNNEL_CURRENT_VALUE`,iY=`${uI}_FUNNEL_NEXT_VALUE`,sY=`${uI}_FUNNEL_TRANSFORM_LEVEL`;class nY extends pF{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[KG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class rY extends AD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class aY extends rY{constructor(){super(...arguments),this.type=aY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}aY.type="polygon";const oY=()=>{WO.registerMark(aY.type,aY),YA(),HA(),oT.registerBuiltInAnimate("growPointsOut",aC),WO.registerGraphicComponent("polygon",nf)},lY=Object.assign(Object.assign({},MF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class hY extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class cY extends NF{constructor(){super(...arguments),this.type=rO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=hY,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;pL(this._dataSet,"funnel",YG),pL(this._dataSet,"funnelTransform",XG);const t=new Ma(this._dataSet,{name:`${uI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new yD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:eY,asTransformRatio:$G,asReachRatio:KG,asHeightRatio:qG,asValueRatio:ZG,asNextValueRatio:QG,asLastValueRatio:JG,asLastValue:tY,asNextValue:iY,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:sY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},cY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:FF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},cY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(cY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(cY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new nY(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",YL.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",YL.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{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",YL.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",YL.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",YL.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===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",YL.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Oy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Oy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*iO(KG).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",YL.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(OF(null===(s=WO.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),IF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(OF(WO.getAnimationInKey("fadeInOut")(),IF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(OF(WO.getAnimationInKey("funnel")({},o),IF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(OF(null===(a=WO.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),IF("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[JG])/2:this._getSecondaryAxisLength(t[ZG])/2,n=this._getSecondaryAxisLength(t[ZG])/2):(s=this._getSecondaryAxisLength(t[ZG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[QG])/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[sY])}_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 u(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[vI]===t[vI]));if(!u(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(x(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{oY(),RN(),UV(),WO.registerSeries(cY.type,cY),WO.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},LD))),WO.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:HT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:HT,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),FD()},uY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},pY=t=>{const e=t.filter((t=>t.context.diffState===XL.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},gY=(t,e,i)=>{if(P(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},fY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pY(i.parent.children),a=gY(r,s,n);return uY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pY(i.parent.children),a=gY(r,s,n);return uY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),mY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},vY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pY(i.parent.children),a=mY(r);return uY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=pY(i.parent.children),a=mY(r);return uY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),_Y=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},yY=(t,e={})=>{if(!t)return[];const i=[];return wU(t,i,e),i},bY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new QU(i).layout(t,{width:s,height:n})};class xY extends pF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var SY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(SY||(SY={}));const kY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===SY.DrillDown){return G(XI(t,n,s,"children"))}if(i.type===SY.DrillUp){const e=$I(t,n,s,"children");if(e)return G(e)}return t};class AY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=TV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;pL(t,"drillFilter",kY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(d(t.datum)||d(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||P(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:SY.DrillDown},e().reRunAllTransform(),i.emit(aL.drill,{value:{path:t,type:SY.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(!_(n)||P(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:SY.DrillUp},i().reRunAllTransform(),s.emit(aL.drill,{value:{path:n,type:SY.DrillUp},model:this}),n}}const MY=Object.assign(Object.assign({},MF),{sunburst:{name:"sunburst",type:"arc"}}),wY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:_F,operations:["max","min","values"]}),t.push({key:yF,operations:["values"]}),t),TY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class CY extends XN{constructor(){super(...arguments),this.type=rO.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:yF),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:vI},getRawData:()=>this.getRawData()}),this._startAngle=ne(this._spec.startAngle),this._endAngle=ne(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),pL(this._dataSet,"sunburstLayout",bY),pL(this._dataSet,"flatten",yY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(pL(t.dataSet,"addVChartProperty",aF),t.transform({type:"addVChartProperty",options:{beforeCall:kF.bind(this),call:AF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(CY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$L.STATE_NORMAL,YL.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(CY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},$L.STATE_NORMAL,YL.Series)}initTooltip(){this._tooltipHelper=new xY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(OF(null===(e=WO.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),IF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),IF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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}}CY.type=rO.sunburst,CY.mark=MY,CY.builtInTheme={sunburst:TY},U(CY,AY);const BY=()=>{WO.registerSeries(CY.type,CY),aW(),RN(),FD(),WO.registerAnimation("sunburst",((t,e)=>({appear:_Y(0,e),enter:fY(t),exit:vY(t),disappear:vY(t)})))},PY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new NU(i).layout(t,{width:s,height:n})};class EY extends pF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OY=Object.assign(Object.assign({},MF),{circlePacking:{name:"circlePacking",type:"arc"}});class IY extends GF{constructor(){super(...arguments),this.type=rO.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:yF),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:vI},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),pL(this._dataSet,"circlePackingLayout",PY),pL(this._dataSet,"flatten",yY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(pL(t.dataSet,"addVChartProperty",aF),t.transform({type:"addVChartProperty",options:{beforeCall:kF.bind(this),call:AF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$L.STATE_NORMAL,YL.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(IY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$L.STATE_NORMAL,YL.Series)}getStatisticFields(){return wY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new EY(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(OF(null===(i=WO.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),IF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),IF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IY.type=rO.circlePacking,IY.mark=OY,IY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},U(IY,AY);const LY=()=>{WO.registerSeries(IY.type,IY),aW(),RN(),DD(),WO.registerAnimation("circlePacking",((t,e)=>({appear:RY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},DY=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&DY(t,e.children,i)}))},FY=t=>{var e;if(!t||!_(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},zY=(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 qU(e),r=[];return r.push(n.layout(s,i)),r},jY=t=>{var e,i;return t&&_(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:[]},HY=t=>{var e,i;return t&&_(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 VY extends pF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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 NY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:NY(t),UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class GY extends _T{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class YY extends _T{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const XY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},$Y=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class KY extends gN{constructor(){super(...arguments),this.type=KY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?$Y:XY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}KY.type="linkPath";const qY=Object.assign(Object.assign({},MF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class ZY extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const JY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class QY extends GF{constructor(){super(...arguments),this.type=rO.sankey,this.transformerConstructor=ZY,this._nodeLayoutZIndex=UL.Node,this._labelLayoutZIndex=UL.Label,this._viewBox=new ze,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(u(a))return a;if(u(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=eL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=eL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):(t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=eL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),JY(e,$L.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($L.STATE_SANKEY_EMPHASIS),e.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=eL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=eL(n[0]))||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=eL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=eL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($L.STATE_SANKEY_EMPHASIS,!0)):(t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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=eL(s),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($L.STATE_SANKEY_EMPHASIS_REVERSE),void JY(s,$L.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($L.STATE_SANKEY_EMPHASIS_REVERSE),void JY(s,$L.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($L.STATE_SANKEY_EMPHASIS),s.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(eL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState($L.STATE_SANKEY_EMPHASIS),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=eL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=eL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void JY(t,$L.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void JY(t,$L.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState($L.STATE_SANKEY_EMPHASIS_REVERSE),void JY(t,$L.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState($L.STATE_SANKEY_EMPHASIS),t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,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){pL(this._dataSet,"sankeyLayout",zY),pL(this._dataSet,"sankeyFormat",FY),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:ML.sankeyLayout});const{dataSet:a}=this._option;pL(a,"sankeyNodes",jY),pL(a,"flatten",yY);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:xF.bind(this),call:SF}},!1),this._nodesSeriesData=o,pL(a,"sankeyLinks",HY);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:xF.bind(this),call:SF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(QY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(QY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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},$L.STATE_NORMAL,YL.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",YL.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},$L.STATE_NORMAL,YL.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",YL.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=iF(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(OF(null===(i=WO.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),IF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),IF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:lL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$L.STATE_SANKEY_EMPHASIS_REVERSE,$L.STATE_SANKEY_EMPHASIS]),e.includes(eL(t).key)?t.addState($L.STATE_SANKEY_EMPHASIS,!0):t.addState($L.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new VY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new _O;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=>{u(t[i])&&e.add(t[i]),u(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 DY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}QY.type=rO.sankey,QY.transformerConstructor=ZY,QY.mark=qY,QY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const tX=()=>{qH(),fN(),zA(),WO.registerGraphicComponent("path",(t=>$g(t))),WO.registerMark(KY.type,KY),RN(),WO.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WY(t,e)},LD))),WO.registerAnimation("sankeyLinkPath",((t,e)=>({appear:UY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),oT.registerBuiltInAnimate("linkPathGrowOut",YY),oT.registerBuiltInAnimate("linkPathGrowIn",GY),FD(),WO.registerSeries(QY.type,QY)},eX=(t,e)=>{let i={},s=e.fields;if(c(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=yY(n);return i=fF([{latestData:r}],e),i};class iX extends pF{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 sX=Object.assign(Object.assign({},MF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),nX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class rX extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const aX=(t,e)=>{if(e.getViewBox()){const i=new sG(e).layout(t,e.getViewBox()),s=[];return wU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[yF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class oX extends GF{constructor(){super(...arguments),this.type=rO.treemap,this.transformerConstructor=rX,this._categoryField="name",this._valueField="value",this._viewBox=new ze,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:yF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ve),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:vI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),pL(this._dataSet,"treemap",aX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(pL(this._rawData.dataSet,"addVChartProperty",aF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:kF.bind(this),call:AF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=eX([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){pL(this._dataSet,"hierarchyDimensionStatistics",eX),pL(this._dataSet,"flatten",yY);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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(oX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(oX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$L.STATE_NORMAL,YL.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()},$L.STATE_NORMAL,YL.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.Series),this._initRichStyleOfLabelMark(t))}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},$L.STATE_NORMAL,YL.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("treemap"))||void 0===e?void 0:e(),IF(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 iX(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(nL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(nL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}oX.type=rO.treemap,oX.mark=sX,oX.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},oX.transformerConstructor=rX,U(oX,AY),U(oX,BV);const lX=()=>{WO.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),WO.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),qH(),RN(),WO.registerAnimation("treemap",((t,e)=>({appear:nX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),FD(),WO.registerSeries(oX.type,oX)},hX=Object.assign(Object.assign({},qW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),cX=Object.assign(Object.assign({},MF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),dX={type:"fadeIn"};function uX(t,e){return"fadeIn"===e?dX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class pX extends VF{constructor(){super(...arguments),this._supportStack=!1}}class gX extends pF{enableByType(t){return"dimension"!==t}}const fX="M1 0 C1 0.55228 0.55228 1 0 1 C-0.552285 1 -1 0.55228 -1 0 C-1 -0.552285 -0.552285 -1 0 -1 C0.55228 -1 1 -0.552285 1 0Z",mX={pointer:{type:"path",width:.4,height:.4,style:{path:"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:fX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:fX,fill:"#ddd"}}};class vX extends ZW{constructor(){super(...arguments),this.type=rO.gaugePointer,this.transformerConstructor=pX,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(vX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},vX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(vX.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 gX(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 u(this.radiusAxisHelper)&&u(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=$(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(OF(null===(i=WO.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),IF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}vX.type=rO.gaugePointer,vX.mark=cX,vX.builtInTheme={gaugePointer:mX},vX.transformerConstructor=pX;const _X=()=>{WO.registerSeries(vX.type,vX),SV(),qH(),WO.registerAnimation("gaugePointer",((t,e)=>{const i=uX(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),BW(),TW()};class yX extends VF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class bX extends ZW{constructor(){super(...arguments),this.type=rO.gauge,this.transformerConstructor=yX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ne(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();pL(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[DI]=t[this._angleField[0]],t[LI]=e>0?i[e-1][DI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(bX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(bX.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,YL.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?xO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=vt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?xO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[LI])?this.angleAxisHelper.dataToPosition([t[LI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[DI]])}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(OF(null===(i=WO.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),IF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}bX.type=rO.gauge,bX.mark=hX,bX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},bX.transformerConstructor=yX;class xX extends AD{constructor(){super(...arguments),this.type=xX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}xX.type="cell";function SX(t){return!1===t?{}:{type:"fadeIn"}}class kX extends pF{enableByType(t){return"dimension"!==t}}const AX=Object.assign(Object.assign({},MF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class MX extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class wX extends GF{constructor(){super(...arguments),this.type=rO.heatmap,this.transformerConstructor=MX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(wX.mark.cell,{isSeriesMark:!0},{morph:FF(this._spec,wX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(wX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",YL.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=si(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",YL.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=UF(this);this._cellMark.setAnimationConfig(OF(null===(i=WO.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),IF("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 kX(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]}}wX.type=rO.heatmap,wX.mark=AX,wX.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},wX.transformerConstructor=MX;const TX=()=>{RN(),WO.registerMark(xX.type,xX),WO.registerGraphicComponent("symbol",kg),YA(),$A(),RP(),WO.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},LD),{appear:SX(e)}))),wj(),Sj(),WO.registerSeries(wX.type,wX)},CX=Object.assign(Object.assign({},MF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),BX=`${uI}_CORRELATION_X`,PX=`${uI}_CORRELATION_Y`,EX=`${uI}_CORRELATION_SIZE`,RX=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=ne(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=ne(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Bt(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Bt(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Ct(e.field),C=t.map(T),[B,P]=Et(C),E=B===P?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(P-B),R=d(e.radiusField)?T:Ct(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Et(t.map(R)):[B,P],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=OX(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=E(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),IX({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,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},IX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[mI]:null==n?void 0:n[mI],[_I]:null==n?void 0:n[_I]}};class DX extends gN{constructor(){super(...arguments),this.type=DX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=ft(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}DX.type="ripple";const FX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class zX extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class jX extends XN{constructor(){super(...arguments),this.type=rO.correlation,this.transformerConstructor=zX,this._viewBox=new ze}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;pL(this._dataSet,"correlation",RX);const s=new Aa;gL(s,"dataview",xa),pL(s,"correlationCenter",LX);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 yD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const t=this._createMark(jX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:mI});t&&(t.setMarkConfig({zIndex:UL.Node}),this._nodePointMark=t);const e=this._createMark(jX.mark.ripplePoint,{key:mI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(jX.mark.centerPoint,{key:mI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:UL.Node}),this._centerPointMark=i)}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[BX],y:t=>t[PX],size:t=>t[EX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.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)},$L.STATE_NORMAL,YL.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),IF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}jX.type=rO.correlation,jX.mark=CX,jX.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},jX.transformerConstructor=zX;const HX=()=>{vz(),fN(),$A(),WO.registerMark(DX.type,DX),WO.registerGraphicComponent("symbol",(t=>kg(t))),WO.registerSeries(jX.type,jX),WO.registerAnimation("correlation",((t,e)=>Object.assign({appear:FX(0,e)},ID)))},VX=Object.assign(Object.assign({},MF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class NX extends gN{constructor(){super(...arguments),this.type=NX.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}NX.type="liquid";const WX=(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 UX extends pF{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 GX extends NF{constructor(){super(...arguments),this.type=rO.liquid,this.transformerConstructor=_z,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:WX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=BO(this._spec.outlineMargin),this._paddingSpec=BO(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=Wt(...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(GX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(GX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(GX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(GX.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",YL.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",YL.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",YL.Series)}initTooltip(){this._tooltipHelper=new UX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(OF(null===(i=WO.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),IF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(OF(null===(s=WO.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),IF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(aL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=_M(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}GX.type=rO.liquid,GX.mark=VX,GX.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},GX.transformerConstructor=_z;const YX=t=>G(t).join(",");class XX extends pF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>YX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>YX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const $X=Object.assign(Object.assign({},MF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class KX extends VF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const qX=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?fG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class ZX extends NF{constructor(){super(...arguments),this.type=rO.venn,this.transformerConstructor=KX,this._viewBox=new ze}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:vI)}initData(){var t;super.initData(),pL(this._dataSet,"venn",qX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(ZX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(ZX.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()},$L.STATE_NORMAL,YL.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},$L.STATE_NORMAL,YL.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$L.STATE_HOVER,YL.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>YX(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)}},$L.STATE_NORMAL,YL.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>YX(t.sets)},$L.STATE_NORMAL,YL.Series))}initTooltip(){this._tooltipHelper=new XX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:YX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return YX(i)}legendSelectedFilter(t,e){if(t.type===n.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[YX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(YX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),IF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(OF(null===(e=WO.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),IF(t.name,this._spec,this._markAttributeContext)))}))}}ZX.type=rO.venn,ZX.mark=$X,ZX.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},ZX.transformerConstructor=KX;class JX extends eV{constructor(){super(...arguments),this.type=rO.mosaic,this.transformerConstructor=tV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(RI),this.setFieldX2(EI)),this.setFieldY(II),this.setFieldY2(OI)):(t&&(this.setFieldY(RI),this.setFieldY2(EI)),this.setFieldX(II),this.setFieldX2(OI)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}JX.type=rO.mosaic,JX.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},JX.transformerConstructor=tV;class QX extends Kj{_isValidSeries(t){return t===rO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class t$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=QX,this.type="map",this.seriesType=rO.map}}t$.type="map",t$.seriesType=rO.map,t$.transformerConstructor=QX;class e$ extends Kj{_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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class i$ extends e${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=Pz(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,NO({},s,l)),n&&Object.assign(o,NO({},n,o))}}class s$ extends e${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class n$ extends e${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class r$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=n$}}r$.transformerConstructor=n$;class a$ extends r${constructor(){super(...arguments),this.transformerConstructor=n$,this.type="pie",this.seriesType=rO.pie}}a$.type="pie",a$.seriesType=rO.pie,a$.transformerConstructor=n$;class o$ extends s${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Yz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Yz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>NO({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const l$=(t,e)=>{if(!t)return null;const i=rz(t,(t=>"angle"===t.getOrient()),e),s=rz(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&&ZC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=qR({x:1,y:0},u);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=ZR(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=sz(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&&ZC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=qR({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=ZR(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=sz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class h$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=o$,this.type="rose",this.seriesType=rO.rose}_setModelOption(){this._modelOption.getDimensionInfo=l$}}h$.type="rose",h$.seriesType=rO.rose,h$.transformerConstructor=o$,U(h$,tH);class c$ extends s${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=NO({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=G(t.crosshair||{}).map((t=>NO({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class d$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=c$,this.type="radar",this.seriesType=rO.radar}_setModelOption(){this._modelOption.getDimensionInfo=l$}}d$.type="radar",d$.seriesType=rO.radar,d$.transformerConstructor=c$,U(d$,tH);class u$ extends Kj{_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=p(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=>{E(e,"trimPadding")&&NO(e,HL(this.type,t))})),this._transformAxisSpec(t)}}class p$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=u$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=cH(t,e,i))&&void 0!==s?s:[],...null!==(n=l$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}p$.type="common",p$.transformerConstructor=u$,U(p$,tH);class g$ extends qj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class f$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=g$}}f$.transformerConstructor=g$,U(f$,tH);class m$ extends g${transformSpec(t){super.transformSpec(t),FL(t)}}class v$ extends f${constructor(){super(...arguments),this.transformerConstructor=m$,this.type="histogram",this.seriesType=rO.bar}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}v$.type="histogram",v$.seriesType=rO.bar,v$.transformerConstructor=m$;class _$ extends i${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class y$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=_$,this.type="circularProgress",this.seriesType=rO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=l$}}y$.type="circularProgress",y$.seriesType=rO.circularProgress,y$.transformerConstructor=_$,U(y$,tH);class b$ extends i${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=rO.circularProgress,e}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===rO.gauge||t.type===rO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(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===rO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:UL.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)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=UL.Region+50)}}class x$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=b$,this.type="gauge",this.seriesType=rO.gaugePointer}}x$.type="gauge",x$.seriesType=rO.gaugePointer,x$.transformerConstructor=b$;class S$ extends Kj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class k$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=S$,this.type="wordCloud",this.seriesType=rO.wordCloud}}k$.transformerConstructor=S$;class A$ extends k${constructor(){super(...arguments),this.transformerConstructor=S$,this.type="wordCloud",this.seriesType=rO.wordCloud}}A$.type="wordCloud",A$.seriesType=rO.wordCloud,A$.transformerConstructor=S$;class M$ extends Kj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class w$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=M$,this.type="funnel",this.seriesType=rO.funnel}}w$.type="funnel",w$.seriesType=rO.funnel,w$.transformerConstructor=M$;class T$ extends qj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=Pz(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=Pz(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class C$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=T$,this.type="linearProgress",this.seriesType=rO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}C$.type="linearProgress",C$.seriesType=rO.linearProgress,C$.transformerConstructor=T$,U(C$,tH);class B$ extends qj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),FL(t)}}class P$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=B$,this.type="rangeColumn",this.seriesType=rO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}P$.type="rangeColumn",P$.seriesType=rO.rangeColumn,P$.transformerConstructor=B$;class E$ extends Kj{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+re(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class R$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=E$,this.type="sunburst",this.seriesType=rO.sunburst}}R$.type="sunburst",R$.seriesType=rO.sunburst,R$.transformerConstructor=E$;class O$ extends Kj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class I$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="circlePacking",this.seriesType=rO.circlePacking}}I$.type="circlePacking",I$.seriesType=rO.circlePacking,I$.transformerConstructor=O$;class L$ extends Kj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class D$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="treemap",this.seriesType=rO.treemap}}D$.type="treemap",D$.seriesType=rO.treemap,D$.transformerConstructor=L$;class F$ extends sV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),FL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class z$ extends nV{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="waterfall",this.seriesType=rO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}z$.type="waterfall",z$.seriesType=rO.waterfall,z$.transformerConstructor=F$;class j$ extends qj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),FL(t)}}class H$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=j$,this.type="boxPlot",this.seriesType=rO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}H$.type="boxPlot",H$.seriesType=rO.boxPlot,H$.transformerConstructor=j$;class V$ extends Kj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class N$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="sankey",this.seriesType=rO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=eL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}N$.type="sankey",N$.seriesType=rO.sankey,N$.transformerConstructor=V$;class W$ extends qj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),FL(t)}}class U$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="rangeArea",this.seriesType=rO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=cH,this._modelOption.getDimensionInfoByValue=uH,this._modelOption.getRectByDimensionData=_H}}U$.type="rangeArea",U$.seriesType=rO.rangeArea,U$.transformerConstructor=W$;class G$ extends qj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class Y$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="heatmap",this.seriesType=rO.heatmap}}Y$.type="heatmap",Y$.seriesType=rO.heatmap,Y$.transformerConstructor=G$;class X$ extends Kj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends Xj{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="correlation",this.seriesType=rO.correlation}}$$.type="correlation",$$.seriesType=rO.correlation,$$.transformerConstructor=X$;function K$(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=QI(t.style)),P(t.textStyle)||NO(s.textStyle,QI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&QI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&QI(s.background.style),s}const q$=(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},Z$=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:_I;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class J$ extends Jz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=UL.Legend,this.layoutLevel=GL.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),QR(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=kO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new yD(this._option,t),this._initSelectedData(),QR(this._regions,(t=>{t.event.on(aL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(QR(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(aL.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;k(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)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(NO({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(NO({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(NO({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(aL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}J$.specKey="legends";class Q$ extends J${constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return sF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),QR(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:ML.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){pL(this._option.dataSet,"discreteLegendFilter",Z$),pL(this._option.dataSet,"discreteLegendDataMake",q$);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return QR(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!Yy(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 c(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=HI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:p,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:_,padding:y}=e,b=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible?b.title=K$(s):b.title={visible:!1},P(n.focusIconStyle)||QI(n.focusIconStyle),n.shape&&(n.shape=qI(n.shape)),n.label&&(n.label=qI(n.label)),n.value&&(n.value=qI(n.value)),n.background&&(n.background=qI(n.background)),AO(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),AO(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),AO(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||QI(r.railStyle),P(r.sliderStyle)||QI(r.sliderStyle)):(P(r.textStyle)||QI(r.textStyle),r.handler&&qI(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(NO(b,a.style),u(a.padding)&&(b.padding=a.padding)),b}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return oR}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(tR.legendItemClick,(e=>{const i=E(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(aL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(tR.legendItemHover,(t=>{const e=E(t,"detail");this.event.emit(aL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(tR.legendItemUnHover,(t=>{const e=E(t,"detail");this.event.emit(aL.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:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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 c(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}=iF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=iF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}Q$.specKey="legends",Q$.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},Q$.type=n.discreteLegend;const tK=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},eK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?KI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const iK={color:uR,size:gR},sK={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}},nK=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({},sK),{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"}}}})},rK={horizontal:nK(!0),vertical:nK(!1)},aK=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({},sK),{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"}}}})},oK={horizontal:aK(!0),vertical:aK(!1)},lK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],hK=[2,10];class cK extends J${static getSpecInfo(t){const e=sF(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?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),QR(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:ML.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(){pL(this._option.dataSet,"continuousLegendFilter",eK),pL(this._option.dataSet,"continuousLegendDataMake",tK);const t=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>tO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=HI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Yy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=HI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),P(a)&&(a="color"===this._legendType?lK:hK);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(e){const i=NO({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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.title={visible:!1},T.showHandler=!1!==n.visible,P(n.style)||(T.handlerStyle=QI(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),P(r.style)||(T.railStyle=QI(r.style)),P(a.style)||(T.trackStyle=QI(a.style)),T.startText=qI(o),T.endText=qI(l),T.handlerText=qI(h),P(c)||(T.sizeBackground=QI(c)),d.visible&&!P(d.style)&&(NO(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return iK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",yt((e=>{const i=E(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(aL.legendFilter,{model:this,value:i,event:e})}),30))}}}cK.specKey="legends",cK.builtInTheme={colorLegend:rK,sizeLegend:oK},cK.type=n.continuousLegend;const dK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,uK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),pK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function gK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(u(a.regionId)?[a.regionId]:void 0,u(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=fK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",p=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=>uK(i,s)(t)&&uK(n,r)(t)&&(d(a)||uK([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:p.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:p.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:[]}}))}];u(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:oL.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return qD.globalConfig.uniqueTooltip&&qD.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:oL.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return qD.globalConfig.uniqueTooltip&&qD.hideTooltip(l.id),c}return"none"}const fK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=dK(c,t);let _=dK(p,t);const y=pK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(uK(c,v));if(!y&&(_=dK(p,i),!pK(_)))return;const n=e.type===rO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=ZC(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])=>d(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(uK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=dK(p,o),!pK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(uK(c,n));if(!y&&(_=dK(p,r),!pK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===rO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(uK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=dK(p,i),!pK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},mK=t=>u(t)&&!_(t),vK=t=>u(t)&&_(t);class _K extends Zz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=NO({},this._theme,r.style),r.offset=NO({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return u(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:Ny(this._option.mode)||!Hy(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,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=__.getElementById(t.parentElement)):Hy(this._option.mode)&&(t.parentElement=null==jy?void 0:jy.body)}}const yK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class bK extends Jz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=_K,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Hy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&mK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!d(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&&qD.globalConfig.uniqueTooltip&&l&&qD.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(aL.tooltipHide,Object.assign(Object.assign({},t),{source:oL.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=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:oL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(aL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(aL.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?SH.canvas:SH.dom,n=WO.getComponentPluginInType(t);n||Dy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=WO.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Vy(s)||Ny(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))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(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=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,bt(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=gK(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(d(this._cacheInfo)||d(t))return!1;if(vK(t)){if(mK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>ez(t,e[i])))}if(vK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}bK.type=n.tooltip,bK.transformerConstructor=_K,bK.builtInTheme={tooltip:yK},bK.specKey="tooltip";var xK,SK;!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"}(SK||(SK={}));const kK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class AK extends Jz{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=UL.CrossHair_Grid,this.labelZIndex=UL.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),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=bt((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(p(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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{ZC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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:lL.chart}:{source:oL.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Vy(t)||Ny(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.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:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(aL.tooltipHide,{source:oL.chart},this._handleTooltipHideOrRelease),this.event.on(aL.tooltipShow,{source:oL.chart},this._handleTooltipShow),this.event.on(aL.tooltipRelease,{source:oL.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=E(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{kK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=E(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=E(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:E(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}AK.specKey="crosshair";const MK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class wK extends AK{static getSpecInfo(t){return sF(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=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=YF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){YF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:XF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=eO(this._regions,"cartesian");e&&(pH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=mH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new iw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new sw(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}wK.specKey="crosshair",wK.builtInTheme={crosshair:MK},wK.type=n.cartesianCrosshair;class TK extends AK{static getSpecInfo(t){return sF(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=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=eO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Bz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=iF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:oe(d,a.getInnerRadius(),o),end:oe(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=he(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=oe(t,o,r),d=oe(t,o,h),m=fe([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=ft(se.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new iw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new rw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new nw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ce(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}}(u):function(t){let e="center",i="middle";return e=(t=ce(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?oe(e,p[1]+m.offset,u):oe(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}TK.specKey="crosshair",TK.builtInTheme={crosshair:MK},TK.type=n.polarCrosshair;const CK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},BK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},PK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let u=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&(u=!0,r.domain.forEach((t=>{d(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),d(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=u?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class EK extends Jz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 QR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),QR(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=ft(this._start+f,0,1),_=ft(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ht(s/n)>=.5:Ht(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=KF(t),this._isHorizontal="horizontal"===qF(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(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!KC(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(KC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(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?[$(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];let s;if(this._relatedAxisComponent){const n={};QR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?G(u.xField):G(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?G(u.yField):G(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,KC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;KC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else QR(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:n}=this._option;gL(n,"dataview",xa),pL(n,"dataFilterComputeDomain",PK);const r=new Ma(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new yD(this._option,r),r.reRunAllTransform(),n.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(KC(e.type))return this._isReverse()?i[0]+(Y(i)-i[0])*(1-t):i[0]+(Y(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+(Y(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&&KC(e.type)&&(s=s.slice().reverse()),(i-s[0])/(Y(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&u(this._spec.start)||"value"===e&&u(this._spec.startValue):"percent"===e&&u(this._spec.end)||"value"===e&&u(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,KC(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(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=KC(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[$(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new _B,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||(pL(this._option.dataSet,"dataFilterWithNewDomain",BK),pL(this._option.dataSet,"lockStatisticsFilter",CK),QR(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:()=>KC(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:()=>KC(this._stateScale.type)},level:ML.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}_parseDomainFromState(t,e){if(KC(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,o;const l={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:u(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=bt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}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]:YL.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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,r,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),u=this._getAxisBandSize(h);if(!this._dataUpdating&&ZC(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==u?void 0:u.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(r=this._cacheRect)||void 0===r?void 0:r.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==u?void 0:u.bandSize,ZC(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}clear(){this._throttledHide=null}}U(EK,BV);class RK extends Zz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=NO({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const OK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),IK={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:OK(!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:OK(!0)};class LK extends EK{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=RK,this.specKey="dataZoom",this.layoutZIndex=UL.DataZoom,this.layoutLevel=GL.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,c;super.setAttrFromSpec(),h(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(),d(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),d(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const u=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new jB;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?[$(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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(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(!KC(t.type)||e[0]!==Y(e))&&(!ZC(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(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:u(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 eE(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);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(aL.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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:QI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:QI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:QI(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:QI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:QI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:QI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:QI(g.style)},selectedBackgroundStyle:QI(this._spec.selectedBackground.style),dragMaskStyle:QI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:NO(QI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:NO(QI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QI(null===(d=m.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}=iF(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()}}LK.type=n.dataZoom,LK.transformerConstructor=RK,LK.builtInTheme={dataZoom:IK},LK.specKey="dataZoom";const DK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class FK extends EK{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=UL.DataZoom,this.layoutLevel=GL.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),h(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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return x(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:u(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 oM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=UR(this._start,t)&&UR(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this.statePointToData(t),n=this.statePointToData(e);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this.statePointToData(t),this.statePointToData(e)))&&this.event.emit(aL.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()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=QI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=QI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}FK.type=n.scrollBar,FK.builtInTheme={scrollBar:DK},FK.specKey="scrollBar";const zK=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},jK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:jK("l1FontSize","primaryFontColor")},content:{visible:!0,style:jK("l2FontSize","tertiaryFontColor")}};class VK extends Jz{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=UL.Indicator,this.layoutLevel=GL.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return sF(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=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){pL(this._option.dataSet,"indicatorFilter",zK);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 yD(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 e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=NO({},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({},JI(j(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?EO(l,this._computeLayoutRadius()):0,dy:h?EO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(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({},JI(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_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)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new vR(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]:"":c(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>!!e.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}VK.type=n.indicator,VK.builtInTheme={indicator:HK},VK.specKey="indicator";const NK=["sum","average","min","max","variance","standardDeviation","median"];function WK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function UK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&WK(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=AO(t.x)?$K(t.x,n)+r.x:KK(l.getXAxisHelper(),[t.x])+r.x,h}function GK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&WK(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=AO(t.y)?$K(t.y,n)+r.y:KK(l.getYAxisHelper(),[t.y])+r.y,h}function YK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&WK(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)),KK(a.angleAxisHelper,[t.angle])}function XK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&WK(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)),KK(a.radiusAxisHelper,[t.radius])}function $K(t,e){return Number(t.substring(0,t.length-1))*e/100}function KK(t,e){const i=t.getScale(0);return KC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function qK(t){return NK.includes(t)}function ZK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=UK(t,_,n,p,c,o),r=GK(t,y,n,p,d,o),JK(s,b,S,g.length),JK(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=UK(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);JK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=GK(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);JK(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function JK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=YK(t,l,n,r),i=XK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=YK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=XK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function tq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=AO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=AO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&WK(_,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===S.length&&x(S[0])&&WK(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:KK(d.getXAxisHelper(),b)+p.x+m,y:KK(d.getYAxisHelper(),S)+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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&WK(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&&x(u[0])&&WK(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:KK(l.angleAxisHelper,d),radius:KK(l.radiusAxisHelper,u)})})),s}function iq(t,e,i){let{x:s,y:n}=t;return AO(s)&&(s=$K(s,e)),AO(n)&&(n=$K(n,i)),{x:s,y:n}}function sq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(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}=iq(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=>iq(t,n,r)))}function nq(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 rq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},QI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},oq(QI(n.style),i,s)),u(n.padding)&&(t.padding=si(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=oq(QI(r),i,s)),t}return{visible:!1}}function aq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function oq(t,e,i){return c(t)?t(e,i):t}function lq(t,e){return c(t)?t(e):t}function hq(t,e,i){return u(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 cq(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function dq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=cq(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=cq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function pq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function gq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(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;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&qK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&qK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&qK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&qK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>mq(i,e,t))):i.x=mq(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>mq(i,e,t))):i.y=mq(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>mq(i,e,t))):i.angle=mq(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>mq(i,e,t))):i.radius=mq(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=mq(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const fq={min:(t,e)=>GR(t[0].latestData,e.field),max:(t,e)=>YR(t[0].latestData,e.field),sum:function(t,e){return XR(t[0].latestData,e.field)},average:function(t,e){return $R(t[0].latestData,e.field)},variance:function(t,e){return KR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(KR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return lt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function mq(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return fq[i](e,{field:s})}return t}function vq(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 Jz{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 sF(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 v(e)&&qK(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=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Aa;return e.registerParser("array",i),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(u(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=eO(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e){d(this._spec.offsetX)||(this._layoutOffsetX=wO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=wO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();pL(this._option.dataSet,"markerAggregation",gq),pL(this._option.dataSet,"markerFilter",vq);const i=new Ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function yq(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=GR(t,e),r=YR(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class bq extends _q{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=UL.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=dq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:oq(QI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{line:aq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return aq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return aq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:oq(QI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:oq(QI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=nq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=dq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;pL(this._option.dataSet,"markerAggregation",gq),pL(this._option.dataSet,"markerRegression",yq),pL(this._option.dataSet,"markerFilter",vq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ma(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}bq.specKey="markLine";const xq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Sq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},kq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:xq(!1),endSymbol:xq(!0),label:Sq};class Aq extends bq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new HE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=dq(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=ZK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=tq(i,r,d,e.coordinatesOffset):c&&(y=sq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(AO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=dq(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&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Aq.type=n.markLine,Aq.coordinateType="cartesian",Aq.builtInTheme={markLine:kq};class Mq extends bq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=dq(this._spec);return e||i?new WE(t):new HE(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}=dq(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=QK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>oe(f,t.radius,t.angle)))}}else u&&(p=eq(i,r,a),g={points:p.map((t=>oe(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=dq(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}}}Mq.type=n.polarMarkLine,Mq.coordinateType="polar",Mq.builtInTheme={polarMarkLine:kq};class wq extends Jz{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=UL.Title,this.layoutLevel=GL.Title,this._orient="top",this._orient=kO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return sF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=wO(this._spec.width,l.width,null,l.width),c=wO(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),p=Object.assign(Object.assign({},j(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 u(this._spec.width)&&(p.textStyle.width=Math.max(h,l.width),p.subtextStyle.width=p.textStyle.width),p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new fR(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}}wq.type=n.title,wq.specKey=n.title,wq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class Tq extends _q{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=UL.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=uq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:oq(QI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{area:aq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>aq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return aq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=nq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=uq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Tq.specKey="markArea";const Cq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class Bq extends Tq{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new NE(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=uq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=ZK(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=ZK(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=tq(s,a,p,i.coordinatesOffset):d&&(f=sq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=uq(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}}}Bq.type=n.markArea,Bq.coordinateType="cartesian",Bq.builtInTheme={markArea:Cq};class Pq extends Tq{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=uq(this._spec);return i||e||s?new UE(t):new NE(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}=uq(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=QK(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=>oe(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=uq(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}}}Pq.type=n.polarMarkArea,Pq.coordinateType="polar",Pq.builtInTheme={polarMarkArea:Cq};const Eq=t=>QI(Object.assign({},t)),Rq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},QI(t.style))}),Oq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Eq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Eq(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:{},QI(Object.assign({},y)));var y;const b=Rq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Rq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Rq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Rq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Iq=t=>"left"===t||"right"===t,Lq=t=>"top"===t||"bottom"===t,Dq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Fq extends Jz{constructor(){super(...arguments),this.layoutZIndex=UL.Player,this.layoutLevel=GL.Player,this.specKey="player",this.type=n.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({},Oq(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({},Oq(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new ER(t):this._playerComponent=new IR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=Iq(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=Iq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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(aL.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(MR.end,(()=>{var t;this.event.emit(aL.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(MR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(MR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(MR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aL.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),k(t.x)){const e=Iq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Lq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Iq(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Lq(this._orient)?this._maxSize():t.height}_computeDx(t){return Iq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Lq(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];this._option.globalInstance.updateFullData(e.data),this.event.emit(aL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}Fq.builtInTheme={player:Dq},Fq.specKey="player",Fq.type=n.player;class zq extends Jz{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=UL.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=pO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==XL.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}zq.type=n.label;class jq extends EN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}jq.type="text",jq.constructorType="label";const Hq=()=>{RN(),WO.registerMark(jq.constructorType,jq)};class Vq extends Zz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Nq extends zq{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=Vq,this.layoutZIndex=UL.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(aL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(nL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(nL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),QR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{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),c(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",YL.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=NO({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},ZV(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[PI])):t=>t.filter((t=>t.data[BI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?JV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}Nq.type=n.label,Nq.specKey="label",Nq.transformerConstructor=Vq;class Wq extends zq{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=UL.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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[TI]},"normal",YL.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return NO({textStyle:{pickable:!0===this._spec.interactive},position:Uq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[PI]:t.data[BI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>JV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Uq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Wq.type=n.totalLabel,Wq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Wq.specKey="totalLabel";class Gq extends _q{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=UL.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=pq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,P,E,R;const{itemContent:O={},itemLine:I={},targetSymbol:L={}}=this._spec,D=O,{type:F="text",text:j,symbol:H,image:V,richText:N,customMark:W,textStyle:U,symbolStyle:G,imageStyle:Y,richTextStyle:X,customMarkStyle:$,style:K={},state:q={}}=D,Z=t(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(e=null==j?void 0:j.state)&&void 0!==e?e:q,tt={dx:0,dy:0},Q=rq(z(tt,null!==(i=null!=j?j:U)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=oq(z(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:X)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=QI(oq(z(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=oq(z(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==W?void 0:W.state)&&void 0!==u?u:q,Q=oq(null!==(g=null!==(p=null==W?void 0:W.style)&&void 0!==p?p:$)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:lq(O.offsetX,this._relativeSeries.getRegion()),offsetY:lq(O.offsetX,this._relativeSeries.getRegion())},Z),{style:oq(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=L.offset)&&void 0!==y?y:0,visible:null!==(b=L.visible)&&void 0!==b&&b,size:null!==(x=L.size)&&void 0!==x?x:20,style:oq(L.style,this._markerData,this._markAttributeContext)},state:{line:aq(null!==(k=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(M=null===(A=this._spec.itemLine.startSymbol)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(T=null===(w=this._spec.itemLine.endSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),itemContent:aq(J,this._markerData,this._markAttributeContext),textBackground:aq(null===(B=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===B?void 0:B.state,this._markerData,this._markAttributeContext),targetItem:aq(null!==(E=null===(P=this._spec.targetSymbol)||void 0===P?void 0:P.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext)},animation:null!==(R=this._spec.animation)&&void 0!==R&&R,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=I,nt=t(I,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:QI(st.style)}):{visible:!1};return new YE(et)}_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}=nq([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:hq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:hq(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}=pq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Gq.specKey="markPoint";const Yq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Xq extends Gq{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=ZK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=tq(n,r,h,s.coordinatesOffset)[0]:l&&(c=sq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=pq(t),i=u(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}}}Xq.type=n.markPoint,Xq.coordinateType="cartesian",Xq.builtInTheme={markPoint:Yq};class $q extends Gq{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=QK(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:oe({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}])]}}}$q.type=n.polarMarkPoint,$q.coordinateType="polar",$q.builtInTheme={polarMarkPoint:Yq};class Kq extends Gq{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}Kq.type=n.geoMarkPoint,Kq.coordinateType="geo",Kq.builtInTheme={geoMarkPoint:Yq};const qq="inBrush",Zq="outOfBrush";class Jq extends Jz{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=UL.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return sF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),qq,YL.Series),i.setMarkStyle(s,Object.assign({},e),Zq,YL.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new zR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:QI(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),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(RR.brushActive,(i=>{this._initMarkBrushState(e,Zq),this._emitEvent(aL.brushActive,t)})),r.addEventListener(RR.drawStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(aL.brushStart,t)})),r.addEventListener(RR.moveStart,(e=>{this._setRegionMarkPickable(t,!0),this._emitEvent(aL.brushStart,t)})),r.addEventListener(RR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(aL.brushChange,t)})),r.addEventListener(RR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(aL.brushChange,t)})),r.addEventListener(RR.brushClear,(i=>{this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(aL.brushClear,t)})),r.addEventListener(RR.drawEnd,(i=>{var s;this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(aL.brushClear,t)):(this._spec.onBrushEnd(i),this._emitEvent(aL.brushEnd,t));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(aL.brushEnd,t)}})),r.addEventListener(RR.moveEnd,(e=>{this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(aL.brushEnd,t)}))}_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]}}_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({},QI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(qq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(qq),i.addState(Zq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(qq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(qq),i.addState(Zq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ce(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(qq),s.removeState(Zq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Jq.type=n.brush,Jq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Jq.specKey="brush";class Qq extends Jz{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=UL.CustomMark,this.layoutLevel=GL.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${uI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=OF({},IF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e)}))),u(t.dataId)||k(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 N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new ze).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new ze;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Qq.type=n.customMark,Qq.specKey="customMark";class tZ{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||(k(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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);k(h.width)||(h.width=l.width),k(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}tZ.type="grid";const iZ="vchart-tooltip",sZ=`${iZ}-container`,nZ=`${iZ}-title`,rZ=`${iZ}-content-box`,aZ={offsetX:10,offsetY:10},oZ="99999999999999";function lZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const hZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,cZ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?lZ(t):"",dZ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},uZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},pZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=uZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class gZ extends wz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=lF(null==w?void 0:w.position,b,e),C=null!==(r=lF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:P=0}=null!=i?i:{},E="canvas"===m.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:pI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:gI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Hy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!E){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=hZ(e,F),V=hZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:P;switch(pZ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=dZ(t,_),U.top=dZ(i,_),U.right=dZ(e,_),U.bottom=dZ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=dZ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:P,s="x"===t?O:I,n="x"===t?A:M,r=pZ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mZ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=fZ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=fZ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},vZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?wO(e,t.fontSize):0},_Z=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=si(r),a.padding=fZ(o)),{panelStyle:a,panelPadding:o}};function yZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const bZ=t=>{WO.registerComponentPlugin(t.type,t)};class xZ extends gZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(xZ.type),this.type=SH.dom,this._tooltipContainer=null==jy?void 0:jy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(jy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=_Z(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:fZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=mZ(h),x=mZ(u),S=mZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=fZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=fZ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=fZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(vZ(p),vZ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(nZ))),l=a.find((t=>t.className.includes(rZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(nZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(yZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${iZ}-column`),e.classList.add(`${iZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(rZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];yZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));yZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${iZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=cZ(e.key),e.keyStyle&&mZ(e.keyStyle,l)):"value"===i?(o.innerHTML=cZ(e.value),e.valueStyle&&mZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?lZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?lZ(c):m,y=g,b=t=>new Sg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new ze));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=dh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?lZ(u):"currentColor",`\n \n \n \n `;const T=w?dh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),yZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(rZ))),h=[...o.children].find((t=>t.className.includes(nZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(nZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=wO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,yZ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{bZ(xZ)},kZ={fontFamily:LO.fontFamily,spacing:10,wordBreak:"break-word"},AZ=(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},hf||(hf=of.CreateGraphic("richtext",{})),hf.setAttributes(a),hf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function MZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:kZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const wZ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class TZ extends gZ{constructor(){super(TZ.type),this.type=SH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new WR({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=si(d.padding),b=BO(d.padding),x=MZ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=MZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=MZ(m,i),A={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},M={panel:wZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,P=0;const E=!!T.length;let R=0,O=0,I=0,L=0;if(E){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=NO({},S,MZ(b,void 0,{})),{width:s,height:n,text:r}=AZ(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(u(m)){const t=NO({},k,MZ(x,void 0,{})),{width:e,height:s,text:n}=AZ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=NO({},x,MZ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:E?Math.ceil(P):void 0);const{text:t,width:e,height:i}=AZ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(E?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=P||D:C+=Math.max(D,P),E&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}TZ.type=SH.canvas;const CZ=()=>{bZ(TZ)},BZ=(t="chart",e,i)=>{var s,r,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(rO).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=WO.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=WO.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},PZ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=BZ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):zO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=NO({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:NO(f,m),hasChanged:!0};const i=NO({},t,m);jO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},EZ=t=>{WO.registerChartPlugin(t.type,t)};class RZ extends wz{constructor(){super(RZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[RZ.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[RZ.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=VO(this._option.globalInstance.getSpec(),["data",RZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=VO(this._baseChartSpec,["data",RZ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=PZ(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=VO(i,["data",RZ.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()}}RZ.pluginType="chart",RZ.specKey="media",RZ.type="MediaQueryPlugin";const OZ=()=>{EZ(RZ)},IZ=/\{([^}]+)\}/,LZ=/\{([^}]+)\}/g,DZ=/:/;class FZ extends wz{constructor(){super(FZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:pi.getInstance().timeUTCFormat,local:pi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=xi.getInstance().format,this._numericSpecifier=xi.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[FZ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),WO.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=IZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(LZ,((t,i)=>{if(!DZ.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(_i.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}FZ.pluginType="chart",FZ.specKey="formatter",FZ.type="formatterPlugin";const zZ=()=>{EZ(FZ)};qD.useRegisters([()=>{vT(),oT.registerBuiltInAnimate("scaleIn",bC),oT.registerBuiltInAnimate("scaleOut",xC),oT.registerBuiltInAnimate("fadeIn",YT),oT.registerBuiltInAnimate("fadeOut",XT),oT.registerBuiltInAnimate("moveIn",MC),oT.registerBuiltInAnimate("moveOut",wC),oT.registerBuiltInAnimate("rotateIn",CC),oT.registerBuiltInAnimate("rotateOut",BC),oT.registerBuiltInAnimate("update",kC),oT.registerBuiltInAnimate("state",SC),oT.registerBuiltInAnimate("fromTo",PC)},()=>{TH(),BH(),EH(),nH(),sH(),Nj(),Oj(),fz(),vz(),jD(),DD(),wj(),Sj(),WO.registerSeries(Wj.type,Wj),WO.registerChart(RH.type,RH)},()=>{TH(),BH(),EH(),sH(),Nj(),Oj(),fz(),LH(),vz(),zH(),wj(),Sj(),WO.registerSeries(HH.type,HH),nH(),WO.registerChart(NH.type,NH)},()=>{TH(),BH(),EH(),sH(),iV(),nH(),WO.registerChart(nV.type,nV)},()=>{TH(),BH(),nH(),sH(),gV(),WO.registerChart(mV.type,mV)},()=>{BH(),uW(),WO.registerChart(a$.type,a$)},()=>{TH(),BH(),nH(),sH(),EW(),WO.registerChart(h$.type,h$)},()=>{TH(),BH(),EH(),nH(),sH(),HW(),WO.registerChart(d$.type,d$)},()=>{TH(),BH(),EH(),nH(),sH(),iV(),WO.registerChart(v$.type,v$)},()=>{BH(),RV(),SV(),WO.registerSeries(IV.type,IV),WO.registerImplement("registerMap",_L),WO.registerImplement("unregisterMap",yL),FD(),WO.registerChart(t$.type,t$)},()=>{BH(),_X(),WO.registerSeries(bX.type,bX),aW(),eU(),TW(),nU(),WO.registerChart(x$.type,x$)},()=>{BH(),GG(),WO.registerChart(A$.type,A$)},()=>{BH(),dY(),WO.registerChart(w$.type,w$)},()=>{TH(),BH(),EH(),nH(),sH(),hN(),WO.registerChart(z$.type,z$)},()=>{TH(),BH(),nH(),sH(),PN(),WO.registerChart(H$.type,H$)},()=>{TH(),BH(),nH(),sH(),nU(),WO.registerChart(y$.type,y$)},()=>{TH(),BH(),nH(),sH(),uU(),WO.registerChart(C$.type,C$)},()=>{TH(),BH(),nH(),sH(),VN(),WO.registerChart(P$.type,P$)},()=>{TH(),BH(),EH(),nH(),sH(),LH(),wj(),Sj(),WO.registerSeries(YN.type,YN),WO.registerChart(U$.type,U$)},()=>{BH(),BY(),WO.registerChart(R$.type,R$)},()=>{BH(),LY(),WO.registerChart(I$.type,I$)},()=>{BH(),lX(),WO.registerChart(D$.type,D$)},()=>{BH(),fo.load(dM),tX(),WO.registerChart(N$.type,N$)},()=>{BH(),TX(),WO.registerChart(Y$.type,Y$)},()=>{BH(),HX(),WO.registerChart($$.type,$$)},()=>{TH(),BH(),EH(),nH(),WO.registerChart(p$.type,p$),sH()},Sj,wj,()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),rj(),WO.registerComponent(Tj.type,Tj)},()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),rj(),WO.registerComponent(Cj.type,Cj)},()=>{WO.registerGraphicComponent(Qz.lineAxis,((t,e)=>new DC(t,e))),WO.registerGraphicComponent(tj.lineAxisGrid,((t,e)=>new YP(t,e))),rj(),WO.registerComponent(Bj.type,Bj)},BW,TW,()=>{WO.registerComponent(Q$.type,Q$)},()=>{WO.registerComponent(cK.type,cK)},()=>{WO.registerComponent(bK.type,bK)},()=>{WO.registerComponent(wK.type,wK)},()=>{WO.registerComponent(TK.type,TK)},()=>{WO.registerComponent(LK.type,LK)},()=>{WO.registerComponent(FK.type,FK)},()=>{WO.registerComponent(VK.type,VK)},RV,()=>{WO.registerComponent(Aq.type,Aq),jE()},()=>{WO.registerComponent(Bq.type,Bq),VE()},()=>{WO.registerComponent(Xq.type,Xq),GE()},()=>{WO.registerComponent(Mq.type,Mq),WE._animate=bE,jE()},()=>{WO.registerComponent(Pq.type,Pq),UE._animate=SE,VE()},()=>{WO.registerComponent($q.type,$q),GE()},()=>{WO.registerComponent(Kq.type,Kq),GE()},()=>{WO.registerComponent(wq.type,wq)},()=>{WO.registerComponent(Fq.type,Fq)},()=>{WO.registerGraphicComponent(Nq.type,(t=>new NP(t))),Hq(),ij(),WO.registerComponent(Nq.type,Nq,!0,1/0)},()=>{WO.registerGraphicComponent(Wq.type,(t=>new NP(t))),Hq(),ij(),WO.registerComponent(Wq.type,Wq,!0)},()=>{WO.registerComponent(Jq.type,Jq)},()=>{WO.registerComponent(Qq.type,Qq)},()=>{fo.load(tw)},()=>{WO.registerLayout(tZ.type,tZ)},CZ,GD,$D]),qD.useRegisters([()=>{ek(fo)}]);export{YL as AttributeLevel,Tz as AxisSyncPlugin,TZ as CanvasTooltipHandler,aL as ChartEvent,gI as DEFAULT_CHART_HEIGHT,pI as DEFAULT_CHART_WIDTH,QD as DEFAULT_CLOSE_STROKE_JOIN,mI as DEFAULT_DATA_INDEX,vI as DEFAULT_DATA_KEY,_I as DEFAULT_DATA_SERIES_FIELD,FI as DEFAULT_KEY,NL as DEFAULT_LAYOUT_RECT_LEVEL,WL as DEFAULT_LAYOUT_RECT_LEVEL_MIN,JD as DEFAULT_LINEAR_INTERPOLATE,fI as DEFAULT_MEASURE_CANVAS_ID,yI as DEFAULT_SERIES_STYLE_NAME,ZD as DEFAULT_SMOOTH_INTERPOLATE,sT as DefaultTicker,tF as Direction,xZ as DomTooltipHandler,WO as Factory,FZ as FormatterPlugin,GL as LayoutLevel,UL as LayoutZIndex,II as MOSAIC_CAT_END_PERCENT,OI as MOSAIC_CAT_START_PERCENT,RI as MOSAIC_VALUE_END_PERCENT,EI as MOSAIC_VALUE_START_PERCENT,rT as ManualTicker,RZ as MediaQuery,uI as PREFIX,s as RenderModeEnum,DI as SEGMENT_FIELD_END,LI as SEGMENT_FIELD_START,SI as STACK_FIELD_END,wI as STACK_FIELD_END_OffsetSilhouette,AI as STACK_FIELD_END_PERCENT,bI as STACK_FIELD_KEY,xI as STACK_FIELD_START,MI as STACK_FIELD_START_OffsetSilhouette,kI as STACK_FIELD_START_PERCENT,TI as STACK_FIELD_TOTAL,PI as STACK_FIELD_TOTAL_BOTTOM,CI as STACK_FIELD_TOTAL_PERCENT,BI as STACK_FIELD_TOTAL_TOP,$L as STATE_VALUE_ENUM,EC as StreamLight,rI as ThemeManager,ML as TransformLevel,VL as USER_LAYOUT_RECT_LEVEL,qD as VChart,CO as boundsInRect,$O as builtinThemes,wO as calcLayoutNumber,TO as calcPadding,dO as computeActualDataScheme,PO as convertPoint,tf as createArc,Zg as createArea,Tp as createGroup,wg as createLine,Pg as createRect,Gg as createRichText,kg as createSymbol,bg as createText,FO as darkTheme,RO as dataScheme,qD as default,KO as defaultThemeName,pO as getActualColor,EO as getActualNumValue,vO as getColorSchemeBySeries,cO as getDataScheme,YO as getFunnelTheme,sI as getMergedTheme,sF as getSpecInfo,tI as getTheme,JO as hasThemeMerged,gO as isColorKey,AO as isPercent,MO as isPercentOffset,fO as isProgressiveDataColorScheme,IO as isTokenKey,kO as isValidOrient,DO as lightTheme,nF as lookup,dI as measureText,BO as normalizeLayoutPaddingSpec,uO as queryColorFromColorScheme,OO as queryToken,CZ as registerCanvasTooltipHandler,EZ as registerChartPlugin,gL as registerDataSetInstanceParser,pL as registerDataSetInstanceTransform,SZ as registerDomTooltipHandler,zZ as registerFormatPlugin,OZ as registerMediaQuery,QO as registerTheme,eI as removeTheme,iI as themeExist,qO as themes,LO as token,mO as transformColorSchemeToStandardStruct,QI as transformToGraphic,rF as version,__ as vglobal,Ly as warn}; diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 01ce211917..07781f93aa 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "2.0.5", + "version": "2.0.6", "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 5c0b328cb2..422a1633ba 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal");const vo=new class{};let _o=0;class yo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=vo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++_o,t),this.tryRunAnimationFrameNextFrame(),_o}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class bo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var xo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ao=function(t,e){return function(i,s){e(i,s,t)}},ko=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 Mo=class extends bo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new yo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ko(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var To,wo,Co,Eo;Mo=xo([Ya(),Ao(0,Wa(lo)),Ao(0,$a(fo)),So("design:paramtypes",[Object])],Mo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(To||(To={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(wo||(wo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Eo||(Eo={}));const Bo=Ht-1e-8;class Po{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Bo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,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,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},Io={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Do,Fo,zo,jo,Ho,Vo;var No,Uo,Wo,Go,Yo,$o;function Xo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Ko(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Zo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=nl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function al(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ol(i,n),new ol(n,s)]}class ol extends Jo{constructor(t,e){super(),this.type=Yo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p1.x):t===Go.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ll{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ol(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Go.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===Go.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class hl extends ll{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 cl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function dl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?Go.ROW:Go.COLUMN;return"monotoneY"===t?new hl(t,s):new ll(t,s)}class ul{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 pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new ul(n,s),t),n}function gl(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 fl{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&&gl(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:gl(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 ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("basis",i,t);return function(t,e){cl(t,e,2)}(new fl(n,s),t),n}function vl(t){return t<0?-1:1}function _l(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(vl(r)+vl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function yl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function bl(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 xl{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:bl(this,this._t0,yl(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,bl(this,yl(this,e=_l(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:bl(this,this._t0,e=_l(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 Sl extends xl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneX",i,t);return function(t,e){cl(t,e,2)}(new xl(n,s),t),n}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneY",i,t);return function(t,e){cl(t,e,2)}(new Sl(n,s),t),n}let Ml=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Tl extends Ml{lineEnd(){this.context.closePath()}}function wl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Ml(r,e,n),t),r}function Cl(t,e){return cl(t,e,1)}class El extends ul{lineEnd(){this.context.closePath()}}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new El(n,s),t),n}function Pl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ll(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return pl(i,n);const o=dl(t,r,i);return cl(new e(o,s,a),i,2),o}}const Rl=Ll("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Pl(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=Ll("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Pl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Il extends Jo{constructor(t,e,i){super(),this.type=Yo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return sl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Qo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p2.x):t===Go.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=sl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Il(i,a,r),new Il(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Dl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ol(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Il(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Fl(t,e,i){var s,n;switch(e){case"linear":default:return pl(t,i);case"basis":return ml(t,i);case"monotoneX":return Al(t,i);case"monotoneY":return kl(t,i);case"step":return wl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Tl(r,e,n),t),r}(t,.5,i);case"stepBefore":return wl(t,0,i);case"stepAfter":return wl(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 Ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Bl(t,i)}}class zl extends Lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Po(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Io.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Io.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Io.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([Io.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([Io.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([Io.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([Io.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([Io.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Io.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Dl(this);Zo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Io.M]=t=>`M${t[1]} ${t[2]}`,t[Io.L]=t=>`L${t[1]} ${t[2]}`,t[Io.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Io.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Io.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Io.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;tVo){let t,e=zo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Go.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===Go.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),ih=Object.assign(Object.assign({},Xl),{points:[],cornerRadius:0,closePath:!0}),sh=Object.assign(Object.assign({},Xl),{width:100,height:100,spikes:5,thickness:.5}),nh=Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const rh=Object.assign(Object.assign({},Xl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ah=Object.assign(Object.assign(Object.assign({},Xl),Gl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),oh=Object.assign(Object.assign(Object.assign({},Xl),Gl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),lh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Xl),{fill:!0,cornerRadius:0,cornerType:"round"}),hh=Object.assign(Object.assign({},lh),{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}),ch=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&&_(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 dh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(dh.IsGradientStr(t))try{const e=ch(t)[0];if(e){if("linear"===e.type)return dh.ParseLinear(e);if("radial"===e.type)return dh.ParseRadial(e);if("conic"===e.type)return dh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:dh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:dh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const gh={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"}},fh=!0,mh=!1,vh=/\w|\(|\)|-/,_h=/[.?!,;:/,。?!、;:]/,yh=/\S/,bh=(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})};function xh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=vo.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=Sh(t,a)),a}function Sh(t,e,i=!1){let s=e;for(;vh.test(t[s-1])&&vh.test(t[s])||_h.test(t[s]);)if(s--,s<=0)return i?Ah(t,e):e;return s}function Ah(t,e){let i=e;for(;vh.test(t[i+1])&&vh.test(t[i])||_h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function kh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=vo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Th=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ah.fontSize}){let i=0,s=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=Sh(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,a=!1){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=Sh(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}};Th=Mh([Ya()],Th);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};const Ch=Symbol.for("TextMeasureContribution");let Eh=class extends Th{};Eh=wh([Ya()],Eh);const Bh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},Ph=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Rh(t){return Bh.getNamed(Ph,vo.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Dh=1/3;function Fh(t){return t>-qh&&tqh||t<-qh}const jh=[0,0],Hh=[0,0],Vh=[0,0];function Nh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Gh(t){return(t%=Vt)<0&&(t+=Vt),t}function Yh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function Kh(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(Fh(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 Jh=[-1,-1,-1],Qh=[-1,-1];function tc(){const t=Qh[0];Qh[0]=Qh[1],Qh[1]=t}function ec(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(Fh(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,Dh):Math.pow(i,Dh),s=s<0?-Math.pow(-s,Dh):Math.pow(s,Dh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Jh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&tc(),p=Wh(e,s,r,o,Qh[0]),u>1&&(g=Wh(e,s,r,o,Qh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Fh(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,Jh);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=Uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Jh[0]=-l,Jh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Jh[0]+t&&a<=Jh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Jh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function nc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function rc(t,e){let i=nc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-nc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;ac[0]=S,ac[1]=A,rc(ac,Boolean(a[6])),S=ac[0],A=ac[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Io.M:u=m,p=v,c=u,d=p;break;case Io.L:if(i){if(Kh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Io.C:if(i){if($h(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Io.Q:if(i){if(Yh(c,d,m,v,_,y,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Io.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Xh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=sc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Io.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Kh(u,p,o,p,e,s,n)||Kh(o,p,o,l,e,s,n)||Kh(o,l,u,l,e,s,n)||Kh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Io.Z:if(i){if(Kh(c,d,u,p,e,s,n))return!0}else h+=Le(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},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dc=Symbol.for("VWindow"),uc=Symbol.for("WindowHandlerContribution");let pc=class extends bo{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Bh.getNamed(uc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=vo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};pc=hc([Ya(),cc("design:paramtypes",[])],pc);var gc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mc=function(t,e){return function(i,s){e(i,s,t)}};let vc=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=vo.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=lc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Gl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:Gl.fontFamily,fontSize:Gl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Bh.get(dc),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 _c;vc=gc([Ya(),mc(0,Wa(lo)),mc(0,$a(Ch)),fc("design:paramtypes",[Object])],vc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(_c||(_c={}));const yc=new Ue;let bc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=_c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=_c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}scale(t,e,i){return this.mode===_c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===_c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return yc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}translate(t,e){return this.mode===_c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===_c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bc=gc([Ya(),fc("design:paramtypes",[])],bc);const xc={arc:Kl,area:ql,circle:Zl,line:th,path:eh,symbol:rh,text:ah,rect:nh,polygon:ih,star:sh,richtext:oh,richtextIcon:hh,image:lh,group:Jl,glyph:Ql},Sc=Object.keys(xc);function Ac(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},xc.arc),area:Object.assign({},xc.area),circle:Object.assign({},xc.circle),line:Object.assign({},xc.line),path:Object.assign({},xc.path),symbol:Object.assign({},xc.symbol),text:Object.assign({},xc.text),rect:Object.assign({},xc.rect),polygon:Object.assign({},xc.polygon),star:Object.assign({},xc.star),richtext:Object.assign({},xc.richtext),richtextIcon:Object.assign({},xc.richtextIcon),image:Object.assign({},xc.image),group:Object.assign({},xc.group),glyph:Object.assign({},xc.glyph)};class Mc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Sc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Sc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Ac(n,t[s]),i[s]&&Ac(n,i[s]),e[s]&&Ac(n,e[s]),this.combinedTheme[s]=n})),e.common&&Sc.forEach((t=>{Ac(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 Tc=new Mc;function wc(t,e){return t.glyphHost?wc(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)):Tc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Tc.getTheme()}var Cc=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 Ec 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Cc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Dc(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(Dc(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,Dc(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 Lc))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"):Dc(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 Rc))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=Ic.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 Fc(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 Lc,this.rootWheelEvent=new Rc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Vc{static GetImage(t,e){var i;const s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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):Vc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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"},Vc.cache.set(t,s),s.dataPromise=vo.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=Vc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Vc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vo.global.loadBlob(t):"json"===e&&(i.dataPromise=vo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Vc.isLoading&&Vc.toLoadAueue.length){Vc.isLoading=!0;const t=Vc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Vc.cache.set(i,n),n.dataPromise=vo.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((()=>{Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()})).catch((t=>{console.error(t),Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()}))}}),0)}static loadImage(t,e){const i=Nc(t,Vc.toLoadAueue);if(-1!==i)return Vc.toLoadAueue[i].marks.push(e),void Vc.loading();Vc.toLoadAueue.push({url:t,marks:[e]}),Vc.loading()}static improveImageLoading(t){const e=Nc(t,Vc.toLoadAueue);if(-1!==e){const t=Vc.toLoadAueue.splice(e,1);Vc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Nc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Gc[0]=t[0],Gc[2]=t[0],Gc[1]=t[1],Gc[3]=t[1],Gc):t:t:0,$c=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function Kc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;$c[0].x=i,$c[1].y=i,$c[2].x=-i,$c[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Qc.TimeOut=1e3/60;const td=new Qc,ed=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class id{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 sd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var nd=new class extends id{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 sd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return sd(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 rd=new class extends id{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 ad(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 od=new class extends id{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 ad(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}};function ld(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var hd=new class extends id{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2+n,i,s)}};function cd(t,e,i,s,n=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 dd extends id{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 cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}}var ud=new dd;var pd=new class extends dd{constructor(){super(...arguments),this.type="triangle"}};const gd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),fd=Math.sin(Ht/10)*gd,md=-Math.cos(Ht/10)*gd;function vd(t,e,i,s){const n=fd*e,r=md*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 _d=new class extends id{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 vd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return vd(t,this.parseSize(e)/2+n,i,s)}};const yd=Xt(3);function bd(t,e,i,s){const n=e,r=n/yd,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 xd=new class extends id{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};function Sd(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 Ad=new class extends id{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Md=new class extends id{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Td=-.5,wd=Xt(3)/2,Cd=1/Xt(12);function Ed(t,e,i,s){const n=e/2,r=e*Cd,a=n,o=e*Cd+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(Td*n-wd*r+i,wd*n+Td*r+s),t.lineTo(Td*a-wd*o+i,wd*a+Td*o+s),t.lineTo(Td*l-wd*h+i,wd*l+Td*h+s),t.lineTo(Td*n+wd*r+i,Td*r-wd*n+s),t.lineTo(Td*a+wd*o+i,Td*o-wd*a+s),t.lineTo(Td*l+wd*h+i,Td*h-wd*l+s),t.closePath(),!1}var Bd=new class extends id{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ld=new class extends id{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends id{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Dd=new class extends id{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Fd=Xt(3);function zd(t,e,i,s){const n=e*Fd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var jd=new class extends id{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2/Fd,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2/Fd+n,i,s)}};function Hd(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 Vd=new class extends id{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Ud=new class extends id{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Gd=new class extends id{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 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 Yd(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 $d=new class extends id{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Kd=new class extends id{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Zd=new class extends id{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(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 Qd=new class extends id{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 Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(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 tu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function eu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var iu=new class extends id{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)?eu(t,e,i,s):tu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?eu(t,e+2*n,i,s):tu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const su=new Ve;class nu{constructor(t,e,i=!1){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(),Zo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Zo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{su.x1=i.bounds.x1*t,su.y1=i.bounds.y1*t,su.x2=i.bounds.x2*t,su.y2=i.bounds.y2*t,e.union(su)}))}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 ru={};[nd,rd,od,hd,jd,pd,_d,xd,Ad,Md,Bd,Ld,Od,ud,Dd,Vd,Ud,Gd,$d,iu,Kd,Zd,Qd].forEach((t=>{ru[t.type]=t}));const au={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ou{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 lu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function hu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=hu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=lu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=hu(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 ou(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 ou(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 uu(t,e){return pu(t)}function pu(t,e){const i={};for(let e=0;eSu.set(t,!0)));const Au=new Map;function ku(t){if(Su.has(t))return!0;if(Au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Au.set(t,!0)));const Mu=bu(),Tu=bu(),wu=bu(),Cu=bu(),Eu=bu(),Bu=bu(),Pu=bu(),Lu=bu(),Ru=bu(),Ou=bu();bu();const Iu=bu();bu();const Du=bu();bu();const Fu=bu(),zu=bu(),ju=Symbol.for("GraphicService"),Hu=Symbol.for("GraphicCreator"),Vu={"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"},Nu=Object.keys(Vu),Uu={duration:200,easing:"cubicOut"};function Wu(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 Gu(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 Yu(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 $u(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 Ku{constructor(){this.pools=[]}static identity(t){return Wu(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 Ku.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},Qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tp=new Ue(1,0,0,1,0,0),ep={x:0,y:0};let ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new zl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ep),function(t,e,i){return oc(t,0,!1,e,i)}(this.path.commandList,ep.x,ep.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ep);const i=uh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return oc(t,e,!0,i,s)}(this.path.commandList,i,ep.x,ep.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(t=!0,e=this.dpr){this.setTransformFromMatrix(tp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};ip=Ju([Ya(),Qu("design:paramtypes",[Object,Number])],ip);const sp={WIDTH:500,HEIGHT:500,DPR:1};class np{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}set nativeCanvas(t){this._nativeCanvas=t}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=sp.WIDTH,height:n=sp.HEIGHT,dpr:r=sp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var rp;np.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(rp||(rp={}));class ap{static Get(t,e=rp.Color1,i=[0,0,0,1]){if(e===rp.Color1){const e=ap.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ap.store1[t]=e,ap.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=ap.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(ap.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ap.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===rp.Color1){if(ap.store1[t])return;ap.store1[t]=i,ap.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ap.store255[t])return;ap.store255[t]=i,ap.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function op(t,e=!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 lp(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)=>{var a,o;return hp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):hp(t,e,i,s,n)}function hp(t,e,i,s,n){if(!t||!e)return t&&op(t)||e&&op(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ap.Get(t,rp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ap.Get(e,rp.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:op(a)})))});return o?lp(r,l,i,s,n):lp(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:pp(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:pp(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:pp(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),op(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)}function cp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}ap.store255={},ap.store1={};const dp=[0,0,0,0],up=[0,0,0,0];function pp(t,e,i){return ap.Get(t,rp.Color255,dp),ap.Get(e,rp.Color255,up),`rgba(${Math.round(dp[0]+(up[0]-dp[0])*i)},${Math.round(dp[1]+(up[1]-dp[1])*i)},${Math.round(dp[2]+(up[2]-dp[2])*i)},${dp[3]+(up[3]-dp[3])*i})`}class gp{static GetCanvas(){try{return gp.canvas||(gp.canvas=vo.global.createCanvas({})),gp.canvas}catch(t){return null}}static GetCtx(){if(!gp.ctx){const t=gp.GetCanvas();gp.ctx=t.getContext("2d")}return gp.ctx}}class fp extends We{static getInstance(){return fp._instance||(fp._instance=new fp),fp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=gp.GetCanvas(),s=gp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new fp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class mp{static GetSize(t){for(let e=0;e=t)return mp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=mp.GenKey(t,e,i,s,n),l=mp.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=mp.GenKey(t,e,i,s,n);mp.cache[l]?mp.cache[l].push({width:a,height:o,pattern:r}):mp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}mp.cache={},mp.ImageSize=[20,40,80,160,320,640,1280,2560];const vp=new Ve,_p=new Ue;new Ve;const yp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],bp=["x","y"],xp=["scaleX","scaleY"],Sp=["angle"],Ap=new ne,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends Ec{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ru[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===((i=t=au[t]||t).startsWith("{const e=(new zl).fromString(t.d),i={};Nu.forEach((e=>{t[e]&&(i[Vu[e]]=t[e])})),n.push({path:e,attribute:i}),vp.union(e.bounds)}));const r=vp.width(),a=vp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new nu(t,n,!0);return Mp.userSymbolMap[t]=l,l}var i;const s=(new zl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new nu(t,s);return Mp.userSymbolMap[t]=o,o}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=Yc(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 Po(t);return Zo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&No.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&No.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&No.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&No.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=No.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Uo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Uu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Wo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Wo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Wo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=No.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=No.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&No.UPDATE_SHAPE_AND_BOUNDS)===No.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=No.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=No.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=No.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=No.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=No.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&No.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,scaleX:i=Vl.scaleX,scaleY:s=Vl.scaleY,angle:n=Vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),vo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=_p.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Wo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new zl).fromString(t):this.pathProxy=new zl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),vo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||vo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ip(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Tp;Mp.userSymbolMap={},Mp.mixin(zc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tp||(Tp={}));let wp=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=No.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 Mc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Mc)}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===Uo.GLOBAL){const i=new ne(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&No.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,dx:i=Vl.dx,dy:s=Vl.dy,scaleX:n=Vl.scaleX,scaleY:r=Vl.scaleY,angle:a=Vl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return vo.graphicService.updateTempAABBBounds(i),vo.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&=No.CLEAR_BOUNDS,this._childUpdateTag&=No.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&No.UPDATE_BOUNDS||(this._childUpdateTag|=No.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&No.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=vo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Cp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Ep extends wp{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 Mc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vo.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=>{vo.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Dp,Fp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 jp=Dp=class{static GenerateLayerId(){return`${Dp.idprefix}_${Dp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vo.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?Bh.get(Rp):"dynamic"===t?Bh.get(Op):Bh.get(Ip),e}createLayer(t,e={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 Ep(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Dp.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)}};jp.idprefix="visactor_layer",jp.prefix_count=0,jp=Dp=Fp([Ya(),zp("design:paramtypes",[])],jp);var Hp=new Ra((t=>{t(mo).to(Mo).inSingletonScope(),t(dc).to(pc),t(Pp).to(vc).inSingletonScope(),t(Bp).to(bc).inSingletonScope(),t(Lp).to(jp).inSingletonScope()}));function Vp(t,e){return!(!t&&!e)}function Np(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Up(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Gp(t,e){return t*e>0}function Yp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function $p(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Kp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=$p(g,f,u,p,n,t,Number(c)),l=$p(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=$p(S,A,b,x,r,-n,Number(c)),l=$p(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const qp=Symbol.for("ArcRenderContribution"),Zp=Symbol.for("AreaRenderContribution"),Jp=Symbol.for("CircleRenderContribution"),Qp=Symbol.for("GroupRenderContribution"),tg=Symbol.for("ImageRenderContribution"),eg=Symbol.for("PathRenderContribution"),ig=Symbol.for("PolygonRenderContribution"),sg=Symbol.for("RectRenderContribution"),ng=Symbol.for("SymbolRenderContribution"),rg=Symbol.for("TextRenderContribution"),ag=Symbol.for("InteractiveSubRenderContribution");function og(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function lg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var hg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},dg=function(t,e){return function(i,s){e(i,s,t)}};function ug(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Gu(t,t,[n+o,r+l,a+h]),Gu(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),Gu(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]),f){const i=Zu.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]}Gu(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),Gu(i,i,[-s[0],-s[1],0]),$u(t,t,i)}}let pg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Po(t);return Zo(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=lg(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=og(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){_u(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;_u(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};pg=hg([Ya(),dg(0,Wa(Hu)),cg("design:paramtypes",[Object])],pg);const gg=(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},fg=["radius","startAngle","endAngle",...yp];class mg extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Cu}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 wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.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>Vt-Ft?i.set(-r,-r,r,r):Kc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,fg)}needUpdateTag(t){return super.needUpdateTag(t,fg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new zl,s.arc(0,0,r,a,o),s}clone(){return new mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mg.NOWORK_ANIMATE_ATTR}}function vg(t){return new mg(t)}mg.NOWORK_ANIMATE_ATTR=kp;class _g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=To.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=zu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new bg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=vo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){_u(n,o/Math.abs(r+a),!0,l),i.union(n)}return vo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=vo.graphicUtil.textMeasure,S=new _g(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:_=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),A=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const k=vo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:A},T=new _g(r,M,k),w=y(t)?t.map((t=>t.toString())):[t.toString()],C=[],E=[0,0];let B=1/0;if(_>0&&(B=Math.max(Math.floor(_/A),1)),b&&(B=Math.min(B,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const t=og(v,r),e=this.cache.verticalList.length*m,i=lg(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===xu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const b=og(v,r),x=this.cache.verticalList.length*m,S=lg(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ed(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=yg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=yg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return bg.baselineMapAlign}getAlignMapBaseline(){return bg.alignMapBaseline}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),bg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Sg=["symbolType","size",...yp];let Ag=class t extends Mp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Fu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=vo.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;_u(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return vo.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,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new zl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new zl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Mg=["segments","points","curveType","curveTension",...yp];let Tg=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=Zc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new zl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Cg=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}},Eg=["width","x1","y1","height","cornerRadius",...yp];class Bg extends Mp{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Cg(e);return t=new zl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Lg extends Mp{constructor(t){super(t),this.type="glyph",this.numberType=Eu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=kp;class Og{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=gh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Dg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ed(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=kh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=kh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=xh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=kh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Fg=["width","height","image",...yp];class zg extends Mp{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return lh[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}clone(){return new zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function jg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class Hg extends zg{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=Yc(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=Yc(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=lh.width,height:e=lh.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 Vg{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 Hg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Dg){const e=yh.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 Hg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=kh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)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||mh;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,bh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||fh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ph(t,s,{AABBBounds:i}):s,bh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Hg)break;const{width:n}=kh(t,s.character,s.ascentDescentMode),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 Hg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ng{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=gh[this.direction]}store(t){if(t instanceof Hg){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 Vg(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,e=!1){t instanceof Hg?"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||this.newLine)&&("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=xh(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 Dg(i,t.newLine,t.character,t.ascentDescentMode),new Dg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ug=!1;try{Ug=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ug=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...yp];class Gg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Du,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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1)))}static splitText(t){if(Ug){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Gg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),vo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Gg.AllSingleCharacter(_)&&(_=Gg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Og(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ng(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Gg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Gg.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const $g=["path","customPath",...yp];class Xg extends Mp{constructor(t){super(t),this.type="path",this.numberType=Ru}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 zl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof zl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return vo.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 zl).fromString(t.path):t.customPath&&(this.cache=new zl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){return(new zl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const qg=["segments","points","curveType","curveTension",...yp];class Zg extends Mp{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new zl;const 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 Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...yp];class tf extends Mp{constructor(t){super(t),this.type="arc",this.numberType=Mu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 wc(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}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return vo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(Kc(l,o,s,i),Kc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const sf=["points","cornerRadius",...yp];class nf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new zl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=kp;class af extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function of(t){return new af(t)}const lf=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 hf,cf;function df(t){return hf||(hf=lf.CreateGraphic("text",{})),hf.initAttributes(t),hf.AABBBounds}var uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gf=function(t,e){return function(i,s){e(i,s,t)}};class ff{constructor(){this.time=$o.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=lc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),lc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const mf=new ff;let vf=class{constructor(t){this.subRenderContribitions=t,this.time=$o.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)}))}};vf=uf([Ya(),gf(0,Wa(lo)),gf(0,$a(ag)),pf("design:paramtypes",[Object])],vf);const _f=new class{constructor(){this.time=$o.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const yf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class bf{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=lc.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])),lc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=lc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:uh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Kp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Af=xf,kf=mf;const Mf=new class{constructor(){this.time=$o.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{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:uh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Tf=xf,wf=mf;const Cf=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Ef=zt/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ef,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ef,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Ef,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Ef,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lf{constructor(){this.time=$o.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,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:uh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Bf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Rf=class{constructor(){this.time=$o.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)}};Rf=Pf([Ya()],Rf);let Of=class{constructor(){this.time=$o.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,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Bf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ya()],Of);const If=new Lf,Df=xf,Ff=mf;const zf=new class extends Lf{constructor(){super(...arguments),this.time=$o.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)}},jf=mf;const Hf=new class{constructor(){this.time=$o.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:_=l.opacity,x:y=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:uh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Vf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Nf=xf,Uf=mf;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Gf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(_f),this.builtinContributions.push(yf),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===$o.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===$o.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Up(d,u,h),y=Gp(d,g),b=Vp(h),x=Np(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Zo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Up(o,l,n),p=Gp(o,c),g=Vp(n,r),f=Np(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Zu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Zu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[Sf,kf,Af],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=$p(v,_,f,m,n,t,Number(u)),o=$p(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=$p(M,T,A,k,r,-n,Number(u)),o=$p(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(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(),Kp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Kp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),lp(o.color,l.color,h,!1)}(0,0,h,n);a||Up&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Kf=Yf([Ya(),Xf(0,Wa(lo)),Xf(0,$a(qp)),$f("design:paramtypes",[Object])],Kf);var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jf=function(t,e){return function(i,s){e(i,s,t)}};let Qf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,wf,Tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function tm(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]=nl(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 em(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 im(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=em(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),tm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Go.ROW:"y"===s?u=Go.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 nm=class extends Gf{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();im(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Fl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function rm(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),tm(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),tm(t,l,1,s),o=!1):o=!0}t.closePath()}nm=sm([Ya()],nm);const am=new class extends bf{constructor(){super(...arguments),this.time=$o.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Jc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Jc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},om=mf;var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let dm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[am,om],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=Fl(B(t.points,x),E,{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=Fl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Fl(e,E,{curveTension:b}),n=Fl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Go.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?Go.ROW:null==_.y1?Go.COLUMN:Number.isFinite(S+A)?S>A?Go.ROW:Go.COLUMN:Go.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Go.ROW:Go.COLUMN,Number.isFinite(c)||(o=Go.COLUMN),Number.isFinite(d)||(o=Go.ROW);const u=i*(o===Go.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),im(t,i[0]?e.top:e.bottom,l,x===Go.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};dm=lm([Ya(),cm(0,Wa(lo)),cm(0,$a(Zp)),hm("design:paramtypes",[Object])],dm);const um=xf,pm=mf;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},fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mm=function(t,e){return function(i,s){e(i,s,t)}};let vm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[pm,um],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zo(t.pathShape.commandList,e,i,s,1,1,f);else{Zo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};vm=gm([Ya(),mm(0,Wa(lo)),mm(0,$a(eg)),fm("design:paramtypes",[Object])],vm);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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Wp(g,f,T,w,h),E=Yp(g,v,T,w,M),B=Vp(h,c),P=Np(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Bf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};xm=_m([Ya(),bm(0,Wa(lo)),bm(0,$a(sg)),ym("design:paramtypes",[Object])],xm);var Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Mm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Hf,Uf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Mm=Sm([Ya(),km(0,Wa(lo)),km(0,$a(ng)),Am("design:paramtypes",[Object])],Mm);const Tm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Tm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=df(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Bf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Tm.free(E),C()}};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},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ed(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),qu.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:og(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jm=function(t,e){return function(i,s){e(i,s,t)}};let Hm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),A=Om(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Rm(k,M),w=Om(h,Rm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Hm=Fm([Ya(),jm(0,Wa(lo)),jm(0,$a(ig)),zm("design:paramtypes",[Object])],Hm);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},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Wp(p,m,g,f,c),C=Yp(p,v,g,f),E=Vp(c,u),B=Np(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===$o.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===$o.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=vo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(i,p||i,n),a.modelMatrix=i,Zu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Zu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Vm([Ya(),Um(0,Wa(lo)),Um(0,$a(Qp)),Nm("design:paramtypes",[Object])],Wm);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)},$m=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let Km=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[zf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Bf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Vc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};Km=Gm([Ya(),$m(0,Wa(lo)),$m(0,$a(tg)),Ym("design:paramtypes",[Object])],Km);const qm=Symbol.for("IncrementalDrawContribution"),Zm=Symbol.for("ArcRender"),Jm=Symbol.for("AreaRender"),Qm=Symbol.for("CircleRender"),tv=Symbol.for("GraphicRender"),ev=Symbol.for("GroupRender"),iv=Symbol.for("LineRender"),sv=Symbol.for("PathRender"),nv=Symbol.for("PolygonRender"),rv=Symbol.for("RectRender"),av=Symbol.for("SymbolRender"),ov=Symbol.for("TextRender"),lv=Symbol.for("RichTextRender"),hv=Symbol.for("GlyphRender"),cv=Symbol.for("ImageRender"),dv=Symbol.for("DrawContribution"),uv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Tu,!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+=Vt;for(;o<0;)o+=Vt;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 pv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fv=Symbol.for("DrawItemInterceptor"),mv=new Ve,vv=new Ve;class _v{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){mv.copy(s.dirtyBounds),vv.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,qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(mv),s.backupDirtyBounds.copy(vv)),!0}}class yv{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 bv=class{constructor(){this.order=1,this.interceptors=[new _v,new Sv,new xv,new yv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Zu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,s){e(i,s,t)}};const Tv=Symbol.for("RenderService");let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=Av([Ya(),Mv(0,Wa(dv)),kv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(Tv).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=qu.allocateByObj(a),u=new ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=uv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(ju).to(pg),t(Hu).toConstantValue(lf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&Bh.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Ch).to(Eh).inSingletonScope(),co(t,Ch)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=vo.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=Rh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Rp).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,Xl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=vo.global,this.layerService=vo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,Xl.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Tm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Tm.free(n),qu.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||Bh.get(qm);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 h_=class extends nm{constructor(){super(...arguments),this.numberType=Lu}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=wc(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=Up(u,p,c),_=Gp(u,g),y=Vp(c),b=Np(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends dm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Up(u,d,c),f=Vp(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,Xl.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,Xl.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(tv)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(fv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(ff).toSelf().inSingletonScope(),t(bf).toSelf().inSingletonScope(),t(dv).to(o_),t(qm).to(v_),t(ev).to(Wm).inSingletonScope(),t(tv).toService(ev),co(t,Qp),t(vf).toSelf().inSingletonScope(),co(t,ag),co(t,tv),t(bv).toSelf().inSingletonScope(),t(fv).toService(bv),co(t,fv)}));function y_(){y_.__loaded||(y_.__loaded=!0,Bh.load(Hp),Bh.load(jv),Bh.load(Cv),Bh.load(zv),Bh.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(Bh),function(t){t.load(__)}(Bh))}y_.__loaded=!1,y_();const b_=Bh.get(mo);vo.global=b_;const x_=Bh.get(Pp);vo.graphicUtil=x_;const S_=Bh.get(Bp);vo.transformUtil=S_;const A_=Bh.get(ju);vo.graphicService=A_;const k_=Bh.get(Tv);vo.renderService=k_;const M_=Bh.get(Lp);vo.layerService=M_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class w_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=vo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vo.global.getRequestAnimationFrame();this.rafId=t((()=>{vo.global.devicePixelRatio!==this.dpr&&(this.dpr=vo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=vo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class C_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vo.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 E_=new Ve;class B_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let P_;function L_(){!function(){if(null==P_)try{const t=document.createElement("canvas"),e=t.getContext("2d");P_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),P_&&(P_=!!document.createElement)}catch(t){P_=!1}}();const t=vo.global&&vo.global.env;return t?"browser"===t:P_}let R_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};R_._pluginClasses={};const O_="white";class I_ extends wp{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:O_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Mc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=vo.global,!this.global.env&&L_()&&this.global.setEnv("browser"),this.window=Bh.get(dc),this.renderService=Bh.get(Tv),this.pluginService=Bh.get(Vv),this.layerService=Bh.get(Lp),this.graphicService=Bh.get(ju),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:O_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Hc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=R_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=R_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=R_.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 T_))}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 w_))}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 C_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new B_,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=R_.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=R_.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=R_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Bh.get(dc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Bh.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var D_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},F_=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 z_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return F_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};z_=D_([Ya()],z_);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},H_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let V_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};V_=j_([Ya(),H_("design:paramtypes",[])],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},W_=function(t,e){return function(i,s){e(i,s,t)}};let G_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=vo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=wc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&Zu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function Y_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Q_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ny=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ry=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ny(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ny(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ry(n[0],s,i),ry(n[1],e-s,i)}};let ay=!1;const oy=new Ra((t=>{ay||(ay=!0,t(Kf).toSelf().inSingletonScope(),t(Zm).to(Kf).inSingletonScope(),t(tv).toService(Zm),t(qp).toService(vf),co(t,qp))}));let ly=!1;const hy=new Ra((t=>{ly||(ly=!0,t(xm).toSelf().inSingletonScope(),t(rv).to(xm).inSingletonScope(),t(tv).toService(rv),t(Of).toSelf(),t(Rf).toSelf(),t(sg).toService(Of),t(sg).toService(Rf),t(sg).toService(vf),co(t,sg))}));let cy=!1;const dy=new Ra((t=>{cy||(cy=!0,t(nm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(iv).to(nm).inSingletonScope(),t(tv).toService(iv))}));let uy=!1;const py=new Ra((t=>{uy||(uy=!0,t(dm).toSelf().inSingletonScope(),t(Jm).to(dm).inSingletonScope(),t(tv).toService(Jm),t(Zp).toService(vf),co(t,Zp),t(d_).toSelf().inSingletonScope())}));let gy=!1;const fy=new Ra((t=>{gy||(gy=!0,t(Mm).toSelf().inSingletonScope(),t(av).to(Mm).inSingletonScope(),t(tv).toService(av),t(ng).toService(vf),co(t,ng))}));let my=!1;const vy=new Ra((t=>{my||(my=!0,t(Qf).toSelf().inSingletonScope(),t(Qm).to(Qf).inSingletonScope(),t(tv).toService(Qm),t(Jp).toService(vf),co(t,Jp))}));let _y=!1;const yy=new Ra((t=>{_y||(_y=!0,t(ov).to(Pm).inSingletonScope(),t(tv).toService(ov),t(rg).toService(vf),co(t,rg))}));let by=!1;const xy=new Ra((t=>{by||(by=!0,t(vm).toSelf().inSingletonScope(),t(sv).to(vm).inSingletonScope(),t(tv).toService(sv),t(eg).toService(vf),co(t,eg))}));let Sy=!1;const Ay=new Ra((t=>{Sy||(Sy=!0,t(nv).to(Hm).inSingletonScope(),t(tv).toService(nv),t(ig).toService(vf),co(t,ig))}));var ky=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 My=class{constructor(){this.numberType=Eu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};My=ky([Ya()],My);let Ty=!1;const wy=new Ra((t=>{Ty||(Ty=!0,t(hv).to(My).inSingletonScope(),t(tv).toService(hv))}));var Cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let By=class extends Gf{constructor(){super(),this.numberType=Du,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Up(o,l,!0),d=Up(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};By=Cy([Ya(),Ey("design:paramtypes",[])],By);let Py=!1;const Ly=new Ra((t=>{Py||(Py=!0,t(lv).to(By).inSingletonScope(),t(tv).toService(lv))}));let Ry=!1;const Oy=new Ra((t=>{Ry||(Ry=!0,t(cv).to(Km).inSingletonScope(),t(tv).toService(cv),t(tg).toService(vf),co(t,tg))}));function Iy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),zy=(t,e)=>(d(Hy.warnHandler)&&Hy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),jy=(t,e,i)=>{if(!d(Hy.errorHandler))throw new Error(t);Hy.errorHandler.call(null,t,e)},Hy={silent:!1,warnHandler:!1,errorHandler:!1},Vy=L_(),Ny=Vy&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Vy}function Wy(t){return Gy(t)||"mobile-browser"===t}function Gy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Yy=0;function $y(){return Yy>=9999999&&(Yy=0),Yy++}function Xy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Ky(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Zy extends wp{constructor(t,e){super(t),this._skipRenderAttributes=qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},Mb=(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 Tb extends l{constructor(t,e={}){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.startTime=Ic.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=Ic.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||kb(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=Mb(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=Ic.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=Mb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=kb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Mb(s[0],t){vo.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){if(!this.element)return;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},Cb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Bb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Nl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Wl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Gl),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 qu.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&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&mp.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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=vo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Gl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Gl.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&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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=ph(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:uh(this,a,this.dpr),r.strokeStyle=ph(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};Bb.env="browser",Bb=wb([Ya(),Cb("design:paramtypes",[Object,Number])],Bb);var Pb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rb=class extends np{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Bb(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 Ob(t,e){return new Ra((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Rb.env="browser",Rb=Pb([Ya(),Lb("design:paramtypes",[Object])],Rb);const Ib=Ob(Rb,Bb);var Db=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},zb=function(t,e){return function(i,s){e(i,s,t)}};let jb=class extends G_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=lc.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 Vb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};Vb=Hb([Ya()],Vb);const Nb=new Ra(((t,e,i,s)=>{Nb.__vloaded||(Nb.__vloaded=!0,t(Sb).to(Vb).inSingletonScope(),t(Ab).toService(Sb),co(t,Ab))}));Nb.__vloaded=!1;var Ub=Nb;const Wb=new Ra(((t,e,i,s)=>{i(jb)||t(jb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(jb):t(Ev).toService(jb)}));var Gb,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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=Gb=class extends V_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Gb.idprefix}_${Gb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Gb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Rb(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 Rb({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)}};Xb.env="browser",Xb.idprefix="visactor_window",Xb.prefix_count=0,Xb=Gb=Yb([Ya(),$b("design:paramtypes",[])],Xb);const Kb=new Ra((t=>{t(Xb).toSelf(),t(uc).toDynamicValue((t=>t.container.get(Xb))).whenTargetNamed(Xb.env)}));var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Jb=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 Qb{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 tx(t,e=!1){const i=document.createElement("img");if(vo.global.isImageAnonymous&&(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 ex=class extends z_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Qb(t)}return new Ve}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 tx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return tx(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:La.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(...t){}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}}loadFont(t,e,i){return Jb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ex=qb([Ya(),Zb("design:paramtypes",[])],ex);const ix=new Ra((t=>{ix.isBrowserBound||(ix.isBrowserBound=!0,t(ex).toSelf().inSingletonScope(),t(fo).toService(ex))}));function sx(t,e=!0){sx.__loaded||(sx.__loaded=!0,t.load(ix),t.load(Ib),t.load(Kb),e&&function(t){t.load(Ub),t.load(Wb)}(t))}ix.isBrowserBound=!1,sx.__loaded=!1;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};let rx=class extends Bb{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}};rx.env="feishu",rx=nx([Ya()],rx);var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=class extends np{constructor(t){super(t)}init(){this._context=new rx(this,this._dpr)}release(...t){}};lx.env="feishu",lx=ax([Ya(),ox("design:paramtypes",[Object])],lx);const hx=Ob(lx,rx);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)}};class px{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 gx=class extends V_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new px}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lx(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 lx({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()}};gx.env="feishu",gx=cx([Ya(),ux(0,Wa(mo)),dx("design:paramtypes",[Object])],gx);const fx=new Ra((t=>{t(gx).toSelf(),t(uc).toDynamicValue((t=>t.container.get(gx))).whenTargetNamed(gx.env)}));var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends G_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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}};yx=mx([Ya(),_x(0,Wa(lo)),_x(0,$a(Jy)),_x(1,Wa(lo)),_x(1,$a(Pv)),_x(2,Wa(lo)),_x(2,$a(Lv)),vx("design:paramtypes",[Object,Object,Object])],yx);const bx=new Ra((t=>{bx.__vloaded||(bx.__vloaded=!0,co(t,Jy))}));bx.__vloaded=!1;var xx=bx;class Sx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:uh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};Tx=Ax([Ya(),Mx(0,Wa(Zm)),kx("design:paramtypes",[Object])],Tx);let wx=!1;const Cx=new Ra(((t,e,i,s)=>{wx||(wx=!0,t(Qy).to(Tx).inSingletonScope(),t(Jy).toService(Qy))}));var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Lx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};Lx=Ex([Ya(),Px(0,Wa(Jm)),Bx("design:paramtypes",[Object])],Lx);let Rx=!1;const Ox=new Ra(((t,e,i,s)=>{Rx||(Rx=!0,t(tb).to(Lx).inSingletonScope(),t(Jy).toService(tb))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let zx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};zx=Ix([Ya(),Fx(0,Wa(Qm)),Dx("design:paramtypes",[Object])],zx);let jx=!1;const Hx=new Ra(((t,e,i,s)=>{jx||(jx=!0,t(eb).to(zx).inSingletonScope(),t(Jy).toService(eb))}));class Vx{constructor(){this.type="glyph",this.numberType=Eu}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 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},Ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};Gx=Nx([Ya(),Wx(0,Wa(hv)),Ux("design:paramtypes",[Object])],Gx);let Yx=!1;const $x=new Ra(((t,e,i,s)=>{Yx||(Yx=!0,t(hb).to(Gx).inSingletonScope(),t(Gx).toService(hb))}));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};let Kx=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kx=Xx([Ya()],Kx);let qx=!1;const Zx=new Ra(((t,e,i,s)=>{qx||(qx=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};eS=Jx([Ya(),tS(0,Wa(iv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new Ra(((t,e,i,s)=>{iS||(iS=!0,t(sb).to(eS).inSingletonScope(),t(Jy).toService(sb))}));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},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};oS=nS([Ya(),aS(0,Wa(nv)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new Ra(((t,e,i,s)=>{lS||(lS=!0,t(lb).to(oS).inSingletonScope(),t(Jy).toService(lb))}));var cS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uS=function(t,e){return function(i,s){e(i,s,t)}};let pS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};pS=cS([Ya(),uS(0,Wa(sv)),dS("design:paramtypes",[Object])],pS);let gS=!1;const fS=new Ra(((t,e,i,s)=>{gS||(gS=!0,t(nb).to(pS).inSingletonScope(),t(Jy).toService(nb))})),mS=new Ve;class vS{constructor(){this.type="rect",this.numberType=Iu}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:uh(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;mS.setValue(i.x1,i.y1,i.x2,i.y2),mS.expand(-r/2),h=!mS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends vS{constructor(t){super(),this.canvasRenderer=t}};xS=_S([Ya(),bS(0,Wa(rv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Ra(((t,e,i,s)=>{SS||(SS=!0,t(rb).to(xS).inSingletonScope(),t(Jy).toService(rb))}));let kS=!1;const MS=new Ra(((t,e,i,s)=>{kS||(kS=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));var TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CS=function(t,e){return function(i,s){e(i,s,t)}};let ES=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}};ES=TS([Ya(),CS(0,Wa(av)),wS("design:paramtypes",[Object])],ES);let BS=!1;const PS=new Ra(((t,e,i,s)=>{BS||(BS=!0,t(ab).to(ES).inSingletonScope(),t(Jy).toService(ab))}));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 RS=class{constructor(){this.type="text",this.numberType=zu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RS=LS([Ya()],RS);let OS=!1;const IS=new Ra(((t,e,i,s)=>{OS||(OS=!0,t(ob).to(RS).inSingletonScope(),t(Jy).toService(ob))})),DS=new Ra(((t,e,i,s)=>{i(yx)||t(yx).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(yx):t(Ev).toService(yx)}));class FS{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 zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HS=class extends z_{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 FS(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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};HS=zS([Ya(),jS("design:paramtypes",[])],HS);const VS=new Ra((t=>{VS.isFeishuBound||(VS.isFeishuBound=!0,t(HS).toSelf().inSingletonScope(),t(fo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(hx),t.load(fx),e&&function(t){t.load(xx),t.load(DS),t.load(Cx),t.load(Ox),t.load(Hx),t.load($x),t.load(Zx),t.load(sS),t.load(hS),t.load(fS),t.load(AS),t.load(MS),t.load(PS),t.load(IS)}(t))}VS.isFeishuBound=!1,NS.__loaded=!1;var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GS=class extends Bb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};GS.env="node",GS=US([Ya(),WS("design:paramtypes",[Object,Number])],GS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends np{constructor(t){super(t)}init(){this._context=new GS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};XS.env="node",XS=YS([Ya(),$S("design:paramtypes",[Object])],XS);const KS=Ob(XS,GS);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},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JS=function(t,e){return function(i,s){e(i,s,t)}};let QS=class extends V_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new XS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new XS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};QS.env="node",QS=qS([Ya(),JS(0,Wa(mo)),ZS("design:paramtypes",[Object])],QS);const tA=new Ra((t=>{t(QS).toSelf(),t(uc).toDynamicValue((t=>t.container.get(QS))).whenTargetNamed(QS.env)}));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};let iA=class extends z_{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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};iA=eA([Ya()],iA);const sA=new Ra((t=>{sA.isNodeBound||(sA.isNodeBound=!0,t(iA).toSelf().inSingletonScope(),t(fo).toService(iA))}));function nA(t,e=!0){nA.__loaded||(nA.__loaded=!0,t.load(sA),t.load(KS),t.load(tA))}sA.isNodeBound=!1,nA.__loaded=!1;var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};lA=rA([Ya(),oA(0,Wa(Zm)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new Ra(((t,e,i,s)=>{hA||(hA=!0,t(cb).to(lA).inSingletonScope(),t(Ab).toService(cb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class extends vS{constructor(t){super(),this.canvasRenderer=t}};gA=dA([Ya(),pA(0,Wa(rv)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new Ra(((t,e,i,s)=>{fA||(fA=!0,t(mb).to(gA).inSingletonScope(),t(Ab).toService(mb))}));class vA extends Gf{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:uh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};xA=_A([Ya(),bA(0,Wa(iv)),yA("design:paramtypes",[Object])],xA);let SA=!1;const AA=new Ra(((t,e,i,s)=>{SA||(SA=!0,t(gb).to(xA).inSingletonScope(),t(Ab).toService(gb))}));var kA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let wA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};wA=kA([Ya(),TA(0,Wa(Jm)),MA("design:paramtypes",[Object])],wA);let CA=!1;const EA=new Ra(((t,e,i,s)=>{CA||(CA=!0,t(db).to(wA).inSingletonScope(),t(Ab).toService(db))}));class BA extends Gf{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&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}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:uh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Zu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};OA=PA([Ya(),RA(0,Wa(av)),LA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new Ra(((t,e,i,s)=>{IA||(IA=!0,t(vb).to(OA).inSingletonScope(),t(Ab).toService(vb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jA=function(t,e){return function(i,s){e(i,s,t)}};let HA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};HA=FA([Ya(),jA(0,Wa(Qm)),zA("design:paramtypes",[Object])],HA);let VA=!1;const NA=new Ra(((t,e,i,s)=>{VA||(VA=!0,t(ub).to(HA).inSingletonScope(),t(Ab).toService(ub))}));var UA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,s){e(i,s,t)}};let YA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=zu}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=lg(a,u,n),v=og(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&&Zu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};YA=UA([Ya(),GA(0,Wa(ov)),WA("design:paramtypes",[Object])],YA);let $A=!1;const XA=new Ra(((t,e,i,s)=>{$A||($A=!0,t(_b).to(YA).inSingletonScope(),t(Ab).toService(_b))}));var KA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ZA=function(t,e){return function(i,s){e(i,s,t)}};let JA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};JA=KA([Ya(),ZA(0,Wa(sv)),qA("design:paramtypes",[Object])],JA);let QA=!1;const tk=new Ra(((t,e,i,s)=>{QA||(QA=!0,t(fb).to(JA).inSingletonScope(),t(Ab).toService(fb))}));var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sk=function(t,e){return function(i,s){e(i,s,t)}};let nk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};nk=ek([Ya(),sk(0,Wa(nv)),ik("design:paramtypes",[Object])],nk);let rk=!1;const ak=new Ra(((t,e,i,s)=>{rk||(rk=!0,t(yb).to(nk).inSingletonScope(),t(Ab).toService(yb))}));var ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hk=function(t,e){return function(i,s){e(i,s,t)}};let ck=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};ck=ok([Ya(),hk(0,Wa(hv)),lk("design:paramtypes",[Object])],ck);let dk=!1;const uk=new Ra(((t,e,i,s)=>{dk||(dk=!0,t(xb).to(ck).inSingletonScope(),t(Ab).toService(xb))}));var pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mk=pk([Ya(),fk(0,Wa(lv)),gk("design:paramtypes",[Object])],mk);let vk=!1;const _k=new Ra(((t,e,i,s)=>{vk||(vk=!0,t(bb).to(mk).inSingletonScope(),t(Ab).toService(bb))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};Sk=yk([Ya(),xk(0,Wa(cv)),bk("design:paramtypes",[Object])],Sk);let Ak=!1;const kk=new Ra(((t,e,i,s)=>{Ak||(Ak=!0,t(pb).to(Sk).inSingletonScope(),t(Ab).toService(pb))})),Mk=L_();function Tk(){Tk.__loaded||(Tk.__loaded=!0,lf.RegisterGraphicCreator("arc",ef),Bh.load(oy),Bh.load(Mk?cA:Cx))}Tk.__loaded=!1;const wk=Tk;function Ck(){Ck.__loaded||(Ck.__loaded=!0,lf.RegisterGraphicCreator("area",Jg),Bh.load(py),Bh.load(Mk?EA:Ox))}Ck.__loaded=!1;const Ek=Ck;function Bk(){Bk.__loaded||(Bk.__loaded=!0,lf.RegisterGraphicCreator("circle",vg),Bh.load(vy),Bh.load(Mk?NA:Hx))}Bk.__loaded=!1;const Pk=Bk;function Lk(){Lk.__loaded||(Lk.__loaded=!0,lf.RegisterGraphicCreator("glyph",Rg),Bh.load(wy),Bh.load(Mk?uk:$x))}Lk.__loaded=!1;const Rk=Lk;function Ok(){Ok.__loaded||(Ok.__loaded=!0,lf.RegisterGraphicCreator("group",Cp))}Ok.__loaded=!1;const Ik=Ok;function Dk(){Dk.__loaded||(Dk.__loaded=!0,lf.RegisterGraphicCreator("image",jg),Bh.load(Oy),Bh.load(Mk?kk:Zx))}Dk.__loaded=!1;const Fk=Dk;function zk(){zk.__loaded||(zk.__loaded=!0,lf.RegisterGraphicCreator("line",wg),Bh.load(dy),Bh.load(Mk?AA:sS))}zk.__loaded=!1;const jk=zk;function Hk(){Hk.__loaded||(Hk.__loaded=!0,lf.RegisterGraphicCreator("path",Kg),Bh.load(xy),Bh.load(Mk?tk:fS))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,lf.RegisterGraphicCreator("polygon",rf),Bh.load(Ay),Bh.load(Mk?ak:hS))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,lf.RegisterGraphicCreator("rect",Pg),Bh.load(hy),Bh.load(Mk?mA:AS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,lf.RegisterGraphicCreator("richtext",Yg),Bh.load(Ly),Bh.load(Mk?_k:MS))}Yk.__loaded=!1;const $k=Yk;function Xk(){Xk.__loaded||(Xk.__loaded=!0,lf.RegisterGraphicCreator("shadowRoot",of))}Xk.__loaded=!1;const Kk=Xk;function qk(){qk.__loaded||(qk.__loaded=!0,lf.RegisterGraphicCreator("symbol",kg),Bh.load(fy),Bh.load(Mk?DA:PS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,lf.RegisterGraphicCreator("text",xg),Bh.load(yy),Bh.load(Mk?XA:IS))}Jk.__loaded=!1;const Qk=Jk;function tM(){Ik(),Gk()}const eM=-.5*Math.PI,iM=1.5*Math.PI,sM="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 nM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nM||(nM={}));const rM={[nM.selectedReverse]:{},[nM.selected]:{},[nM.hover]:{},[nM.hoverReverse]:{}},aM={container:"",width:30,height:30,style:{}},oM="scrollDrag";function lM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const hM={debounce:xt,throttle:St};tM();let cM=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=lM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:hM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(oM,{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",hM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};cM.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};var dM,uM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 pM=dM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=dM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(oM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new cM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(pM)||(t(pM).toSelf(),t(Hv).toService(pM))}));function fM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&fM(t,e)}))}const mM=t=>!u(t)&&!1!==t.visible;function vM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function _M(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 bM=["#ffffff","#000000"];function xM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return SM(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(...bM);for(const n of a)if(t!==n&&SM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function SM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=kM(t),s=kM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function kM(t){const e=si(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 MM(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 TM(t,e){return[t[0]*e,t[1]*e]}function wM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function CM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:sM,fontSize:14},s),getTextBounds:i?void 0:df,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function BM(t,e,i={}){if(!t)return{width:0,height:0};const s=df({text:t,fontFamily:e.fontFamily||i.fontFamily||sM,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 PM(t,e="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 LM(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 RM(t,e="type"){const i=PM(t,e);return"rich"===i?lf.richtext(LM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),lf.text(t))}function OM(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 IM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function DM(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 FM(t,e){const{dx:i,dy:s}=DM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function zM(){Ik(),Gk(),Zk(),$k(),Qk()}var jM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=jM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new zl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},HM.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))}}HM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const VM={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}},NM={poptip:j({},VM)};var UM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}qM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{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={};j(s,qM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new qM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,NM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};JM=ZM([Ya()],JM);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};class tT{constructor(){this.activeEvent="onRegister",this._uid=La.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 eT=class extends tT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};eT=QM([Ya()],eT);let iT=class extends tT{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)}};iT=QM([Ya()],iT);const sT=new Ra(((t,e,i,s)=>{i(JM)||(t(JM).toSelf().inSingletonScope(),t(ag).toService(JM)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT)),i(iT)||(t(iT).toSelf(),t(Hv).toService(iT))}));class nT extends Zy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ik(),jk();class rT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ik(),Gk();class aT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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})}}aT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ik(),wk();class oT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}oT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ik(),wk();class lT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=eM,endAngle:s=iM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}lT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ik(),Vk();class hT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function cT(){Ik(),jk(),Uk(),Zk()}function dT(){Ik(),jk(),wk(),Zk()}hT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cT();class uT extends Zy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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(k(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=lf.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),P(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=lf.line;Y(i)[0].cornerRadius&&(t=lf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=lf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}uT.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}}},dT();class pT extends uT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=lf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var gT,fT;!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"}(gT||(gT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fT||(fT={}));const mT={[fT.selectedReverse]:{},[fT.selected]:{},[fT.hover]:{},[fT.hoverReverse]:{}},vT={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}}},_T={size:8,stroke:"#000",lineWidth:1,zIndex:1};const yT=Math.sin(Math.PI/10);function bT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function xT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function ST(t){const e={};return fM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function AT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function kT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/wM(r))}function MT(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 wT(t,e,i){var s;if(xT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function CT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(nM.hover,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.hoverReverse,!0)})),s):i},BT=(t,e,i)=>i?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),null):i,PT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(nM.selected)?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.selectedReverse),t.removeState(nM.selected))})),null):s.name&&!P(s.states)?(s.addState(nM.selected,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.selectedReverse,!0)})),s):i};class LT extends Zy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const RT={type:"default",duration:300,easing:"linear"};class OT extends LT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=ET(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=lf.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._prepare(),this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(RT)}_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=lf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=gT.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=lf.group({x:0,y:0,pickable:!1});t.name=gT.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=lf.group({x:0,y:0,pickable:!1});i.name=gT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=lf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=gT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=rM;else{const t=this.data[s],e=j({},rM,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=lf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=gT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=rM;else{const i=j({},rM,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=lf.group({x:0,y:0,pickable:!1});return r.name=`${gT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=RM(this._getLabelAttribute(t,e,n,i));if(a.name=gT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=rM;else{const s=j({},rM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new HM(Object.assign({},e));i.name=gT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return AT(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},vT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},fM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const IT={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&&wT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function DT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function FT(t,e,i,s,n=!1){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:IT[n]||IT.parity;if(s.length>=3&&CT(s,r)){do{s=a(s,r)}while(s.length>=3&&CT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);wT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),FT(l,s,n,(t=>wT(t,l,r))),FT(h,s,o,(t=>wT(t,h,r)||!(!n||t===l)&&wT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function jT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},NT(t,e.attribute.angle)),{angle:VT(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({},UT(t,e.attribute.angle)),{angle:VT(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 VT(t=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 NT(t,e=0){let 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=VT(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 UT(t,e=0){let 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=VT(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 WT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=xT(h),m=bT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 GT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class YT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=wM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $T{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-$T.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$T.bounceIn(2*t):.5*$T.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){$T[t]=e}}function XT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$T.quadIn=$T.getPowIn(2),$T.quadOut=$T.getPowOut(2),$T.quadInOut=$T.getPowInOut(2),$T.cubicIn=$T.getPowIn(3),$T.cubicOut=$T.getPowOut(3),$T.cubicInOut=$T.getPowInOut(3),$T.quartIn=$T.getPowIn(4),$T.quartOut=$T.getPowOut(4),$T.quartInOut=$T.getPowInOut(4),$T.quintIn=$T.getPowIn(5),$T.quintOut=$T.getPowOut(5),$T.quintInOut=$T.getPowInOut(5),$T.backIn=$T.getBackIn(1.7),$T.backOut=$T.getBackOut(1.7),$T.backInOut=$T.getBackInOut(1.7),$T.elasticIn=$T.getElasticIn(1,.3),$T.elasticOut=$T.getElasticOut(1,.3),$T.elasticInOut=$T.getElasticInOut(1,.3*1.5),$T.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$T.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$T.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$T[`flicker${t}`]=e=>XT(e,t);for(let t=2;t<10;t++)$T[`aIn${t}`]=e=>t*e*e+(1-t)*e;function KT(t,e,i){return t+(e-t)*i}const qT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=KT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=KT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=KT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=KT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=KT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=KT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=KT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=KT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=KT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=lp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?cp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=lp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?cp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=KT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=KT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=KT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=KT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=KT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=KT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=KT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Zc(e,i,s),r.addUpdateBoundTag()}}};function ZT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$T[s])&&void 0!==n?n:$T.linear:$T.linear,"wait"===t&&(this.onUpdate=JT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=JT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=ap.Get(i,rp.Color255),r=ap.Get(s,rp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(qT["fill"===e?"fillPure":"strokePure"])}else qT[e]?t.push(qT[e]):t.push(ZT)}else qT[e]?t.push(qT[e]):t.push(ZT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tw extends QT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class ew extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Eo.END?this.removeAnimate(t,!0):t.status!==Eo.RUNNING&&t.status!==Eo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const iw=new ew;iw.isGlobal=!0;class sw{constructor(t=La.GenAutoIncrementId(),e=iw,i){this.id=t,this.status=Eo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new QT(Co.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tw(Co.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new QT(Co.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Eo.RUNNING&&(this.status=Eo.PAUSED)}resume(){this.status===Eo.PAUSED&&(this.status=Eo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Eo.END&&this.onEnd(),this.status=Eo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Eo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Eo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Eo.END);this.status=Eo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const nw=new yo;class rw{constructor(){this.released=!1}tick(t,e){nw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class aw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wo.INITIAL,vo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),vo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new rw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wo.INITIAL&&(this.status=wo.PAUSE,!0)}resume(){return this.status!==wo.INITIAL&&(this.status=wo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}lw.getInstance();class hw{static registerBuiltInAnimate(t,e){hw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:hw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:hw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:hw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}hw.builtInAnimateMap={};const cw="appear",dw="disappear",uw="update",pw="highlight",gw="unhighlight";class fw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class mw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=lw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyDisappearState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyUpdateState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyHighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class vw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new mw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new fw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new vw)._getAnimationStateManager(t),t}}class _w{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new sw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:iw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new ew}createTicker(t){return new aw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new hw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function yw(){G(Mp,vw),G(Mp,_w)}class bw extends QT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class xw extends bw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Sw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new hw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Aw(t){return new Sw(t)}class kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Mw=1e3,Tw="quadInOut",ww=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Cw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=lp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ew=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?J_(t):[],n=J_(e);i&&s&&(i.fromTransform&&Q_(s,i.fromTransform.clone().getInverse()),Q_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Pw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Lw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Pw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?ap.Get(t,rp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Rw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ew(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Cw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Ow=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Bw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Lw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Rw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tw);return c.play(d),c};class Iw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ew(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Cw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Dw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ww.includes(t))(i)||(e[i]=t[i])})),e},Fw=(t,e,i)=>{const s=Dw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=vo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},zw=(t,e,i)=>{const s=[],n=i?null:Dw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Dw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Cg(t.attribute),n=ey(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(vo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ey(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ey(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return iy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return iy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(vo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:sy(i)}];const s=[];return ry(i,e,s),s})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ry(l,e,h),h})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=J_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(vo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Fw(t,s,e),s};class Hw extends bw{constructor(t,e,i,s,n){super(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(){super.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:Wo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Wo.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:Wo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vw extends Hw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=vo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Nw extends Hw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=vo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Uw extends bw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class $w extends Gw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Xw=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qw extends Kw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Xw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class Zw extends Kw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Jw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Qw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends xw{onBind(){var t;const e=Aw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class xC extends xw{onBind(){const t=Aw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function SC(){Ik(),jk(),$k(),Qk(),hw.registerBuiltInAnimate("axisEnter",bC),hw.registerBuiltInAnimate("axisUpdate",xC)}var AC=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=lf.group({zIndex:999});e.name=gT.axisBreak,e.id=this._getNodeId(`${gT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},_T,s),a=null!==(e=r.size)&&void 0!==e?e:_T.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=lf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=gT.axisBreakSymbol;const h=lf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=gT.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=lf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=gT.background,n.id=this._getNodeId("background"),n.states=j({},mT,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=AC(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];P(l)||(c.state={line:j({},mT,l),symbol:j({},mT,l)});const d=new uT(c);d.name=gT.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=AC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=CM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},mT,c.text),shape:j({},mT,c.shape),panel:j({},mT,c.background)}});return E.angle=w,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 NT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return UT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),HT(i,t),!jT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=xT(a),l=bT(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=GT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=GT(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);k(i)&&(c=Yt(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&&k(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);WT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&zT(t,{orient:o,method:m,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(k(c)&&(!k(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=lf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=gT.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=BM(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=ri(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}}kC.defaultAttributes=vT,G(kC,YT);class MC{isInValidValue(t){const{startAngle:e=eM,endAngle:i=iM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=eM,endAngle:i=iM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return kT(t,i,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 TC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=TC(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 EC=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),k(l)&&l>=3){const t=MT(n,l,c,e,i);h=lf.path(Object.assign(Object.assign({},a.style),{path:TT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=lf.circle(t)}h.name=gT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},mT,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=EC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},mT,d.text),shape:j({},mT,d.shape),panel:j({},mT,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}=TC(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&&wC(e,c,i)}else e.AABBBounds.width()>r&&wC(e,r,i)}else o>a.x&&h.x2>n.x2?(wC(e,n.x2-o,i),r&&CC(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}}BC.defaultAttributes=vT,G(BC,MC);const PC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},RC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{DC[t]=!0}));const VC=t=>-Math.log(-t),NC=t=>-Math.exp(-t),UC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,WC=t=>10===t?UC:t===Math.E?Math.exp:e=>Math.pow(t,e),GC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$C=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function XC(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function KC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function qC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function ZC(t,e,i,s){return 1===i&&(i=0),qC(t,i,s)*(e/(1-i))}function JC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function QC(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]{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 eE{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=JC(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 iE=Symbol("implicit");class sE extends eE{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=IC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iE}clone(){const t=(new sE).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!==iE)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 nE(t,e,r,n)}class aE extends sE{constructor(t){super(),this.type=IC.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=ZC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rE(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 aE(!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:oE}=ni;function lE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=oE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?oE(t,e):e instanceof ei?oE(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):At(Number(t),Number(e))}class hE extends eE{constructor(t=HC,e=HC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=HC,this._piecewise=KC,this._interpolate=lE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?QC:KC,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:HC),this.rescale(i)):this._clamp!==HC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 cE=Math.sqrt(50),dE=Math.sqrt(10),uE=Math.sqrt(2),pE=[1,2,5,10],gE=(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=_E(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?mE(0,-(e-1)/s,s):mE((e-1)/s,0,s)},fE=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 gE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gE(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=mE(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=mE(t,e,l);return n&&r.reverse(),r})),_E=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=pE[0];return i>=cE?s=pE[3]:i>=dE?s=pE[2]:i>=uE&&(s=pE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function yE(t,e,i){const s=(e-t)/Math.max(0,i);return _E(s)}function bE(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;e0;){if(s=yE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function SE(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 AE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),kE=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})),ME=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=vE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?AE(t,e,n):AE(t,e,tE(n)),h=AE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),TE=mt(((t,e,i,s,n)=>bE(s(t),s(e),i).map((t=>tE(n(t))))));class wE extends hE{constructor(){super(...arguments),this.type=IC.Linear}clone(){var t;const e=new wE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=vE(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(t=10){const e=this.calculateVisibleDomain(this._range);return bE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 EE(t){return e=>-t(-e)}function BE(t=Number.EPSILON){return e=>Math.max(e,t)}class PE extends hE{constructor(){super(GC(10),WC(10)),this.type=IC.Log,this._limit=BE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PE).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=GC(this._base),s=WC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=EE(i),this._pows=EE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=VC,this.untransformer=NC):(this._logs=i,this._pows=s,this._limit=BE(),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 HC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return kE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(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))))}}}G(PE,CE);class LE extends wE{constructor(){super(YC(1),$C(1)),this.type=IC.Symlog,this._const=1}clone(){return(new LE).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=YC(t),this.untransformer=$C(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return kE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(LE,CE);class RE{constructor(){this.type=IC.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)&&k(+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 RE).domain(this._domain).range(this._range).unknown(this._unknown)}}function OE(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 IE(t,e,i,s,n=!1){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,n,r;if(!FC(t.type))return PC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return PC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=OE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=OE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=OE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=OC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=OC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?FE.greedy:FE.parity;for(;l.length>=3&&CT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;wT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),IE(t,l,a,(e=>wT(e,t,i))),IE(n,l,o,(e=>wT(e,n,i)||!(!a||e===t)&&wT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return PC(m)},FE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&wT(i,t,e)||(i=t,0))))}},zE=(t,e,i,s)=>{const n=OC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},jE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,HE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?PC([s[s.length-1]]):PC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=zE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=NE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=zE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!jE(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?HE(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=EM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=AT(r,kT(s,r,e,n));return o=a,l=kT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 PC(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=UE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GE(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 PC(c)},GE=(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},YE=new Uint32Array(33),$E=new Uint32Array(33);$E[0]=0,YE[0]=~$E[0];for(let t=1;t<=32;++t)$E[t]=$E[t-1]<<1|1,YE[t]=~$E[t];function XE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&YE[31&o]&$E[1+(31&l)])return!0}else{if(i[h]&YE[31&o])return!0;if(i[c]&$E[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,YE[31&o]&$E[1+(31&l)]);else for(s(h,YE[31&o]),s(c,$E[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,$E[31&a]|YE[1+(31&o)]);else for(n(l,$E[31&a]),n(h,YE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 KE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function qE(t,e,i=!1){return i?KE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function ZE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=qE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=KE(t,r)),e.getRange(r)))}function JE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return JE(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 JE(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 JE(t,e,n,s,h,c)}return!1}const tB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],eB=["top","inside-top","inside"];function iB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const sB={mode:"same-time",duration:300,easing:"linear"};function nB(t){return 3===t||4===t}function rB(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 aB=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 oB(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)}}var lB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const dB=(t,e)=>Math.ceil(t)>Math.floor(e),uB=([t,e],[i,s])=>s>t&&e>i;function pB(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 gB=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||P(e.states)||(e.addState(nM.hover,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(fM(this,(t=>{P(t.states)||(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void fM(this,(t=>{P(t.states)||(t.removeState(nM.selectedReverse),t.removeState(nM.selected))}));P(e.states)||(e.addState(nM.selected,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.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)===Wo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Wo.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(Se(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[oB(g,f,c,d,a,o),oB(-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=lf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new zl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return RM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&dB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&dB(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(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(pB([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])&&!uB([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 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},h),{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(qE(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(qE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(qE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mB[t]=e};var _B=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{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,i,s)}}yB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const bB=()=>{vB("symbol",yB),vB("line-data",yB)};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);n{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}}}SB.tag="rect-label",SB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var AB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};kB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const MB=()=>{vB("line",kB),vB("area",kB)};var TB=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new wB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):nB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=nB(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=nB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=nB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?nB(t.quadrant)?"left":"right":nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 PB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 LB(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=TT(t,!!n),o=TT(r,!!n);const h=re.distancePP(s,l),c=re.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=PB(e,t,!1,!!n),o=PB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=TT(t,!!n),o=TT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}BB.defaultAttributes={pickable:!1};class RB extends Zy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.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 AT(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?`${gT.grid}-sub`:`${gT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=TT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=PB(t,o,!1,!!a)}const u=lf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RB.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=TT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=lf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:RB.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}}RB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ik(),Vk();class OB extends RB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RB.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=eM,endAngle:r=iM}=this.attribute;i=MT(t,s,re.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=j({},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})}}G(OB,YT);var IB=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"})}}G(DB,MC);const FB="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",zB={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:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},jB={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 HB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HB||(HB={}));var VB=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=HB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=lM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===HB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HB.endHandler):h+=l:this._activeTag===HB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=lM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===HB.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===HB.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=VB(c,["formatMethod"]),{formatMethod:g}=d,f=VB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},jB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},jB.horizontal),V),{pickable:!U&&(null===(b=V.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},jB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},jB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},jB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},jB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},jB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},jB.vertical),{pickable:!U}),"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 HM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var WB,GB,YB,$B;function XB(){Ik(),zM(),yw()}UB.defaultAttributes=zB,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"}(WB||(WB={})),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"}(GB||(GB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YB||(YB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($B||($B={}));class KB extends Zy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ET(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=lf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=lf.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=lf.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 qB(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 ZB(t,e,i,s){t&&(qB(t.startSymbol,e,i,s),t.lines.forEach((t=>qB(t,e,i,s))),qB(t.line,e,i,s),qB(t.endSymbol,e,i,s))}function JB(t,e,i,s){t&&(qB(t.getTextShape(),e,i,s),qB(t.getBgRect(),e,i,s))}function QB(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 tP(t,e,i,s){t&&(QB(t.startSymbol,e,i,s),t.lines.forEach((t=>QB(t,e,i,s))),QB(t.line,e,i,s),QB(t.endSymbol,e,i,s))}function eP(t,e,i,s){t&&(QB(t.getTextShape(),e,i,s),QB(t.getBgRect(),e,i,s))}function iP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qB(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)})),qB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;qB(t.getTextShape(),e,l,n),qB(t.getBgRect(),e,l,n)}))}function sP(t,e,i,s,n){ZB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function nP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function rP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function aP(t,e,i,s,n,r){var a;ZB(t,n,s,r),qB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JB(i,n,s,r):qB(i,n,s,r)}function oP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qB(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)})),qB(e,n+o+l,h,r),qB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qB(i.getTextShape(),n+o+l+h+c,d,r),qB(i.getBgRect(),n+o+l+c,d,r)):qB(i,n+o+l+c,d,r)}function lP(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?iP(t,e,s,r,a):"fadeIn"===i&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iP(t,e,s,n,a):"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tP(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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&&rP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function dP(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?aP(n,r,e,i,s,o):"callIn"===t&&oP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aP(n,r,e,i,s,a):"callIn"===t&&oP(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;tP(t,n,s,r),QB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eP(i,n,s,r):QB(i,n,s,r)}(n,r,e,t,i,s)}}const uP={type:"clipIn",duration:500,easing:"linear",delay:0},pP={type:"fadeIn",duration:500,easing:"linear",delay:0},gP={type:"callIn",duration:500,easing:"linear",delay:0},fP={type:"fadeOut",duration:500,easing:"linear",delay:0};class mP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new HM(Object.assign(Object.assign({},h),{state:{panel:j({},rM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},rM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},rM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},rM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class vP extends KB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=fP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;FM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(vP,mP);const _P=.001,yP={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:WB.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]}},bP={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"}}},xP={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:{autoRotate:!0,position:YB.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]}},SP={interactive:!0,label:{position:GB.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}},AP={interactive:!0,label:{autoRotate:!0,position:YB.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}},kP={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"}},MP={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"}},TP={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 wP(){CP._animate=lP}XB(),cT(),yw();class CP extends vP{markerAnimate(t){CP._animate&&this._animationConfig&&CP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(vM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return _M(Math.abs(e),Math.PI/2,_P)||_M(Math.abs(e),3*Math.PI/2,_P)?yM(i,e,t):vM(e)?bP.postiveXAxis[t]:bP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new uT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",CP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(CP.defaultAttributes.label)}}function EP(){BP._animate=hP}CP.defaultAttributes=yP,XB(),Uk(),yw();class BP extends KB{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},MP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=lf.polygon(Object.assign({points:e},i));n.states=j({},rM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",BP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},rM,null==i?void 0:i.area)),this._updateMarkLabels(BP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}BP.defaultAttributes=SP,G(BP,mP),XB(),dT(),yw();class PP extends vP{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case YB.arcInnerStart:l=n;case YB.arcOuterStart:l=n;break;case YB.arcInnerEnd:l=r;case YB.arcOuterEnd:l=r;break;case YB.center:case YB.arcInnerMiddle:case YB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new pT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",PP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(PP.defaultAttributes.label)}}PP.defaultAttributes=xP,XB(),wk(),yw();class LP extends KB{markerAnimate(t){LP._animate&&this._animationConfig&&LP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case YB.center:h=(s+n)/2,c=(r+a)/2;break;case YB.arcInnerStart:h=s,c=r;break;case YB.arcOuterStart:h=n,c=r;break;case YB.arcInnerEnd:h=s,c=a;break;case YB.arcOuterEnd:h=n,c=a;break;case YB.arcInnerMiddle:h=s,c=(r+a)/2;break;case YB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=lf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},rM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",LP.defaultAttributes.label)}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=j({},rM,null==o?void 0:o.area)),this._updateMarkLabels(LP.defaultAttributes.label)}isValidPoints(){return!0}}function RP(){OP._animate=dP}LP.defaultAttributes=AP,G(LP,mP),XB(),cT(),dT(),Zk(),Fk(),jk(),yw();class OP extends KB{markerAnimate(t){OP._animate&&this._animationConfig&&OP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gP,this.defaultExitAnimation=fP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return _M(Math.abs(s),Math.PI/2,_P)||_M(Math.abs(s),3*Math.PI/2,_P)?yM(t,s,n):vM(s)?TP.postiveXAxis[n]:TP.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,style:d,position:u=$B.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},rM,null==p?void 0:p.textBackground),text:j({},rM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},rM,null==p?void 0:p.itemContent));const v=vM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=lf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"text"===n?o=new HM(Object.assign(Object.assign({},i),{state:{panel:j({},rM,null==s?void 0:s.textBackground),text:j({},rM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=lf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"image"===n?(o=lf.image(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},rM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=_M(c,0,_P)||_M(d,0,_P),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=IM(e-u,t-d),o=IM(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(UP.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(UP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===UP.focus||"focus"===o){const s=a.hasState(VP.focus);a.toggleState(VP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover,VP.focus],t),this._setLegendItemState(e,VP.selected,t)})):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover,VP.focus],t),this._setLegendItemState(e,VP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(VP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VP.selected,VP.selectedHover],t),this._setLegendItemState(a,VP.unSelected,t)):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t))}else this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover],t),this._setLegendItemState(e,VP.unSelected,t))}))}this._dispatchLegendEvent(NP.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,VP.selected),this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover])):(this._removeLegendItemState(e,[VP.selected,VP.selectedHover]),this._setLegendItemState(e,VP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=zP,spaceRow:l=jP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=lf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=lf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,UP.item,t,w)):(w=lf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,UP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?VP.selected:VP.unSelected);const C=lf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=lf.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,UP.itemShape,t,w,S.state),s.addState(e?VP.selected:VP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=lf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,UP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=RM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,UP.itemLabel,t,w,A.state),D.addState(e?VP.selected:VP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=RM(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,UP.itemValue,t,w,k.state),r.addState(e?VP.selected:VP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 FP(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 FP(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 cM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new cM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=zP,spaceRow:o=jP}=n,l=this._itemsContainer,{space:h=HP,defaultCurrent:c=1}=r,d=$P(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=lf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=zP,spaceRow:a=jP}=s,o=this._itemsContainer,{space:l=HP,defaultCurrent:h=1}=n,c=$P(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 _=lf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=lf.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(VP.selected)?this._setLegendItemState(t,VP.selectedHover,e):this._setLegendItemState(t,VP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===UP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VP.unSelectedHover)||t.hasState(VP.selectedHover))&&(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VP.unSelectedHover)&&!t.hasState(VP.selectedHover)||(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===UP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NP.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!==UP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NP.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!==UP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},XP,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(VP.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 qP;function ZP(t){return y(t)?t:[t,t]}function JP(t){return t?"ew-resize":"ns-resize"}KP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:zP,spaceRow:jP,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:HP,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"}(qP||(qP={})),GP();class QP 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:j({},QP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:ZP(d)[0],endValue:ZP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=lf.group({x:0,y:0});f.name=qP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=lf.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)),m.name=qP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=lf.group({x:g?v:0,y:g?0:v});f.add(_);const y=lf.group({x:0,y:0});let b;if(y.name=qP.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=lf.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=qP.endText,f.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=lf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=qP.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,f]=ZP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(v.name=qP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=qP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(i.name=qP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=qP.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 f=lf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=qP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":JP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=lf.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=qP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return lf.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":JP(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),lf.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=lf.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=lf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===qP.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===qP.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===qP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===qP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}QP.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}}},YP(),GP();class tL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function eL(t="bottom"){let 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`}tL.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"}}},YP(),GP(),Vk();class iL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=lf.group({x:0,y:0});this._innerView.add(x);const S=new QP({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:eL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=lf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}iL.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)"}},Ik(),Qk(),$k();let sL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},aM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},aM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};sL.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 nL={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"}}};Ik(),Qk(),$k();let rL=class extends Zy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(nL,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=RM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=BM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 aL extends Ag{constructor(t){super(t)}}var oL,lL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oL||(oL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lL||(lL={}));class hL extends Zy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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"},hL.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"},hL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.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 aL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new aL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new aL(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(oL.OnPlay)},this.pause=()=>{this._dispatchEvent(oL.OnPause)},this.forward=()=>{this._dispatchEvent(oL.OnForward)},this.backward=()=>{this._dispatchEvent(oL.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()}}hL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hL.defaultAttributes={[lL.Start]:{},[lL.Pause]:{},[lL.Backward]:{},[lL.Forward]:{}};const cL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dL=[200,10];var uL,pL;!function(t){t.Default="default",t.Reverse="reverse"}(uL||(uL={})),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"}(pL||(pL={}));const gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),fL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),mL=t=>"top"===t||"bottom"===t;class vL 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:j({},vL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(mL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:dL[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:dL[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 QP(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=mL(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 hL(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=mL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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:mL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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 _L(){GP(),Ik(),Zk()}vL.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({},cL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cL),{key:"backward",position:"start"})}},_L();class yL extends vL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:uL.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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(pL.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(pL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.change),this.dispatchCustomEvent(pL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var bL,xL=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())}))};_L();class SL extends vL{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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change))},this.play=()=>xL(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(pL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.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(pL.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.brushActive="brushActive",t.brushClear="brushClear"}(bL||(bL={}));const AL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},kL=5;const ML={debounce:xt,throttle:St};Ik(),Uk();let TL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=AL.updateTrigger,endTrigger:i=AL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:ML[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=AL.trigger,resetTrigger:e=AL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(bL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(bL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=kL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(bL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(bL.brushActive,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._dispatchBrushEvent(bL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=kL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=AL.updateTrigger,endTrigger:e=AL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=lf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};TL.defaultAttributes=AL;const wL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},CL=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}},EL={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:sM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},BL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ik(),Gk(),Zk(),Qk(),$k();let PL=class t extends Zy{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=ri(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:mM(u)&&mM(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:mM(u)&&mM(u.value)},CL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:mM(u)&&mM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:mM(u)&&mM(u.value)},CL(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},aM),u.value),visible:mM(u)&&mM(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=mM(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 _=mM(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(!mM(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)+(mM(n.key)?r+n.key.spacing:0)+(mM(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&&(OM(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:mM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),OM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(mM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ed(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(mM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},CL(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},CL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},aM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(mM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},CL(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},CL(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=>BL.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)&&mM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=mM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(mM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(mM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&ru[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 wL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PL.defaultAttributes=EL;const LL=pt;function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function OL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function IL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function DL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function FL(t,e){const i=DL(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 zL(t,e){const i=jL(t),s=jL(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 jL(t,e={x:0,y:0}){return re.distancePP(t,e)}function HL(t){return k(t.x)&&k(t.y)}function VL(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 NL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const UL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function GL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&GL(t[i],e)}}var YL,$L,XL;function KL(t){var e,i;const{type:s}=t;return s===$L.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(YL||(YL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}($L||($L={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(XL||(XL={}));const qL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},ZL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function JL(t,e){var i;if(!t)return[];const s=rR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?sR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>iR(i)?tR(t,i,e):i)).filter(p)}))):i.map((i=>iR(i)?tR(t,i,e):i)).filter(p):[]}return[]}function QL(t,e){var i,s;return sR(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 tR(t,e,i){var s;const n=rR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=qL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=ZL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 eR=(t,e)=>{if(e&&iR(t)){const i=tR(e,t);if(i)return i}return t};function iR(t){return t&&"palette"===t.type&&!!t.key}function sR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function nR(t){return y(t)?{dataScheme:t}:t}function rR(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=KL(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 aR extends sE{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(!sR(this._range))return void super.range(this._range);const t=QL(this._range,this._domain);super.range(t)}}const oR={linear:wE,band:aE,point:class extends aE{constructor(t){super(!1),this.type=IC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sE,threshold:RE,colorOrdinal:aR};function lR(t){const e=oR[t];return e?new e:null}function hR(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 cR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function dR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function uR(t){return!!_(t)&&(!!t.endsWith("%")&&Xy(t.substring(0,t.length-1)))}function pR(t){return!!g(t)&&("percent"in t||"offset"in t)}function gR(t,e,i,s=0){var n,r;return S(t)?t:uR(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 fR(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]=gR(t[s],e.size,i)}))})),o}function mR(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}}function vR(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)||uR(t)||d(t)||pR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function _R(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const yR=(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},bR=[{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"]}];function xR(t,e){return t&&e.key in t?t[e.key]:e.default}function SR(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%"},kR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:bR,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"}}},token:AR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},MR={name:"dark",colorScheme:{default:{dataScheme:bR,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}}}}}},TR=(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]={}),TR(t[s],e.slice(1),i))};function wR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=nR(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)})}CR._charts={},CR._series={},CR._components={},CR._graphicComponents={},CR._marks={},CR._regions={},CR._animations={},CR._implements={},CR._chartPlugin={},CR._vChartPlugin={},CR._componentPlugin={},CR.transforms={fields:Yr,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}},CR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},CR._layout={},CR._grammarTransforms={},CR._stageEventPlugins={},CR.registerStageEventPlugin=(t,e)=>{CR._stageEventPlugins[t]=e},CR.getStageEventPlugin=t=>CR._stageEventPlugins[t],CR._interactionTriggers={},CR.registerInteractionTrigger=(t,e)=>{CR._interactionTriggers[t]=e},CR._composedEventMap={},CR.registerComposedEvent=(t,e)=>{CR._composedEventMap[t]=e},CR._tooltipProcessors={},CR.registerTooltipProcessor=(t,e)=>{CR._tooltipProcessors[t]=e},CR.createTooltipProcessor=(t,e)=>{const i=CR._tooltipProcessors[t];return i?new i(e):null};const PR=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},LR=PR(),RR={[kR.name]:kR},OR=kR.name,IR=new Map(Object.keys(RR).map((t=>[t,RR[t]]))),DR=new Map,FR=new Map(Object.keys(RR).map((t=>[t,t===OR]))),zR=(t,e)=>{if(!t)return;const i=NR(e);IR.set(t,i),FR.set(t,!0)},jR=(t=OR)=>(FR.has(t)&&!FR.get(t)&&zR(t,IR.get(t)),IR.get(t)),HR=t=>IR.delete(t)&&DR.delete(t)&&FR.delete(t),VR=t=>!!_(t)&&IR.has(t),NR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:OR;return ER({},jR(i),t)};class UR{static registerInstance(t){UR.instances.set(t.id,t)}static unregisterInstance(t){UR.instances.delete(t.id)}static getInstance(t){return UR.instances.get(t)}static instanceExist(t){return UR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return UR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}UR.instances=new Map;class WR{static registerTheme(t,e){zR(t,e)}static getTheme(t,e=!1){return jR(t)}static removeTheme(t){return HR(t)}static themeExist(t){return VR(t)}static getDefaultTheme(){return WR.themes.get(OR)}static setCurrentTheme(t){WR.themeExist(t)&&(WR._currentThemeName=t,UR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return WR.getTheme(WR._currentThemeName,t)}static getCurrentThemeName(){return WR._currentThemeName}}function GR(t){return _(t)?WR.themeExist(t)?WR.getTheme(t):{}:g(t)?t:{}}WR.themes=IR,WR._currentThemeName=OR;const YR=["animationThreshold","colorScheme","name","padding"];function $R(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];YR.includes(n)?s[n]=r:m(r)?iR(r)?s[n]=eR(r,e):SR(r)?s[n]=xR(i,r):s[n]=$R(r,e,i):s[n]=r})),s}function XR(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}function KR(t,e){if(!t)return t;if(m(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]=KR(t[s],e)}return i}return y(t)?t.map((t=>KR(t,e))):t}const qR=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:AR.fontFamily,fontSize:AR.fontSize}))(e,i,s).measure(t),ZR="__VCHART",JR=500,QR=500,tO=`${ZR}_MEASURE_CANVAS_ID`,eO=`${ZR}_DEFAULT_DATA_INDEX`,iO=`${ZR}_DEFAULT_DATA_KEY`,sO=`${ZR}_DEFAULT_DATA_SERIES_FIELD`,nO=`${ZR}_DEFAULT_SERIES_STYLE_NAME`,rO=`${ZR}_STACK_KEY`,aO=`${ZR}_STACK_START`,oO=`${ZR}_STACK_END`,lO=`${ZR}_STACK_START_PERCENT`,hO=`${ZR}_STACK_END_PERCENT`,cO=`${ZR}_STACK_START_OffsetSilhouette`,dO=`${ZR}_STACK_END_OffsetSilhouette`,uO=`${ZR}_STACK_TOTAL`,pO=`${ZR}_STACK_TOTAL_PERCENT`,gO=`${ZR}_STACK_TOTAL_TOP`,fO=`${ZR}_STACK_TOTAL_BOTTOM`,mO=`${ZR}_MOSAIC_VALUE_START_PERCENT`,vO=`${ZR}_MOSAIC_VALUE_END_PERCENT`,_O=`${ZR}_MOSAIC_CAT_START_PERCENT`,yO=`${ZR}_MOSAIC_CAT_END_PERCENT`,bO=`${ZR}_SEGMENT_START`,xO=`${ZR}_SEGMENT_END`,SO=`${ZR}_KEY`;function AO(t,e){for(let i=0;it.key===e))}function MO(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 TO(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:{}},PO(t,a,n[o],l,e,r))})),s?wO(n):n}function wO(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))):wO(t[e].nodes);return t}function CO(t,e){if("values"in t&&t.values.length){const i=IL(t.values,e),s=OL(t.values,hO);t.values.forEach((t=>{t[uO]=i,t[pO]=s}))}else for(const i in t.nodes)CO(t.nodes[i],e)}function EO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][oO]/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)BO(t.nodes[r],e,i,s,n)}function PO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[oO]=function(t){if(k(t))return t;const e=+t;return k(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)),PO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const LO=(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]=OO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function IO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>zO(t.style(e,i,s,n)):P(t.style)||(e.style=zO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>zO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=zO(t.state[e]))})),e.state=i}return e}function DO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e,s,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}function FO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),zO(i)}function zO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const jO=t=>"line"===t||"area"===t,HO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return jO(i)?e:null==e?void 0:e[0]},VO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let NO=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},n=CR.getComposedEvent(t);if(n){const e=new n(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(CR.getComposedEvent(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()}};var UO;!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"}(UO||(UO={}));const WO=["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 GO,YO,$O;t.ChartEvent=void 0,(GO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",GO.rendered="rendered",GO.renderFinished="renderFinished",GO.animationFinished="animationFinished",GO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",GO.afterInitData="afterInitData",GO.afterInitEvent="afterInitEvent",GO.afterInitMark="afterInitMark",GO.rawDataUpdate="rawDataUpdate",GO.viewDataFilterOver="viewDataFilterOver",GO.viewDataUpdate="viewDataUpdate",GO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",GO.markDeltaYUpdate="markDeltaYUpdate",GO.viewDataLabelUpdate="viewDataLabelUpdate",GO.scaleDomainUpdate="scaleDomainUpdate",GO.scaleUpdate="scaleUpdate",GO.dataZoomChange="dataZoomChange",GO.drill="drill",GO.layoutStart="layoutStart",GO.layoutEnd="layoutEnd",GO.layoutRectUpdate="layoutRectUpdate",GO.playerPlay="playerPlay",GO.playerPause="playerPause",GO.playerEnd="playerEnd",GO.playerChange="playerChange",GO.playerForward="playerForward",GO.playerBackward="playerBackward",GO.scrollBarChange="scrollBarChange",GO.brushStart="brushStart",GO.brushChange="brushChange",GO.brushEnd="brushEnd",GO.brushClear="brushClear",GO.brushActive="brushActive",GO.legendSelectedDataChange="legendSelectedDataChange",GO.legendFilter="legendFilter",GO.legendItemClick="legendItemClick",GO.legendItemHover="legendItemHover",GO.legendItemUnHover="legendItemUnHover",GO.tooltipShow="tooltipShow",GO.tooltipHide="tooltipHide",GO.tooltipRelease="tooltipRelease",GO.afterResize="afterResize",GO.afterRender="afterRender",GO.afterLayout="afterLayout",GO.afterMarkLayoutEnd="afterMarkLayoutEnd",GO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(YO||(YO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}($O||($O={}));const XO=[$O.mark,$O.model,$O.chart,$O.vchart];class KO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set($O.vchart,[]),this._levelNodes.set($O.chart,[]),this._levelNodes.set($O.model,[]),this._levelNodes.set($O.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 qO={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 ZO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>HO(t)))};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)||YO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||YO.chart);o.get(t)||o.set(t,new KO);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)||YO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||YO.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)||YO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||YO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?XO.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[YO.chart,YO.window,YO.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&&L(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 qO[a]&&(a=qO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?$O.model:$O.vchart:$O.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=YO.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!==$O.model&&s!==$O.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=$O.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 YO.chart:return this._viewBubbles;case YO.window:return this._windowBubbles;case YO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case YO.chart:return this._viewListeners;case YO.window:return this._windowListeners;case YO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return WO.includes(t)||Object.values(UO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteractionTrigger(e)}}function JO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function QO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const tI=new Map;let eI;function iI(){eI||(eI=new Ta,QO(eI,"geojson",ba),QO(eI,"topojson",Sa),JO(eI,"simplify",Wr))}function sI(t,e,i={type:"geojson",centroid:!0}){tI.has(t)&&zy(`map type of '${t}' already exists, will be overwritten.`),iI();const s=new wa(eI),n=j({},{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}),tI.set(t,s)}function nI(t){tI.has(t)?tI.delete(t):zy(`map type of '${t}' does not exists.`)}function rI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const aI=(t,e)=>0===t.length?[]:1===t.length?rI(t[0],null==e?void 0:e.deep):t.map((t=>rI(t,null==e?void 0:e.deep)));function oI(e,i,s){JO(i=i instanceof Ta?i:e.dataSet,"copyDataView",aI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function lI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return zy(`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 zy(`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([]),zy("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 hI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cI,dI,uI,pI;t.TransformLevel=void 0,(cI=t.TransformLevel||(t.TransformLevel={}))[cI.copyDataView=-10]="copyDataView",cI[cI.treemapFilter=-8]="treemapFilter",cI[cI.treemapFlatten=-7]="treemapFlatten",cI[cI.dotObjFlat=-7]="dotObjFlat",cI[cI.linkDotInfo=-7]="linkDotInfo",cI[cI.sankeyLayout=-7]="sankeyLayout",cI[cI.dataZoomFilter=-6]="dataZoomFilter",cI[cI.legendFilter=-5]="legendFilter",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"}(dI||(dI={})),function(t){t.data="data",t.mark="mark"}(uI||(uI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(pI||(pI={}));const gI=["line","area","trail"];function fI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(SO,i?t.slice().sort(i):t.slice()),{keys:[SO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const mI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function vI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{vI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function yI(t,e,i,s){const n=fI(t,(t=>i(t))),r=fI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 bI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new I_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Cp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Wy(o))&&!1!==c&&CR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=pI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>vI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>vI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{vI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Fy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===pI.before&&(this._layoutState=pI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=pI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Fy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=_I(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=yI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=yI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=fI(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=fI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===YO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:HO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===YO.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===YO.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===YO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===YO.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===YO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{vI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=_I(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return vu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{vI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function xI(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:jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function SI(t){t.crosshair=Y(t.crosshair||{}).map((e=>wR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function AI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Gy(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 kI(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 MI(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}}var TI,wI,CI,EI,BI,PI;t.LayoutZIndex=void 0,(TI=t.LayoutZIndex||(t.LayoutZIndex={}))[TI.SeriesGroup=0]="SeriesGroup",TI[TI.Axis_Grid=50]="Axis_Grid",TI[TI.CrossHair_Grid=100]="CrossHair_Grid",TI[TI.Region=450]="Region",TI[TI.Mark=300]="Mark",TI[TI.Node=400]="Node",TI[TI.Axis=100]="Axis",TI[TI.MarkLine=500]="MarkLine",TI[TI.MarkArea=100]="MarkArea",TI[TI.MarkPoint=500]="MarkPoint",TI[TI.DataZoom=500]="DataZoom",TI[TI.ScrollBar=500]="ScrollBar",TI[TI.Player=500]="Player",TI[TI.Legend=500]="Legend",TI[TI.CrossHair=500]="CrossHair",TI[TI.Indicator=500]="Indicator",TI[TI.Title=500]="Title",TI[TI.Label=500]="Label",TI[TI.Brush=500]="Brush",TI[TI.CustomMark=500]="CustomMark",TI[TI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(wI=t.LayoutLevel||(t.LayoutLevel={}))[wI.Indicator=10]="Indicator",wI[wI.Region=20]="Region",wI[wI.Axis=30]="Axis",wI[wI.DataZoom=40]="DataZoom",wI[wI.Player=40]="Player",wI[wI.ScrollBar=40]="ScrollBar",wI[wI.Legend=50]="Legend",wI[wI.Title=70]="Title",wI[wI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(CI=t.AttributeLevel||(t.AttributeLevel={}))[CI.Default=0]="Default",CI[CI.Theme=1]="Theme",CI[CI.Chart=2]="Chart",CI[CI.Base_Series=3]="Base_Series",CI[CI.Series=4]="Series",CI[CI.Mark=5]="Mark",CI[CI.User_Chart=6]="User_Chart",CI[CI.User_Series=7]="User_Series",CI[CI.User_Mark=8]="User_Mark",CI[CI.User_SeriesStyle=9]="User_SeriesStyle",CI[CI.Built_In=99]="Built_In";class LI{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({},LI.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]))))}}LI.defaultMarkInfo={};class RI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class OI{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=>wR({},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 II extends RI{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=OI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new LI,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new NO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${ZR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=CR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class DI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=fR(vR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:gR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:gR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:gR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:gR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:gR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:gR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=gR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=gR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=gR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(mR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class FI extends II{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,this._transformLayoutPadding=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 DI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 zI extends OI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class jI extends FI{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(e,i){var s;super(e,i),this.transformerConstructor=zI,this.modelType="region",this.specKey="region",this.type=jI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function HI(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 VI(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 NI(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 UI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),NI(d,!0,p,l),s&&VI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function WI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=$I(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),NI(d,!1,p,o),s&&VI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function YI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=$I(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=$I(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"left",s),r.length&&UI(r,e,i,!0,"left",s),a.length&&WI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"top",s),r.length&&GI(r,e,i,!0,"top",s),a.length&&YI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"right",s),r.length&&UI(r,e,i,!0,"right",s),a.length&&WI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"bottom",s),r.length&&GI(r,e,i,!0,"bottom",s),a.length&&YI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=$I(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=$I(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:jy)("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}}}XI.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(EI||(EI={})),t.STATE_VALUE_ENUM=void 0,(BI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",BI.STATE_HOVER="hover",BI.STATE_HOVER_REVERSE="hover_reverse",BI.STATE_DIMENSION_HOVER="dimension_hover",BI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",BI.STATE_SELECTED="selected",BI.STATE_SELECTED_REVERSE="selected_reverse",BI.STATE_SANKEY_EMPHASIS="selected",BI.STATE_SANKEY_EMPHASIS_REVERSE="blur",BI.STATE_HIGHLIGHT="highlight",BI.STATE_BLUR="blur",BI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(PI||(PI={}));const KI=["linear","radial","conical"],qI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const ZI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{ZI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class JI extends RI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class QI extends JI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,gI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!ZI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(ZR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(ZR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(FC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class tD extends RI{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=CR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class eD extends tD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const iD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,sD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=iD(l.delay,n,a,o),d=iD(l.duration,n,a,o),u=iD(l.oneByOne,n,a,o),p=iD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Ow(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Bw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Lw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Wo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Rw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mw,null!==(l=i.easing)&&void 0!==l?l:Tw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Wo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Iw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Ow(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},nD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},rD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class aD extends tD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new eD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Cp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new zl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new QI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&wR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zC(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=lR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):KI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):zC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=QL(JL(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({},qI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)KI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=QL(JL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return fI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return CR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[iO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=fI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{rD(t),s.push(...t.getGraphics())})),e.forEach((t=>{rD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);sD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=nD(e,n),r=nD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===dI.exit?dI.exit:i===dI.update?dI.update:dI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===EI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===EI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=EI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=EI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=EI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=dI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=dI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return mI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=mI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=VO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=CR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=CR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===pI.before||(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===EI.exit&&!e.isExiting)if(e.context.animationState===EI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Cp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var oD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(oD||(oD={}));class lD extends aD{constructor(){super(...arguments),this.type=lD.type,this._marks=[],this._diffState=EI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(zy("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?(zy("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))}getMarkInUserId(t){let e;return vI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===EI.update){const t=this.hasAnimation(),e=VO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=EI.update}render(){this._isCommited&&(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}lD.type="group";const hD={measureText:qR};class cD{static instance(){return cD.instance_||(cD.instance_=new cD),cD.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 dD{constructor(){this.id=$y(),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))?zy("不要重复添加相同的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 uD extends dD{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}}const pD={type:"fadeIn"};function gD(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 pD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const fD={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"}},mD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},vD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},_D=()=>{CR.registerAnimation("scaleInOut",(()=>mD))},yD=()=>{CR.registerAnimation("fadeInOut",(()=>vD))},bD=(t,e)=>({appear:gD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Uw,duration:fD.update.duration,easing:fD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),xD=()=>{CR.registerAnimation("line",bD)},SD=()=>{hw.registerBuiltInAnimate("growPointsIn",rC),hw.registerBuiltInAnimate("growPointsOut",aC),hw.registerBuiltInAnimate("growPointsXIn",lC),hw.registerBuiltInAnimate("growPointsXOut",hC),hw.registerBuiltInAnimate("growPointsYIn",dC),hw.registerBuiltInAnimate("growPointsYOut",uC),hw.registerBuiltInAnimate("clipIn",Yw),hw.registerBuiltInAnimate("clipOut",$w)},AD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class kD{constructor(t){this._markSet=new LI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 MD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TD extends kD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},MD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}TD.type="element-highlight",TD.defaultOptions=MD;const wD=()=>{CR.registerInteractionTrigger(TD.type,TD)},CD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ED extends kD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},CD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}ED.type="element-select",ED.defaultOptions=CD;const BD=()=>{CR.registerInteractionTrigger(ED.type,ED)};class PD extends dD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class LD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>CR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>CR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>CR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return CR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>CR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){CR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}static getFunction(t){return t?cD.instance().getFunction(t):null}static getFunctionList(){return cD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=CR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=CR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,tI.get(e);var e}static registerSVG(t,e,i){const s=CR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=CR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){UR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=$y(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=kI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?CR.getSeriesBuiltInTheme(e):CR.getComponentBuiltInTheme(e);i=i?wR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=$R({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},GL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(v);if(S?sx(Bh):"node"===v&&nA(Bh),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=WR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new bI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new ZO(this,this._compiler),this._event=new NO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),UR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=wR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=XR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;LD.getFunctionList()&&LD.getFunctionList().length&&(t=KR(t,LD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=CR.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=CR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=CR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 AI(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:JR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:QR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,QO(this._dataSet,"dataview",Aa),QO(this._dataSet,"array",s),JO(this._dataSet,"copyDataView",aI);for(const t in CR.transforms)JO(this._dataSet,t,CR.transforms[t]);for(const t in CR.dataParser)QO(this._dataSet,t,CR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?dI.none:dI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,UR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=lI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?wR({},t[n][e.index],i):i):t[n]=s?wR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?wR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?wR({},t[n],i):i)}))}(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=wR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=ER({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=GR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}else{const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(NM.poptip,VM,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=!!Uy(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.getTheme("background")||this._option.background}getCurrentTheme(){return GR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!WR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 xI(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(!Uy(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?_R(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 zy("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?_R(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return cD.instance().getFunction(t)}registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}getFunctionList(){return cD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=CR.getChartPlugins();t.length>0&&(this._chartPlugin=new uD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=CR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}LD.InstanceManager=UR,LD.ThemeManager=WR,LD.globalConfig={uniqueTooltip:!0},LD.Utils=hD,LD.vglobal=b_;CR.registerRegion("region",jI),CR.registerLayout("base",XI),Kk(),Ik(),CR.registerMark(lD.type,lD),CR.registerStageEventPlugin("gesture",Tb),wD(),BD(),zR(MR.name,MR);const RD="monotone",OD="linear",ID="bevel";function DD(t,e){return e("component",t)}function FD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=CR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const zD=(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},jD=(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)))},HD=(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},VD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=FD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ND=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const UD=(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 WD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=YD(VD(h,r,a,c),d,g),o.value=YD(VD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=VD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function GD(t,e,i,s,n,r,a){if(d(e)){WD(t,e(n,a),i,s,r,a)}else e&&WD(t,e,i,s,r,a)}const YD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class $D{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 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=>{y(t)?t.forEach((t=>{GD(a,t,e,i,s,n,r)})):d(t)?GD(a,t,e,i,s,n,r):t&&WD(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:VD(r.visible,t,n),value:YD(VD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:VD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=VD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&UD(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 XD={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}},KD=(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=AO([],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 qD(a,n,o)},qD=(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)=>{Xy(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=>{Xy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=XD[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},ZD=(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=>{Xy(t[e])||(t[e]=0)}))})),t},JD=`${ZR}_HIERARCHY_DEPTH`,QD=`${ZR}_HIERARCHY_ROOT`,tF=`${ZR}_HIERARCHY_ROOT_INDEX`;function eF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function iF(t,e,i){t&&(i.needDefaultSeriesField&&(t[sO]=i.defaultSeriesField),t[eO]=e,t[iO]=i.getKey(t,e,i))}function sF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function nF(t,e,i,s=0,n,r){void 0===r&&(r=e),iF(t,e,i),t[JD]=s,t[QD]=n||t[i.categoryField],t[tF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>nF(e,s,i,t[JD]+1,t[QD],r)))}const rF={label:{name:"label",type:"text"}},aF=`${ZR}_rect_x`,oF=`${ZR}_rect_x1`,lF=`${ZR}_rect_y`,hF=`${ZR}_rect_y1`,cF={data:!0},dF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},uF=[...Object.keys(fD),"normal"];function pF(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 _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=wR({},o[e],a);return _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function gF(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;const i=["custom","customParameters"];return t=I(t,null,i),yF(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}),i),t}(h,i)}function fF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function mF(t,e){var i;return null!==(i=null==t?void 0:t[eO])&&void 0!==i?i:e.context.graphicIndex}function vF(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 _F(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function yF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),yF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),yF(t[s],e,i))}function bF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class xF extends OI{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=KL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=CR.getSeriesMarkMap(o)?function(t,e,i){const s=CR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=wR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return wR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=wR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>wR({},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 SF extends II{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:`${ZR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=xF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=bF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(JO(this._rawData.dataSet,"invalidTravel",ZD),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=lI(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=oI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new eD(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=qD(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(){JO(this._dataSet,"dimensionStatistics",KD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&AO(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){JO(this._dataSet,"dimensionStatistics",KD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=AO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=pF({},gF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Wy(s)||Gy(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=wR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=wR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=AD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=AD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:sO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:nO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,nO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new $D(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},cF),dF),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=>dF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||hI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();bF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:sO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new aR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return JL(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:sO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,wR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:iO}_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!==oO&&t!==hO&&t!==aO&&t!==lO||(t=this.getStackValueField()),null!==(e=MO(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=>Xy(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:sO]}}function AF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();FC(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 kF(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}}}SF.mark=rF,SF.transformerConstructor=xF;class MF extends SF{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);FC(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:`${ZR}_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(oO),this.setFieldX2(aO)):(this.setFieldY(oO),this.setFieldY2(aO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(hO),this.setFieldX2(lO)):(this.setFieldY(hO),this.setFieldY2(lO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(dO),this.setFieldX2(cO)):(this.setFieldY(dO),this.setFieldY2(cO))}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(t.ChartEvent.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)&&(AF("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)}}function TF(t){return"bottom"===t||"top"===t}function wF(t){return"left"===t||"right"===t}function CF(t){return"z"===t}function EF(t,e){return dR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function BF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function PF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?TF(t)?"linear":"band":TF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const LF=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):["linear","log","symlog"].includes(e)?DD("axisLinear",i):{})&&void 0!==s?s:{},r=TF(t)?DD("axisX",i):wF(t)?DD("axisY",i):DD("axisZ",i);return wR({},DD("axis",i),n,r)};class RF{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:jy)("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:jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>jC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return TF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class OF extends RF{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:YO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const IF=(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))},DF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},FF=(t,e,i,s)=>{var n;const r=e.getScale(),a=jC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:zF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,jF=(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};class HF extends RF{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)=>!IF(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:YO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:YO.canvas}),callback:this.onMouseOut}),Wy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:YO.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Wy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var VF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(VF||(VF={}));const NF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class UF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(NF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:ID,curveType:OD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===RD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(NF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:vF(this._spec,NF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${ZR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[NF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,wR({},this._spec[NF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const WF=Object.assign(Object.assign({},rF),NF),GF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>GF(t,e[i])));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]))},YF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class $F extends aD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return YF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(zC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?GF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[iO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class XF extends $F{constructor(){super(...arguments),this.type=XF.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)===$L.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}XF.type="line";const KF=()=>{CR.registerMark(XF.type,XF),Kk(),jk(),MB(),bB(),SD(),CR.registerGraphicComponent("line",wg)};class qF extends aD{constructor(){super(...arguments),this.type=qF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}qF.type="symbol";const ZF=()=>{CR.registerMark(qF.type,qF),Kk(),Zk(),bB(),CR.registerGraphicComponent("symbol",kg)};class JF extends xF{_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 QF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function tz(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:!k(o.min),extendable_max:!k(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 ez(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 iz(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 sz(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 nz(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 rz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return PC(v)};class az{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class oz extends az{constructor(){super(oz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&QF(c)&&QF(d)))return;const u=tz(t,c),p=tz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!iz(u,p))return}else if(0===y&&0===b){if(!iz(p,u))return}else if(_||A)if(_&&!A){if(!ez(u,p))return}else if(A&&!_){if(!ez(p,u))return}else{if(f===b)return;if(f>b){if(!sz(u,p))return}else if(!sz(p,u))return}else{if(0===f&&0===y){if(!nz(u,p))return}else if(0===b&&0===g&&!nz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){JO(e.getOption().dataSet,"tickAlign",rz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}oz.pluginType="component",oz.type="AxisSyncPlugin";const lz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function hz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function cz(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 dz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const uz=t=>"band"===t||"ordinal"===t||"point"===t;function pz(t,e){return{id:t,label:t,value:e,rawValue:t}}function gz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class fz extends dD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const mz=`${ZR}_ARC_TRANSFORM_VALUE`,vz=`${ZR}_ARC_RATIO`,_z=`${ZR}_ARC_START_ANGLE`,yz=`${ZR}_ARC_END_ANGLE`,bz=`${ZR}_ARC_K`,xz=`${ZR}_ARC_MIDDLE_ANGLE`,Sz=`${ZR}_ARC_QUADRANT`,Az=`${ZR}_ARC_RADIAN`,kz=-Math.PI/2,Mz=3*Math.PI/2,Tz=.6,wz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Cz=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):"linear"===e?DD("axisLinear",i):{})&&void 0!==s?s:{},r=DD("angle"===t?"axisAngle":"axisRadius",i);return wR({},DD("axis",i),n,r)};function Ez(t,e,i,s){switch(t){case r.cartesianBandAxis:return LF(EF(i,["z"]),"band",e);case r.cartesianLinearAxis:return LF(EF(i,["z"]),"linear",e);case r.cartesianLogAxis:return LF(EF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LF(EF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LF(EF(i),void 0,e);case r.polarBandAxis:return Cz(i.orient,"band",e);case r.polarLinearAxis:return Cz(i.orient,"linear",e);case r.polarAxis:return Cz(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>TF(t.orient)));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>wF(t.orient)));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Bz(i,DD(t,e));default:return DD(t,e)}}const Bz=(t,e)=>{var i;const s=wR({},e,e[BF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Pz extends OI{getTheme(t,e){return Ez(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({},vR(e)),{[s]:0}))}}class Lz extends FI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Pz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:YO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Rz,Oz;Lz.transformerConstructor=Pz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Rz||(Rz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Oz||(Oz={}));class Iz extends aD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=CR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(UO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Iz.type="component";const Dz=()=>{CR.registerMark(Iz.type,Iz)},Fz=t=>t;class zz extends Lz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Rz.circleAxis:Rz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Oz.circleAxisGrid:Oz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=pF(null===(h=CR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new eD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return VL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?FC(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 VL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=NL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(VL(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=IO(s=t.domainLine)).startSymbol=IO(s.startSymbol),s.endSymbol=IO(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 zO(wR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:zO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 zO(wR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:zO(t.tick.style)),t.tick.state&&(i.tick.state=DO(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 zO(wR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:zO(t.subTick.style)),t.subTick.state&&(i.subTick.state=DO(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=lz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:wR({},d,zO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:zO(h.style)}),h.state&&(i.title.state.shape=DO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:zO(o.style)}),o.state&&(i.title.state.background=DO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=DO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=zO(t.background.style)),t.background.state&&(i.panel.state=DO(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 zO(wR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:zO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:zO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=FD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){QO(this._option.dataSet,"scale",Fz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===gT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}zz.specKey="axes";const jz=()=>{Dz(),CR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Hz=[oz];class Vz extends zz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),VL(this._regions,(t=>{const e=this.getOrient();TF(e)?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wF(e)?gz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):CF(e)&&gz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=wR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(wR({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=TF(this.getOrient()),n=t=>{var e;return(s?!TF(t.getOrient()):TF(t.getOrient()))&&FC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=EF(i,["z"]),CF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!dz(e))return null;const{axisType:t,componentName:s}=PF(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=>wF(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(!dz(t))return;const{axisType:s,componentName:n}=PF(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=CR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return TF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):CF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(Hz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){TF(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&&!TF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!CF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;wF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=TF(this.getOrient())?t.fieldX:CF(this.getOrient())?t.fieldZ:t.fieldY,FC(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:FC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(UO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(TF(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=TF(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)}))}collectScale(){const t=[];return VL(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]:TF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:CF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();VL(this._regions,(e=>{TF(t)?gz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):wF(t)?gz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):CF(t)&&gz(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=TF(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=TF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=wR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=TF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return pz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Vz.type=r.cartesianAxis,Vz.specKey="axes";const Nz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Uz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Gz=(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 Yz(t,e,i="count"){const s=Gz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $z=Math.sqrt(50),Xz=Math.sqrt(10),Kz=Math.sqrt(2);class qz{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=cz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=TF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Wz),e.sort(Wz),{domain:Uz(t,e),scope:Yz(t,e,i)}}(r,Iy(t),this._spec.breaks[0].scopeType);e=Iy(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}=cz(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>=$z?10:n>=Xz?5:n>=Kz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const Zz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Jz={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}}},Qz={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}}},tj={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}}};class ej extends Vz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!CF(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=TF(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=uR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Iy(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 JO(this._option.dataSet,t,DE),t}}ej.type=r.cartesianLinearAxis,ej.specKey="axes",ej.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(ej,qz);const ij=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(ej.type,ej)};class sj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new eD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=pz(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=>pz(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 nj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class rj extends Vz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,VE),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=ZC(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{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(rj.type,rj,!1)};class oj extends ej{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{TF(this.getOrient())?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):gz(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=wR({},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 wa(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 eD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>pz(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=>pz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}oj.type=r.cartesianTimeAxis,oj.specKey="axes",oj.builtInTheme={axis:tj,axisX:Jz,axisY:Qz};class lj extends ej{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}lj.type=r.cartesianLogAxis,lj.specKey="axes",lj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(lj,qz);class hj extends ej{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}hj.type=r.cartesianSymlogAxis,hj.specKey="axes",hj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(hj,qz);const cj=`${ZR}_hide_`;function dj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const uj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[cj]&&(dj(t,!0),t[cj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[cj]=!0,dj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},pj=()=>{CR.registerGrammarTransform("symbolOverlap",{transform:uj,runType:"afterEncode"})},gj={min:K,max:X,average:DL,sum:IL};function fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function mj(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 vj(t,e,i,s){return mj(t,e,i,"min",s)}function _j(t,e,i,s){return mj(t,e,i,"max",s)}function yj(t,e,i,s){return mj(t,e,i,"average",s)}function bj(t,e,i,s){return mj(t,e,i,"sum",s)}const xj=(t,e)=>{let i=d(t.size)?t.size():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=fj;if("min"===n?l=vj:"max"===n?l=_j:"average"===n?l=yj:"sum"===n&&(l=bj),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[]},Sj=()=>{CR.registerGrammarTransform("dataSampling",{transform:xj})};class Aj extends MF{constructor(){super(...arguments),this.type=$L.line,this.transformerConstructor=JF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(pF(null===(i=CR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),gF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Aj.type=$L.line,Aj.mark=WF,Aj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Aj.transformerConstructor=JF,G(Aj,UF);class kj{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)=>{hI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];zy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];zy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Mj{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)=>{Ky(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{AO(e,[{key:t,operations:FC(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&&AO(e,[{key:i.field,operations:FC(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?lR("colorOrdinal"):lR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Ky(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Ky(s.domain)?e.reRender=!0:U(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(!Ky(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=FC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=FC(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;FC(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(FC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=FC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));FC(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 Tj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class wj extends RI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:JR,height:QR},this._viewRect={width:JR,height:QR},this._viewBox={x1:0,y1:0,x2:JR,y2:QR},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=vR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new NO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new kj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Tj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=CR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=CR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=CR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof II)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 aD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof aD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&hI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=AI(this._spec,this._option,{width:JR,height:QR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=JL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Mj(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){kI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=JL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{kI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,kI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):kI(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()];kI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=fR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(UO.AFTER_MARK_RENDER_END,e)};this._event.on(UO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:HO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(jO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===VF.dimensionHover||s===VF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>jC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Cj=(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 Ej{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):TR(t,a,c.spec),TR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Cj(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=Cj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(CR.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(CR.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=CR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=CR.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=CR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):zD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=zD(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"];return 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}))}_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 Bj extends Ej{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&wR(i,MI(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 Pj extends Bj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),SI(t)}}const Lj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=TO(t,!0);for(const e in o)for(const i in o[e].nodes)BO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)EO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&CO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Oj{_beforeInit(){this._dataSet&&JO(this._dataSet,"stackSplit",Lj)}_initStack(){this._stack=new Rj(this),this._stack.init()}}const Ij={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:VF.dimensionHover};class Dj extends kD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Ij,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=HO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Dj.type="dimension-hover",Dj.defaultOptions=Ij;const Fj=()=>{CR.registerInteractionTrigger(Dj.type,Dj)},zj=()=>{CR.registerComposedEvent(VF.dimensionHover,HF),CR.registerComposedEvent(VF.dimensionClick,OF)},jj=t=>t.fieldX[0],Hj=t=>t.fieldY[0],Vj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Nj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Uj=(t,e)=>t?e?jj:Vj:e?Hj:Nj,Wj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=jF(t,(t=>TF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=jF(t,(t=>wF(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=>{jC(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=Gj(t,i,Uj(e,jC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Gj(t,i,Uj(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},Gj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Yj(t,s,i)},Yj=(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=FF(e,t,"cartesian",null!=i?i:TF(t.getOrient())?jj:Hj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},$j=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(jC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(FC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=hz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Kj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&Xj(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),Xj=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=FD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Kj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},qj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=Zj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},Zj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Jj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return $j(c,r,e),c.xField.cacheInfo?qj(c.xField):c.yField.cacheInfo?qj(c.yField):void 0},Qj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],tH=(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])&&Qj.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(eH(s).every((t=>{var e;return!UD("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},eH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},iH={dom:`${ZR}_TOOLTIP_HANDLER_DOM`,canvas:`${ZR}_TOOLTIP_HANDLER_CANVAS`},sH={key:"其他",value:"..."};var nH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(nH||(nH={}));class rH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=tH(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({},sH),t):sH;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)&&UD(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 aH extends rH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!jC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const oH=()=>{CR.registerTooltipProcessor("dimension",aH)};class lH extends rH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Uo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(HO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const hH=()=>{CR.registerTooltipProcessor("mark",lH)};class cH extends rH{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 dH=()=>{CR.registerTooltipProcessor("group",cH)};class uH extends wj{constructor(){super(...arguments),this.transformerConstructor=Pj,this.type="line",this.seriesType=$L.line}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}uH.type="line",uH.seriesType=$L.line,uH.transformerConstructor=Pj,G(uH,Oj);const pH=[...YF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class gH extends $F{constructor(){super(...arguments),this.type=gH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return pH}_getIgnoreAttributes(){return[]}}gH.type="area";const fH=()=>{CR.registerMark(gH.type,gH),Kk(),Ek(),MB(),bB(),SD(),CR.registerGraphicComponent("area",Jg)};class mH extends $D{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 vH=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}}),_H=()=>{CR.registerAnimation("area",bD),xD(),_D()};class yH extends JF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=wR({},f.style,g.style),l.state=wR({},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 bH extends MF{constructor(){super(...arguments),this.type=$L.area,this.transformerConstructor=yH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(bH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===RD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return hR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[oO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(pF(null===(e=CR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),gF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),gF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("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 mH(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(){super.onLayoutEnd(),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}}}bH.type=$L.area,bH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},bH.mark=vH,bH.transformerConstructor=yH,G(bH,UF);class xH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(t)}}class SH extends wj{constructor(){super(...arguments),this.transformerConstructor=xH,this.type="area",this.seriesType=$L.area}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}SH.type="area",SH.seriesType=$L.area,SH.transformerConstructor=xH,G(SH,Oj);function AH(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 kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:AH(t,e)}),MH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:AH(t,e)}),TH={type:"fadeIn"},wH={type:"growCenterIn"};function CH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return TH;case"scaleIn":return wH;default:return kH(t)}}class EH extends aD{constructor(){super(...arguments),this.type=EH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}EH.type="rect";const BH=()=>{Kk(),Gk(),vB("rect",SB),CR.registerMark(EH.type,EH),hw.registerBuiltInAnimate("growHeightIn",eC),hw.registerBuiltInAnimate("growHeightOut",iC),hw.registerBuiltInAnimate("growWidthIn",_C),hw.registerBuiltInAnimate("growWidthOut",yC),hw.registerBuiltInAnimate("growCenterIn",Jw),hw.registerBuiltInAnimate("growCenterOut",Qw),CR.registerGraphicComponent("rect",Pg)},PH=Object.assign(Object.assign({},rF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function LH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=yR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):hR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oF]):hR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=hR(this._dataToPosX(t),e,i),n=hR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):hR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hF]):hR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=hR(this._dataToPosY(t),e,i),n=hR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:vF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(JO(this._option.dataSet,"addVChartProperty",HD),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};JO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new eD(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=hF,s=lF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=oF,s=aF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=TO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)LH(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=hR(this[r](t),l,i),u=hR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[aO],n=t[oO],r=t[lO],h=t[hO];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]),{[aO]:i,[oO]:s}),a?{[lO]:o,[hO]: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(Pg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>hR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>hR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=kF(this);this._barMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),gF(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=yR(this._spec.barWidth,a)),l&&(c=Math.max(c,yR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,yR(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=yR(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=FC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}IH.type=$L.bar,IH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},IH.mark=PH,IH.transformerConstructor=OH;const DH=()=>{Sj(),BH(),CR.registerAnimation("bar",((t,e)=>({appear:CH(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t)}))),aj(),ij(),CR.registerSeries(IH.type,IH)};class FH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(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 zH extends wj{constructor(){super(...arguments),this.transformerConstructor=FH,this.type="bar",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}zH.type="bar",zH.seriesType=$L.bar,zH.transformerConstructor=FH,G(zH,Oj);const jH=[10,20],HH=IC.Linear,VH="circle",NH=IC.Ordinal,UH=["circle","square","triangle","diamond","star"],WH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},GH=Object.assign(Object.assign({},rF),{point:{name:"point",type:"symbol"}});class YH extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class $H extends MF{constructor(){super(...arguments),this.type=$L.scatter,this.transformerConstructor=YH,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=`${ZR}_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=`${ZR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:HH,defaultRange:jH},"size")}getShapeAttribute(t,e){return u(e)?VH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:NH,defaultRange:UH},"shape")}initMark(){this._symbolMark=this._createMark($H.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,$H.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=kF(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(pF(null===(i=CR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),gF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:VH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}$H.type=$L.scatter,$H.mark=GH,$H.builtInTheme={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"}}}}},$H.transformerConstructor=YH;const XH=()=>{ZF(),CR.registerAnimation("scatter",((t,e)=>Object.assign({appear:WH(0,e)},mD))),aj(),ij(),CR.registerSeries($H.type,$H)};class KH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class qH extends wj{constructor(){super(...arguments),this.transformerConstructor=KH,this.type="scatter",this.seriesType=$L.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}qH.type="scatter",qH.seriesType=$L.scatter,qH.transformerConstructor=KH,G(qH,Oj);class ZH extends SF{constructor(){super(...arguments),this.type=$L.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=`${ZR}_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 JH=`${ZR}_MAP_LOOK_UP_KEY`,QH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[eO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[JH]=e.nameMap[n]:t[JH]=n})),t.features);class tV extends $D{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 eV extends aD{constructor(){super(...arguments),this.type=eV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}eV.type="path";const iV=()=>{CR.registerMark(eV.type,eV),Kk(),Vk(),CR.registerGraphicComponent("path",Kg)},sV=Object.assign(Object.assign({},rF),{area:{name:"area",type:"path"}});class nV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 rV{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(){}}class aV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 oV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:rV}:Wy(e)||Gy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:aV}:null}const lV={debounce:xt,throttle:St};class hV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Wy(this._renderMode)||Gy(this._renderMode),oV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return oV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,lV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,lV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){oV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:$O.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:$O.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:$O.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||oV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=lV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=lV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:$O.chart})}));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:$O.chart,source:YO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp)}))}}function cV(t,e){return`${ZR}_${e}_${t}`}class dV extends Lz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:cV(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=wR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 nV(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===$L.map||e.type===$L.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),VL(this._regions,(t=>{var e;if(t.type===$L.map||t.type===$L.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==$L.map&&e.type!==$L.pictogram||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[JH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}dV.type=r.geoCoordinate,G(dV,hV);const uV=()=>{CR.registerComponent(dV.type,dV)};class pV extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class gV extends ZH{constructor(){super(...arguments),this.type=$L.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 !`),tI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),JO(this._dataSet,"copyDataView",aI),JO(this._dataSet,"map",QH),JO(this._dataSet,"lookup",jD);const s=tI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:JH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(gV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:vF(this._spec,gV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:sO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:sO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(pF(null===(t=CR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),gF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[eO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[eO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 eO}getActiveMarks(){return[this._pathMark]}}gV.type=$L.map,gV.mark=sV,gV.builtInTheme={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"}}}}},gV.transformerConstructor=pV;const fV=`${ZR}_waterfall_default_seriesField`,mV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[gO]=!0:delete t[gO]})),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=vV([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 f=g[0];let{start:m,end:v}=_V(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(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=vV(a,t,n,r,h,l,i,e),r.push(n)})),r};function vV(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}=_V(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===fV)&&(t[fV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function _V(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?zy("total.collectCountField error"):n=e[a].start;o<0?zy("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=ie(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 yV=(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)=>ie(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},bV={type:"fadeIn"},xV={type:"growCenterIn"};function SV(t,e){switch(e){case"fadeIn":return bV;case"scaleIn":return xV;default:return kH(t,!1)}}class AV extends aD{constructor(){super(...arguments),this.type=AV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}AV.type="rule";const kV=()=>{CR.registerMark(AV.type,AV),Kk(),jk(),CR.registerGraphicComponent("line",wg)},MV=Object.assign(Object.assign({},PH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),TV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:wV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function wV(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)=>wV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class CV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),JO(e,"dimensionTree",TV),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 EV extends OH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const BV={rect:DV,symbol:OV,arc:zV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=OV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:jV,line:HV,area:HV,rect3d:DV,arc3d:zV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function PV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=BV[t])&&void 0!==i?i:BV.point;return e.series.type===$L.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=RV(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:VV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function LV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==$L.sankey){const{formatFunc:t,args:n}=FD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function RV(t){return d(t)?e=>t(e.data):t}function OV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=RV(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:IV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function IV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function DV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=RV(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:FV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function FV(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 zV(t){var e;const{labelSpec:i}=t,s=null!==(e=RV(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 jV(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=LV(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),xg(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 HV(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}))):[{index:0,[sO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function VV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class NV extends IH{constructor(){super(...arguments),this.type=$L.waterfall,this.transformerConstructor=EV,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 CV(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=fV)}getSeriesKeys(){return this._seriesField===fV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),JO(this._dataSet,"waterfallFillTotal",yV),JO(this._dataSet,"waterfall",mV),(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=oI(this.getViewData(),this._dataSet,{name:`${ZR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new eD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:aO,endAs:oO,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=kF(this);this._barMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),gF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("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(){super.initMark();const t=this._createMark(NV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return jV(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?hR(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):hR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}NV.type=$L.waterfall,NV.mark=MV,NV.builtInTheme={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}}}},NV.transformerConstructor=EV;const UV=()=>{kV(),BH(),CR.registerAnimation("waterfall",((t,e)=>({appear:SV(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t,!1)}))),yD(),aj(),ij(),CR.registerSeries(NV.type,NV)},WV=`${ZR}_BOX_PLOT_OUTLIER_VALUE`;var GV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(GV||(GV={}));const YV=(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={[WV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class $V extends $D{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return this.series.getOutliersField();if(t===GV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case GV.MIN:return this.series.getMinField();case GV.MAX:return this.series.getMaxField();case GV.MEDIAN:return this.series.getMedianField();case GV.Q1:return this.series.getQ1Field();case GV.Q3:return this.series.getQ3Field();case GV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return e[WV];if(t===GV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case GV.MIN:return e[this.series.getMinField()];case GV.MAX:return e[this.series.getMaxField()];case GV.MEDIAN:return e[this.series.getMedianField()];case GV.Q1:return e[this.series.getQ1Field()];case GV.Q3:return e[this.series.getQ3Field()];case GV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[WV])}getDefaultContentList(t){return[{key:this.getContentKey(GV.OUTLIER),value:this.getContentValue(GV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(GV.MAX),value:this.getContentValue(GV.MAX)},{key:this.getContentKey(GV.Q3),value:this.getContentValue(GV.Q3)},{key:this.getContentKey(GV.MEDIAN),value:this.getContentValue(GV.MEDIAN)},{key:this.getContentKey(GV.Q1),value:this.getContentValue(GV.Q1)},{key:this.getContentKey(GV.MIN),value:this.getContentValue(GV.MIN)},{key:this.getContentKey(GV.SERIES_FIELD),value:this.getContentValue(GV.SERIES_FIELD)}]}}class XV extends aD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=CR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const KV=()=>{CR.registerGraphicComponent("glyph",Rg),Kk(),Rk()},qV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],ZV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class JV extends XV{constructor(){super(...arguments),this.type=JV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=ZV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}JV.type="boxPlot";const QV=Object.assign(Object.assign({},rF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},eN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},iN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=iN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=iN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=iN(t,"box").attribute.width,i=iN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=iN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=iN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=iN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=iN(t,"box").attribute.height,i=iN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},nN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=iN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=iN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=iN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=iN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=iN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=iN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=iN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=iN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=iN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class rN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oN extends rN{computeAttribute(){return tN(nN)(this.target,this.params,this.params.options)}}class lN extends aN{computeAttribute(){return eN(nN)(this.target,this.params,this.params.options)}}class hN extends MF{constructor(){super(...arguments),this.type=$L.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(){this._boxPlotMark=this._createMark(hN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(hN.mark.outlier,{key:eO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>hR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>hR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>hR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>hR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>hR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;JO(this._dataSet,"foldOutlierData",YV),JO(this._dataSet,"addVChartProperty",HD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${ZR}_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:eF.bind(this),call:iF}},!1),this._outlierDataView=new eD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=kF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=CR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(gF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(pF(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(pF(null===(a=CR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new $V(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]}}hN.type=$L.boxPlot,hN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},hN.mark=QV;const cN=()=>{KV(),jk(),Gk(),CR.registerGraphicComponent("line",(t=>wg(t))),CR.registerGraphicComponent("rect",(t=>Pg(t))),CR.registerMark(JV.type,JV),ZF(),_D(),aj(),ij(),hw.registerBuiltInAnimate("boxplotScaleIn",rN),hw.registerBuiltInAnimate("boxplotScaleOut",aN),hw.registerBuiltInAnimate("barBoxplotScaleIn",oN),hw.registerBuiltInAnimate("barBoxplotScaleOut",lN),CR.registerSeries(hN.type,hN)};class dN extends aD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Yg(t):xg(t)}}dN.type="text";const uN=()=>{CR.registerMark(dN.type,dN),Kk(),Qk(),$k(),CR.registerGraphicComponent("text",xg),CR.registerGraphicComponent("richtext",Yg)};class pN extends $D{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 gN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fN={type:"fadeIn"},mN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vN(t,e){return"fadeIn"===e?fN:gN(t)}const _N=Object.assign(Object.assign({},PH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class yN extends OH{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 bN extends IH{constructor(){super(...arguments),this.type=$L.rangeColumn,this._barMarkType="rect",this._barName=$L.bar,this.transformerConstructor=yN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,bN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(bN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(bN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=kF(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(pF(null===(i=CR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),gF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(pF(null===(n=CR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),gF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pN(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)}}bN.type=$L.rangeColumn,bN.mark=_N,bN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},bN.transformerConstructor=yN;const xN=()=>{BH(),uN(),CR.registerAnimation("rangeColumn",((t,e)=>({appear:vN(t,e),enter:gN(t),exit:mN(t),disappear:mN(t)}))),yD(),aj(),ij(),CR.registerSeries(bN.type,bN)};var SN,AN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(SN||(SN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(AN||(AN={}));class kN extends $D{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 MN=Object.assign({},vH);class TN extends bH{constructor(){super(...arguments),this.type=$L.rangeArea}initMark(){this._areaMark=this._createMark(TN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new kN(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))}}TN.type=$L.rangeArea,TN.mark=MN;class wN extends SF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Tz,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:[]};FC(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:[]};FC(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(t.ChartEvent.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)&&AF(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 CN(t){return Xy(t)?Number.parseFloat(t):0}const EN=(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&&BN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[mz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[mz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},BN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===CN(t[e])))||!i&&0===t.reduce(((t,i)=>t+CN(i[e])),0)));function PN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:PN(t,!0,dI.appear)}),RN={type:"fadeIn"},ON=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:PN(t,!0,dI.enter)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:PN(t,!0,dI.exit)}),DN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:PN(t,!0,dI.exit)});function FN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return RN;case"growRadius":return LN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class zN extends aD{constructor(t,e){super(t,e),this.type=jN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[xz])[t]+s,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 jN extends zN{constructor(){super(...arguments),this.type=jN.type}}jN.type="arc";const HN=()=>{Kk(),wk(),vB("arc",CB),hw.registerBuiltInAnimate("growRadiusIn",fC),hw.registerBuiltInAnimate("growRadiusOut",mC),hw.registerBuiltInAnimate("growAngleIn",qw),hw.registerBuiltInAnimate("growAngleOut",Zw),CR.registerGraphicComponent("arc",ef),CR.registerMark(jN.type,jN)},VN=Object.assign(Object.assign({},rF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class NN extends xF{_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=wR({},this._theme,i,t);const n=(t,e)=>wR({},"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 UN=`${ZR}_LABEL_VISIBLE`;class WN extends wN{constructor(){super(...arguments),this.transformerConstructor=NN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:gR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:gR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kz,this._endAngle=Mz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[xz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;JO(this._dataSet,"pie",EN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:_z,asEndAngle:yz,asRatio:vz,asMiddleAngle:xz,asRadian:Az,asQuadrant:Sz,asK:bz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new eD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},WN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return WL(_z)(t)}endAngleScale(t){return WL(yz)(t)}_computeLayoutRadius(){return wz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:cR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:cR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:WL(UN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[xz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===dI.appear)return this._startAngle;if(i===dI.disappear)return this._endAngle;const r=[dI.disappear,dI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[eO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=pF(null===(i=CR.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]}}WN.transformerConstructor=NN,WN.mark=VN,WN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class GN extends WN{constructor(){super(...arguments),this.type=$L.pie}}GN.type=$L.pie;const YN=()=>{HN(),CR.registerAnimation("pie",((t,e)=>({appear:FN(t,e),enter:ON(t),exit:IN(t),disappear:DN(t)}))),CR.registerAnimation("emptyCircle",((t,e)=>({appear:FN(t,e)}))),CR.registerSeries(GN.type,GN)};function $N(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const XN=t=>({type:$N(t.growField),options:{overall:!0}}),KN={type:"fadeIn"},qN=t=>({type:$N(t.growField)}),ZN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},JN=ZN;function QN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KN;case"growAngle":return XN(Object.assign(Object.assign({},t),{growField:"angle"}));default:return XN(Object.assign(Object.assign({},t),{growField:"radius"}))}}class tU extends wN{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(oO),this.setInnerRadiusField(aO)}setValueFieldToPercent(){this.setRadiusField(hO),this.setInnerRadiusField(lO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const eU=Object.assign(Object.assign({},rF),{rose:{name:"rose",type:"arc"}});class iU extends xF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class sU extends zz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=CR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=kz,this._endAngle=Mz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):gz(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:gR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:gR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:hz(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(){VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):gz(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 FC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:FC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>pz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 wz((()=>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=Tz,e=0;const i=this.getChart().getSpec();return VL(this.getRegions(),(s=>{const n=s;if(r=n.type,[$L.rose,$L.radar,$L.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(wR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(wR({},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)}}sU.type=r.polarAxis,sU.specKey="axes";const nU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},rU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class aU extends sU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}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 JO(this._option.dataSet,t,DE),t}}aU.type=r.polarLinearAxis,aU.specKey="axes",aU.builtInTheme={axis:tj,axisLinear:Zz,axisAngle:rU,axisRadius:nU},G(aU,qz);const oU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(aU.type,aU)};class lU extends sU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,WE),t}transformScaleDomain(){}}lU.type=r.polarBandAxis,lU.specKey="axes",lU.builtInTheme={axis:tj,axisBand:nj,axisAngle:rU,axisRadius:nU},G(lU,sj);const hU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(lU.type,lU)};class cU extends tU{constructor(){super(...arguments),this.type=$L.rose,this.transformerConstructor=iU,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(){this._roseMark=this._createMark(cU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,cU.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=>hR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=hR(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(pF(null===(i=CR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),gF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}cU.type=$L.rose,cU.mark=eU,cU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},cU.transformerConstructor=iU;const dU=()=>{CR.registerSeries(cU.type,cU),HN(),CR.registerAnimation("rose",((t,e)=>({appear:QN(t,e),enter:qN(t),exit:ZN(t),disappear:JN(t)}))),hU(),oU()};class uU extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,LL(this._fromAngle,this._toAngle)&&LL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class pU extends Uw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!HL(t)&&!HL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const gU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function fU(t,e,i){return"fadeIn"===e?gU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function mU(t,e,i){return"fadeIn"===e?gU(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 vU=(t,e)=>({custom:Vw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),_U=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}});class yU extends tU{constructor(){super(...arguments),this.type=$L.radar,this.transformerConstructor=JF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(yU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:OD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):kz},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(pF(null===(s=CR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),gF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=CR.getAnimationInKey(e);t.setAnimationConfig(pF(null==i?void 0:i(n,r),gF(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}}}yU.type=$L.radar,yU.mark=_U,yU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=JF,G(yU,UF);const bU=()=>{CR.registerSeries(yU.type,yU),fH(),KF(),ZF(),CR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:fU(t,e,"in"),exit:fU(t,e,"out"),disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{channel:["points","center"],custom:pU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),CR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:mU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:mU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:uU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing}]}))),CR.registerAnimation("radarGroup",((t,e)=>({appear:vU(t,"in"),disappear:vU(t,"out")}))),wk(),hU(),oU()};class xU extends $D{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=>fi.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 SU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(ZR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[eO]:r,[iO]:`${s}_${e}`})),r++}))})),n},AU={fill:"#bbb",fillOpacity:.2},kU=Object.assign(Object.assign({},rF),{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 MU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),JO(this._option.dataSet,"objFlat",SU),JO(this._option.dataSet,"copyDataView",aI),QO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(wR(AU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(MU.mark.group),this._containerMark=this._createMark(MU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(MU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(MU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(MU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(MU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(MU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(MU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:sO}}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 aR).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:sO}}initTooltip(){this._tooltipHelper=new xU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}MU.type=$L.dot,MU.mark=kU,MU.builtInTheme={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"}}}}};class TU extends $D{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=>fi.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 wU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CU=(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 EU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),JO(this._option.dataSet,"linkDotInfo",CU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(EU.mark.group),this._containerMark=this._createMark(EU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(EU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(EU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:sO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new TU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}EU.type=$L.link,EU.mark=wU,EU.builtInTheme={link:{arrow:{style:{size:10}}}};const BU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"}});class PU extends wN{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()?aO:bO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?oO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):kz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):Mz,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=hR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=hR(this.angleAxisHelper.dataToPosition([t[oO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?hR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(PU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return ef(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 IU=()=>{CR.registerAnimation("circularProgress",((t,e)=>({appear:OU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class DU extends xF{constructor(){super(...arguments),this._supportStack=!0}}class FU extends PU{constructor(){super(...arguments),this.type=$L.circularProgress,this.transformerConstructor=DU,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(k(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(k(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(){return this._progressMark=this._createMark(FU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:vF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(FU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?aO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?oO: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",t.AttributeLevel.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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}FU.type=$L.circularProgress,FU.mark=LU,FU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},FU.transformerConstructor=DU;const zU=()=>{CR.registerSeries(FU.type,FU),HN(),IU(),yD(),hU(),oU()};function jU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:jU(t)}),VU={type:"fadeIn"};function NU(t,e="grow"){return!1===e?{}:"fadeIn"===e?VU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:jU(t)}))(t)}class UU extends $D{enableByType(t){return"dimension"!==t}}const WU=Object.assign(Object.assign({},rF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class GU extends MF{constructor(){super(...arguments),this.type=$L.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;return this._progressMark=this._createMark(GU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return hR(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+n},y1:t=>{var e,i;return hR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return hR(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 e,s;return hR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return hR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(pF(null===(i=CR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new UU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GU.type=$L.linearProgress,GU.mark=WU,GU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YU=()=>{BH(),CR.registerAnimation("linearProgress",((t,e)=>({appear:NU(t,e),enter:NU(t),disappear:HU(t)}))),yD(),CR.registerSeries(GU.type,GU)},$U=[0],XU=[20,40],KU=[200,500],qU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],JU=`${ZR}_WORD_CLOUD_TEXT`,QU=Object.assign(Object.assign({},rF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),tW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class eW extends SF{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=XU}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:KU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:$U,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)?JU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:$U,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZU.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 e;this._wordMark=this._createMark(eW.mark.word,{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(eW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(pF(CR.getAnimationInKey("wordCloud")(n,s),gF("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 aR).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:sO])}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 wE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new wE).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[eO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:iO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:df}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:jg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}eW.mark=QU,eW.builtInTheme={wordCloud:tW};function iW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=sW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},nW=(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=nW(t.children,e,t,n))})),s},rW=(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=rW(t.children,e,t,n)),n=e(t,s,i,n)})),n},aW=(t,e=[],i)=>{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):aW(t.children,e,i)))})),e};function oW(t,e){let i,s;if(cW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function cW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function gW(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 fW(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 mW(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 vW(t){return{_:t,next:null,prev:null}}function _W(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];gW(n,s,r);let a,o,l,h,c,d,u,p=vW(s),g=vW(n),f=vW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=sW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:SW.defaultOpionts.nodeSort;nW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)nW([o],yW(h)),rW([o],bW(this._getPadding,.5,a)),nW([o],xW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);nW([o],yW(SW.defaultOpionts.setRadius)),rW([o],bW(Lt,1,a)),c&&rW([o],bW(this._getPadding,o.radius/t,a)),nW([o],xW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}SW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const AW=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=AW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function kW(t){return t.depth}function MW(t,e){return e-1-t.endDepth}const TW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),wW=(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},CW={left:kW,right:MW,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:kW,end:MW},EW=yt(0,1);class BW{constructor(t){this._ascendingSourceBreadth=(t,e)=>TW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>TW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},BW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):CW[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)};"vertical"===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<=0)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))),"vertical"===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=[];AW(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:Mt(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+=Mt(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=[wW(s[t.source]),wW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*EW(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(TW),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(TW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];PW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),LW);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({},RW.defaultOpionts,t):Object.assign({},RW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=sW(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=he({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)}}}function OW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:PW,slice:OW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?OW:PW)(t,e,i,s,n)}};class FW{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({},FW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?IW(this.options.aspectRatio):null!==(e=DW[this.options.splitType])&&void 0!==e?e:DW.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=sW(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)}))}}function zW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=zW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=jW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function YW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*$W({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},KW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VW,s=e.lossFunction||HW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:XW(l),arcs:l})}))},qW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:ZW,triangle:ZW,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 ZW(){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 JW(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 QW=t=>qW[t]?qW[t]():qW.circle(),tG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function eG(t){return d(t)?t:function(){return t}}class iG{constructor(t){var e,i;switch(this.options=j({},iG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=QW(this.options.shape),this.getText=null!==(e=eG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=eG(this.options.fontWeight),this.getTextFontSize=eG(this.options.fontSize),this.getTextFontStyle=eG(this.options.fontStyle),this.getTextFontFamily=eG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>tG(10,50);break;case"random-light":this.getTextColor=()=>tG(50,90);break;default:this.getTextColor=eG(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 ae(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():Tt(e);return ae(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 nG extends iG{constructor(t){var e;super(j({},nG.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<=nG.defaultOptions.minFontSize&&(this.options.minFontSize=nG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=sG[this.options.spiral])&&void 0!==e?e:sG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=eG(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}=JW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}lG(p,this._size)&&(p=hG(p,this._size))}else if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||aG(p,i))&&(!i||!rG(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 rG(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 aG(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,lG=(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 hG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},dG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},uG=(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()},pG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=JW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=QW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)uG(n,dG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)uG(n,dG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=dG({x:l,y:h},o,-Math.PI/2,5),e=dG({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]);uG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal"),vo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},_o=Symbol.for("RenderService");const yo=new class{get renderService(){return this._renderService||(this._renderService=vo.get(_o)),this._renderService}};let bo=0;class xo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=yo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++bo,t),this.tryRunAnimationFrameNextFrame(),bo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class So{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ao=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ko=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mo=function(t,e){return function(i,s){e(i,s,t)}},To=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 wo=class extends So{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new xo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return To(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Co,Eo,Bo,Po;wo=Ao([Ya(),Mo(0,Wa(lo)),Mo(0,$a(fo)),ko("design:paramtypes",[Object])],wo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Eo||(Eo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Bo||(Bo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Po||(Po={}));const Lo=Ht-1e-8;class Ro{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Lo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Io=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Do={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},Fo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let zo,jo,Ho,Vo,No,Uo;var Wo,Go,Yo,$o,Xo,Ko;function qo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Zo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Qo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=al(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ll(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new hl(i,n),new hl(n,s)]}class hl extends tl{constructor(t,e){super(),this.type=Xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p1.x):t===$o.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class cl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new hl(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===$o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===$o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class dl extends cl{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 ul(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function pl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?$o.ROW:$o.COLUMN;return"monotoneY"===t?new dl(t,s):new cl(t,s)}class gl{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 fl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new gl(n,s),t),n}function ml(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 vl{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&&ml(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:ml(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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("basis",i,t);return function(t,e){ul(t,e,2)}(new vl(n,s),t),n}function yl(t){return t<0?-1:1}function bl(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(yl(r)+yl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function xl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Sl(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 Al{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:Sl(this,this._t0,xl(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,Sl(this,xl(this,e=bl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Sl(this,this._t0,e=bl(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 kl extends Al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneX",i,t);return function(t,e){ul(t,e,2)}(new Al(n,s),t),n}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneY",i,t);return function(t,e){ul(t,e,2)}(new kl(n,s),t),n}let wl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Cl extends wl{lineEnd(){this.context.closePath()}}function El(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new wl(r,e,n),t),r}function Bl(t,e){return ul(t,e,1)}class Pl extends gl{lineEnd(){this.context.closePath()}}function Ll(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new Pl(n,s),t),n}function Rl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ol(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return fl(i,n);const o=pl(t,r,i);return ul(new e(o,s,a),i,2),o}}const Il=Ol("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Rl(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 Dl=Ol("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Rl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Fl extends tl{constructor(t,e,i){super(),this.type=Xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return rl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,el([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p2.x):t===$o.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=rl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Fl(i,a,r),new Fl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class zl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new hl(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Fl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function jl(t,e,i){var s,n;switch(e){case"linear":default:return fl(t,i);case"basis":return _l(t,i);case"monotoneX":return Ml(t,i);case"monotoneY":return Tl(t,i);case"step":return El(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new Cl(r,e,n),t),r}(t,.5,i);case"stepBefore":return El(t,0,i);case"stepAfter":return El(t,1,i);case"catmullRom":return Il(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Ll(t,i)}}class Hl extends Oo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ro(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Fo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Fo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Fo.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([Fo.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([Fo.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([Fo.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([Fo.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([Fo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Fo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new zl(this);Qo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Fo.M]=t=>`M${t[1]} ${t[2]}`,t[Fo.L]=t=>`L${t[1]} ${t[2]}`,t[Fo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Fo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Fo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Fo.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;tUo){let t,e=Ho;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Qo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===$o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===$o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),nh=Object.assign(Object.assign({},ql),{points:[],cornerRadius:0,closePath:!0}),rh=Object.assign(Object.assign({},ql),{width:100,height:100,spikes:5,thickness:.5}),ah=Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const oh=Object.assign(Object.assign({},ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),lh=Object.assign(Object.assign(Object.assign({},ql),$l),{strokeBoundsBuffer:0,keepDirIn3d:!0}),hh=Object.assign(Object.assign(Object.assign({},ql),$l),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ch=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},ql),{fill:!0,cornerRadius:0,cornerType:"round"}),dh=Object.assign(Object.assign({},ch),{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}),uh=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&&_(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 ph{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ph.IsGradientStr(t))try{const e=uh(t)[0];if(e){if("linear"===e.type)return ph.ParseLinear(e);if("radial"===e.type)return ph.ParseRadial(e);if("conic"===e.type)return ph.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:ph.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:ph.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const mh={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"}},vh=!0,_h=!1,yh=/\w|\(|\)|-/,bh=/[.?!,;:/,。?!、;:]/,xh=/\S/,Sh=(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})};function Ah(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=yo.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=kh(t,a)),a}function kh(t,e,i=!1){let s=e;for(;yh.test(t[s-1])&&yh.test(t[s])||bh.test(t[s]);)if(s--,s<=0)return i?Mh(t,e):e;return s}function Mh(t,e){let i=e;for(;yh.test(t[i+1])&&yh.test(t[i])||bh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Th(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=yo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}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};let Ch=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=lh.fontSize}){let i=0,s=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=kh(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,a=!1){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=kh(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}};Ch=wh([Ya()],Ch);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};const Bh=Symbol.for("TextMeasureContribution");let Ph=class extends Ch{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ph=Eh([Ya()],Ph);const Lh=Symbol.for("CanvasFactory"),Rh=Symbol.for("Context2dFactory");function Oh(t){return vo.getNamed(Lh,yo.global.env)(t)}const Ih=1e-4,Dh=Math.sqrt(3),Fh=1/3;function zh(t){return t>-Zh&&tZh||t<-Zh}const Hh=[0,0],Vh=[0,0],Nh=[0,0];function Uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Wh(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 Yh(t){return(t%=Vt)<0&&(t+=Vt),t}function $h(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function qh(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(zh(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 Qh=[-1,-1,-1],tc=[-1,-1];function ec(){const t=tc[0];tc[0]=tc[1],tc[1]=t}function ic(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(zh(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,Fh):Math.pow(i,Fh),s=s<0?-Math.pow(-s,Fh):Math.pow(s,Fh);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+Dh*Math.sin(e)))/(3*a),h=(-o+i*(s-Dh*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,Qh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&ec(),p=Gh(e,s,r,o,tc[0]),u>1&&(g=Gh(e,s,r,o,tc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(zh(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,Qh);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=Wh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Qh[0]=-l,Qh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Qh[0]+t&&a<=Qh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Qh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function rc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function ac(t,e){let i=rc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-rc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;oc[0]=S,oc[1]=A,ac(oc,Boolean(a[6])),S=oc[0],A=oc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Fo.M:u=m,p=v,c=u,d=p;break;case Fo.L:if(i){if(qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Fo.C:if(i){if(Xh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Fo.Q:if(i){if($h(c,d,m,v,_,y,e,s,n))return!0}else h+=sc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Fo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Kh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=nc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Fo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(qh(u,p,o,p,e,s,n)||qh(o,p,o,l,e,s,n)||qh(o,l,u,l,e,s,n)||qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Fo.Z:if(i){if(qh(c,d,u,p,e,s,n))return!0}else h+=Le(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},dc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const uc=Symbol.for("VWindow"),pc=Symbol.for("WindowHandlerContribution");let gc=class extends So{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(vo.getNamed(pc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=yo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};gc=cc([Ya(),dc("design:paramtypes",[])],gc);var fc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vc=function(t,e){return function(i,s){e(i,s,t)}};let _c=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=yo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=hc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:$l.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:$l.fontFamily,fontSize:$l.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=vo.get(uc),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 yc;_c=fc([Ya(),vc(0,Wa(lo)),vc(0,$a(Bh)),mc("design:paramtypes",[Object])],_c),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(yc||(yc={}));const bc=new Ue;let xc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=yc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=yc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}scale(t,e,i){return this.mode===yc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===yc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return bc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}translate(t,e){return this.mode===yc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===yc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};xc=fc([Ya(),mc("design:paramtypes",[])],xc);const Sc={arc:Zl,area:Jl,circle:Ql,line:ih,path:sh,symbol:oh,text:lh,rect:ah,polygon:nh,star:rh,richtext:hh,richtextIcon:dh,image:ch,group:th,glyph:eh},Ac=Object.keys(Sc);function kc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Mc={arc:Object.assign({},Sc.arc),area:Object.assign({},Sc.area),circle:Object.assign({},Sc.circle),line:Object.assign({},Sc.line),path:Object.assign({},Sc.path),symbol:Object.assign({},Sc.symbol),text:Object.assign({},Sc.text),rect:Object.assign({},Sc.rect),polygon:Object.assign({},Sc.polygon),star:Object.assign({},Sc.star),richtext:Object.assign({},Sc.richtext),richtextIcon:Object.assign({},Sc.richtextIcon),image:Object.assign({},Sc.image),group:Object.assign({},Sc.group),glyph:Object.assign({},Sc.glyph)};class Tc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Ac.forEach((t=>{this._defaultTheme[t]=Object.create(Mc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Ac.forEach((s=>{const n=Object.create(Mc[s]);t&&t[s]&&kc(n,t[s]),i[s]&&kc(n,i[s]),e[s]&&kc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Ac.forEach((t=>{kc(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 wc=new Tc;function Cc(t,e){return t.glyphHost?Cc(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)):wc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Cc(t.attachedThemeGraphic)||wc.getTheme()}var Ec=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 Bc 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ec(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Rc))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(Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Dc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Fc(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(Fc(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,Fc(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 Rc))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"):Fc(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 Oc))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=Dc.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 zc(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 Rc,this.rootWheelEvent=new Oc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Nc{static GetImage(t,e){var i;const s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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):Nc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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"},Nc.cache.set(t,s),s.dataPromise=yo.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=Nc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Nc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=yo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=yo.global.loadBlob(t):"json"===e&&(i.dataPromise=yo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Nc.isLoading&&Nc.toLoadAueue.length){Nc.isLoading=!0;const t=Nc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Nc.cache.set(i,n),n.dataPromise=yo.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((()=>{Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()})).catch((t=>{console.error(t),Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()}))}}),0)}static loadImage(t,e){const i=Uc(t,Nc.toLoadAueue);if(-1!==i)return Nc.toLoadAueue[i].marks.push(e),void Nc.loading();Nc.toLoadAueue.push({url:t,marks:[e]}),Nc.loading()}static improveImageLoading(t){const e=Uc(t,Nc.toLoadAueue);if(-1!==e){const t=Nc.toLoadAueue.splice(e,1);Nc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Uc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Yc[0]=t[0],Yc[2]=t[0],Yc[1]=t[1],Yc[3]=t[1],Yc):t:t:0,Xc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Kc=[1,2,3,0,1,2,3,0];function qc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Xc[0].x=i,Xc[1].y=i,Xc[2].x=-i,Xc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}td.TimeOut=1e3/60;const ed=new td,id=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class sd{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 nd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var rd=new class extends sd{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 nd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return nd(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 ad=new class extends sd{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 od(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 ld=new class extends sd{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 od(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}};function hd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var cd=new class extends sd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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)}};function dd(t,e,i,s,n=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 ud extends sd{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 dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}}var pd=new ud;var gd=new class extends ud{constructor(){super(...arguments),this.type="triangle"}};const fd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),md=Math.sin(Ht/10)*fd,vd=-Math.cos(Ht/10)*fd;function _d(t,e,i,s){const n=md*e,r=vd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 yd=new class extends sd{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 _d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return _d(t,this.parseSize(e)/2+n,i,s)}};const bd=Xt(3);function xd(t,e,i,s){const n=e,r=n/bd,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 Sd=new class extends sd{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 xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function Ad(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 kd=new class extends sd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2+n,i,s)}};function Md(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Td=new class extends sd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};const wd=-.5,Cd=Xt(3)/2,Ed=1/Xt(12);function Bd(t,e,i,s){const n=e/2,r=e*Ed,a=n,o=e*Ed+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(wd*n-Cd*r+i,Cd*n+wd*r+s),t.lineTo(wd*a-Cd*o+i,Cd*a+wd*o+s),t.lineTo(wd*l-Cd*h+i,Cd*l+wd*h+s),t.lineTo(wd*n+Cd*r+i,wd*r-Cd*n+s),t.lineTo(wd*a+Cd*o+i,wd*o-Cd*a+s),t.lineTo(wd*l+Cd*h+i,wd*h-Cd*l+s),t.closePath(),!1}var Pd=new class extends sd{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 Bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2+n,i,s)}};function Ld(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 Rd=new class extends sd{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 Ld(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends sd{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=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 Fd=new class extends sd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};const zd=Xt(3);function jd(t,e,i,s){const n=e*zd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Hd=new class extends sd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return jd(t,this.parseSize(e)/2/zd,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2/zd+n,i,s)}};function Vd(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 Nd=new class extends sd{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Wd=new class extends sd{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends sd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends sd{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var qd=new class extends sd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Jd=new class extends sd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(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 tu=new class extends sd{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 Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(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 eu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function iu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var su=new class extends sd{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)?iu(t,e,i,s):eu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?iu(t,e+2*n,i,s):eu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const nu=new Ve;class ru{constructor(t,e,i=!1){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(),Qo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Qo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{nu.x1=i.bounds.x1*t,nu.y1=i.bounds.y1*t,nu.x2=i.bounds.x2*t,nu.y2=i.bounds.y2*t,e.union(nu)}))}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 au={};[rd,ad,ld,cd,Hd,gd,yd,Sd,kd,Td,Pd,Rd,Id,pd,Fd,Nd,Wd,Yd,Xd,su,qd,Jd,tu].forEach((t=>{au[t.type]=t}));const ou={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class lu{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 hu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function cu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=cu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=hu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=cu(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 lu(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 lu(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 pu(t,e){return gu(t)}function gu(t,e){const i={};for(let e=0;eAu.set(t,!0)));const ku=new Map;function Mu(t){if(Au.has(t))return!0;if(ku.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>ku.set(t,!0)));const Tu=xu(),wu=xu(),Cu=xu(),Eu=xu(),Bu=xu(),Pu=xu(),Lu=xu(),Ru=xu(),Ou=xu(),Iu=xu();xu();const Du=xu();xu();const Fu=xu();xu();const zu=xu(),ju=xu(),Hu=Symbol.for("GraphicService"),Vu=Symbol.for("GraphicCreator"),Nu={"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"},Uu=Object.keys(Nu),Wu={duration:200,easing:"cubicOut"};function Gu(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 Yu(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 $u(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 Xu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ku(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 qu{constructor(){this.pools=[]}static identity(t){return Gu(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 qu.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},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ep=new Ue(1,0,0,1,0,0),ip={x:0,y:0};let sp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Hl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Zu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}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,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ip),function(t,e,i){return lc(t,0,!1,e,i)}(this.path.commandList,ip.x,ip.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ip);const i=gh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return lc(t,e,!0,i,s)}(this.path.commandList,i,ip.x,ip.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(t=!0,e=this.dpr){this.setTransformFromMatrix(ep,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};sp=Qu([Ya(),tp("design:paramtypes",[Object,Number])],sp);const np={WIDTH:500,HEIGHT:500,DPR:1};class rp{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}set nativeCanvas(t){this._nativeCanvas=t}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=np.WIDTH,height:n=np.HEIGHT,dpr:r=np.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var ap;rp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ap||(ap={}));class op{static Get(t,e=ap.Color1,i=[0,0,0,1]){if(e===ap.Color1){const e=op.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];op.store1[t]=e,op.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=op.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(op.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],op.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===ap.Color1){if(op.store1[t])return;op.store1[t]=i,op.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(op.store255[t])return;op.store255[t]=i,op.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function lp(t,e=!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 hp(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)=>{var a,o;return cp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):cp(t,e,i,s,n)}function cp(t,e,i,s,n){if(!t||!e)return t&&lp(t)||e&&lp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=op.Get(t,ap.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=op.Get(e,ap.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:lp(a)})))});return o?hp(r,l,i,s,n):hp(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:gp(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:gp(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:gp(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),lp(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)}function dp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}op.store255={},op.store1={};const up=[0,0,0,0],pp=[0,0,0,0];function gp(t,e,i){return op.Get(t,ap.Color255,up),op.Get(e,ap.Color255,pp),`rgba(${Math.round(up[0]+(pp[0]-up[0])*i)},${Math.round(up[1]+(pp[1]-up[1])*i)},${Math.round(up[2]+(pp[2]-up[2])*i)},${up[3]+(pp[3]-up[3])*i})`}class fp{static GetCanvas(){try{return fp.canvas||(fp.canvas=yo.global.createCanvas({})),fp.canvas}catch(t){return null}}static GetCtx(){if(!fp.ctx){const t=fp.GetCanvas();fp.ctx=t.getContext("2d")}return fp.ctx}}class mp extends We{static getInstance(){return mp._instance||(mp._instance=new mp),mp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=fp.GetCanvas(),s=fp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new mp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class vp{static GetSize(t){for(let e=0;e=t)return vp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=vp.GenKey(t,e,i,s,n),l=vp.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=vp.GenKey(t,e,i,s,n);vp.cache[l]?vp.cache[l].push({width:a,height:o,pattern:r}):vp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}vp.cache={},vp.ImageSize=[20,40,80,160,320,640,1280,2560];const _p=new Ve,yp=new Ue;new Ve;const bp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],xp=["x","y"],Sp=["scaleX","scaleY"],Ap=["angle"],kp=new ne,Mp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Bc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=au[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===((i=t=ou[t]||t).startsWith("{const e=(new Hl).fromString(t.d),i={};Uu.forEach((e=>{t[e]&&(i[Nu[e]]=t[e])})),n.push({path:e,attribute:i}),_p.union(e.bounds)}));const r=_p.width(),a=_p.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ru(t,n,!0);return Tp.userSymbolMap[t]=l,l}var i;const s=(new Hl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new ru(t,s);return Tp.userSymbolMap[t]=o,o}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=$c(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 Ro(t);return Qo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Wo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Wo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Wo.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&Wo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Wo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Go.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Wu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Yo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Yo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Yo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Wo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Wo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Wo.UPDATE_SHAPE_AND_BOUNDS)===Wo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Wo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Wo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Wo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Wo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Wo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Wo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}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&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),yo.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=yp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:yo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Hl).fromString(t):this.pathProxy=new Hl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),yo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Ic(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||yo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new sp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var wp;Tp.userSymbolMap={},Tp.mixin(jc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(wp||(wp={}));let Cp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Pu,this._childUpdateTag=Wo.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 Tc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tc)}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===Go.GLOBAL){const i=new ne(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&Wo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=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 Cc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return yo.graphicService.updateTempAABBBounds(i),yo.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&=Wo.CLEAR_BOUNDS,this._childUpdateTag&=Wo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Wo.UPDATE_BOUNDS||(this._childUpdateTag|=Wo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Wo.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=yo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Ep(t){return new Cp(t)}Cp.NOWORK_ANIMATE_ATTR=Mp;class Bp extends Cp{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 Tc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{yo.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=>{yo.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 Pp=Symbol.for("TransformUtil"),Lp=Symbol.for("GraphicUtil"),Rp=Symbol.for("LayerService"),Op=Symbol.for("StaticLayerHandlerContribution"),Ip=Symbol.for("DynamicLayerHandlerContribution"),Dp=Symbol.for("VirtualLayerHandlerContribution");var Fp,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)};let Hp=Fp=class{static GenerateLayerId(){return`${Fp.idprefix}_${Fp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=yo.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?vo.get(Op):"dynamic"===t?vo.get(Ip):vo.get(Dp),e}createLayer(t,e={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 Bp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Fp.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)}};Hp.idprefix="visactor_layer",Hp.prefix_count=0,Hp=Fp=zp([Ya(),jp("design:paramtypes",[])],Hp);var Vp=new Ra((t=>{t(mo).to(wo).inSingletonScope(),t(uc).to(gc),t(Lp).to(_c).inSingletonScope(),t(Pp).to(xc).inSingletonScope(),t(Rp).to(Hp).inSingletonScope()}));function Np(t,e){return!(!t&&!e)}function Up(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Wp(t,e,i){return i&&t*e>0}function Gp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Yp(t,e){return t*e>0}function $p(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Xp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Kp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Kp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Xp(g,f,u,p,n,t,Number(c)),l=Xp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Xp(S,A,b,x,r,-n,Number(c)),l=Xp(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const Zp=Symbol.for("ArcRenderContribution"),Jp=Symbol.for("AreaRenderContribution"),Qp=Symbol.for("CircleRenderContribution"),tg=Symbol.for("GroupRenderContribution"),eg=Symbol.for("ImageRenderContribution"),ig=Symbol.for("PathRenderContribution"),sg=Symbol.for("PolygonRenderContribution"),ng=Symbol.for("RectRenderContribution"),rg=Symbol.for("SymbolRenderContribution"),ag=Symbol.for("TextRenderContribution"),og=Symbol.for("InteractiveSubRenderContribution");function lg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function hg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}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)}};function pg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Gu(t),Yu(t,t,[n+o,r+l,a+h]),Yu(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),Yu(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]),f){const i=Ju.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]}Yu(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),Yu(i,i,[-s[0],-s[1],0]),Xu(t,t,i)}}let gg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Ro(t);return Qo(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=hg(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=lg(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){yu(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;yu(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};gg=cg([Ya(),ug(0,Wa(Vu)),dg("design:paramtypes",[Object])],gg);const fg=(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},mg=["radius","startAngle","endAngle",...bp];class vg extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Eu}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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.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>Vt-Ft?i.set(-r,-r,r,r):qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mg)}needUpdateTag(t){return super.needUpdateTag(t,mg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Hl,s.arc(0,0,r,a,o),s}clone(){return new vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vg.NOWORK_ANIMATE_ATTR}}function _g(t){return new vg(t)}vg.NOWORK_ANIMATE_ATTR=Mp;class yg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Co.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=ju,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 Cc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new xg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=yo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){yu(n,o/Math.abs(r+a),!0,l),i.union(n)}return yo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new yg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new yg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=lg(_,a),e=this.cache.verticalList.length*v,i=hg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Su.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=lg(_,a),S=this.cache.verticalList.length*v,A=hg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=id(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=bg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=bg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return xg.baselineMapAlign}getAlignMapBaseline(){return xg.alignMapBaseline}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Mp),xg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},xg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Ag=["symbolType","size",...bp];let kg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=zu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Cc(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}=yo.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;yu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return yo.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,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}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 Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Mp);const Tg=["segments","points","curveType","curveTension",...bp];let wg=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=Ru}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=Jc(i,s,e))}getGraphicTheme(){return Cc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Hl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const Eg=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}},Bg=["width","x1","y1","height","cornerRadius",...bp];class Pg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=Du}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Eg(e);return t=new Hl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Mp;class Rg extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=Bu,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,e=!1,i){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 Cc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Rg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Og(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Mp;class Ig{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=mh[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}}}function Dg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Fg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=id(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Th(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Th(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Dg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Ah(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Th(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const zg=["width","height","image",...bp];class jg extends Tp{constructor(t){super(t),this.type="image",this.numberType=Lu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Cc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ch[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}clone(){return new jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Mp);class Vg extends jg{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=$c(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=$c(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=ch.width,height:e=ch.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 Ng{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 Vg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Fg){const e=xh.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 Vg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Th(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)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||_h;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,Sh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?fh(t,s,{AABBBounds:i}):s,Sh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Vg)break;const{width:n}=Th(t,s.character,s.ascentDescentMode),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 Vg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ug{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=mh[this.direction]}store(t){if(t instanceof Vg){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 Ng(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,e=!1){t instanceof Vg?"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||this.newLine)&&("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=Ah(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 Fg(i,t.newLine,t.character,t.ascentDescentMode),new Fg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Wg=!1;try{Wg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Wg=!1}const Gg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...bp];class Yg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Fu,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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Cc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1)))}static splitText(t){if(Wg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Yg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),yo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}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;e0&&!Yg.AllSingleCharacter(_)&&(_=Yg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Ig(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ug(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Yg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Yg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Mp);const Xg=["path","customPath",...bp];class Kg extends Tp{constructor(t){super(t),this.type="path",this.numberType=Ou}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 Cc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return yo.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,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){return(new Hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Mp);const Zg=["segments","points","curveType","curveTension",...bp];class Jg extends Tp{constructor(t){super(t),this.type="area",this.numberType=Cu}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 Cc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Hl;const 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 Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const tf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...bp];class ef extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Tu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return yo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(qc(l,o,s,i),qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Mp);const nf=["points","cornerRadius",...bp];class rf extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Cc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Hl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Mp;class of extends Cp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function lf(t){return new of(t)}const hf=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 cf,df;function uf(t){return cf||(cf=hf.CreateGraphic("text",{})),cf.initAttributes(t),cf.AABBBounds}var pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gf=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)}};class mf{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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Cc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=hc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),hc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const vf=new mf;let _f=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)}))}};_f=pf([Ya(),ff(0,Wa(lo)),ff(0,$a(og)),gf("design:paramtypes",[Object])],_f);const yf=new 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){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const bf=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,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class xf{constructor(){this.time=Ko.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=hc.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])),hc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=hc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Mg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:gh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),qp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},kf=Sf,Mf=vf;const Tf=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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:gh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},wf=Sf,Cf=vf;const Ef=new class extends mf{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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Bf=zt/2;function Pf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Bf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Bf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Bf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Bf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Rf{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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:gh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Pf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Of=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)}};Of=Lf([Ya()],Of);let If=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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Pf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};If=Lf([Ya()],If);const Df=new Rf,Ff=Sf,zf=vf;const jf=new class extends Rf{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)}},Hf=vf;const Vf=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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:gh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Nf=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,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Uf=Sf,Wf=vf;const Gf={x:0,y:0,z:0,lastModelMatrix:null};class Yf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(yf),this.builtinContributions.push(bf),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)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Cc(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,_=Wp(d,u,h),y=Yp(d,g),b=Np(h),x=Up(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Qo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Wp(o,l,n),p=Yp(o,c),g=Np(n,r),f=Up(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,s=!1){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;Gf.x=n,Gf.y=r,Gf.z=a,Gf.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=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(s,d||s,n),Gf.x=0,Gf.y=0,Gf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Ju.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,Gf.z=a,i.setTransformForCurrent()}else if(p)Gf.x=0,Gf.y=0,Gf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,this.transformWithoutTranslate(i,Gf.x,Gf.y,Gf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Gf.x=0,Gf.y=0,Gf.z=0;return Gf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Ju.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Xf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let qf=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[Af,Mf,kf],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=Xp(v,_,f,m,n,t,Number(u)),o=Xp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Xp(M,T,A,k,r,-n,Number(u)),o=Xp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Gc[s]=t,i&&(i=!(null!==(e=Gc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Gc[e]=!!t[e],i&&(i=!!Gc[e]);else Gc[0]=!1,Gc[1]=!1,Gc[2]=!1,Gc[3]=!1;return{isFullStroke:i,stroke:Gc}})(d);if((_||E)&&(e.beginPath(),qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),qp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),hp(o.color,l.color,h,!1)}(0,0,h,n);a||Wp&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};qf=$f([Ya(),Kf(0,Wa(lo)),Kf(0,$a(Zp)),Xf("design:paramtypes",[Object])],qf);var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Tf,Cf,wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function em(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]=al(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 im(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 sm(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=im(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),em(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=$o.ROW:"y"===s?u=$o.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 rm=class extends Yf{constructor(){super(...arguments),this.numberType=Ru}draw(t,e,i,s){const n=Cc(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;if(!e)return;t.beginPath();sm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=jl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function am(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),em(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),em(t,l,1,s),o=!1):o=!0}t.closePath()}rm=nm([Ya()],rm);const om=new class extends xf{constructor(){super(...arguments),this.time=Ko.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Qc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Qc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Qc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Qc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},lm=vf;var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[om,lm],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=Cc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=jl(B(t.points,x),E,{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=jl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=jl(e,E,{curveTension:b}),n=jl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Cc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=$o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?$o.ROW:null==_.y1?$o.COLUMN:Number.isFinite(S+A)?S>A?$o.ROW:$o.COLUMN:$o.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?$o.ROW:$o.COLUMN,Number.isFinite(c)||(o=$o.COLUMN),Number.isFinite(d)||(o=$o.ROW);const u=i*(o===$o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),sm(t,i[0]?e.top:e.bottom,l,x===$o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};um=hm([Ya(),dm(0,Wa(lo)),dm(0,$a(Jp)),cm("design:paramtypes",[Object])],um);const pm=Sf,gm=vf;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},mm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vm=function(t,e){return function(i,s){e(i,s,t)}};let _m=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[gm,pm],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:Cc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Qo(t.pathShape.commandList,e,i,s,1,1,f);else{Qo((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,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=Cc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};_m=fm([Ya(),vm(0,Wa(lo)),vm(0,$a(ig)),mm("design:paramtypes",[Object])],_m);var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Du,this.builtinContributions=[Df,zf,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Gp(g,f,T,w,h),E=$p(g,v,T,w,M),B=Np(h,c),P=Up(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Pf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Sm=ym([Ya(),xm(0,Wa(lo)),xm(0,$a(ng)),bm("design:paramtypes",[Object])],Sm);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)},Mm=function(t,e){return function(i,s){e(i,s,t)}};let Tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Vf,Wf,Uf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Cc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Tm=Am([Ya(),Mm(0,Wa(lo)),Mm(0,$a(rg)),km("design:paramtypes",[Object])],Tm);const wm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Cm=new class extends mf{constructor(){super(...arguments),this.time=Ko.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=wm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=uf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Pf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&wm.free(E),C()}};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)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Lm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Cm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Cc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=id(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(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)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Cc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:lg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Rm(t,e,i,s){if(e&&e.length){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},jm=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 Vm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Fm,Dm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Rm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Rm(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,_=v/m;const y=Om(d,u),b=Om(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Im(h,_,y,d,u),A=Im(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Om(k,M),w=Im(h,Om(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Vm=zm([Ya(),Hm(0,Wa(lo)),Hm(0,$a(sg)),jm("design:paramtypes",[Object])],Vm);var Nm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Um=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 Gm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Pu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Cc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Gp(p,m,g,f,c),C=$p(p,v,g,f),E=Np(c,u),B=Up(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Pf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Ko.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ko.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=yo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Cc(t,null==s?void 0:s.theme).group,i=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(i,p||i,n),a.modelMatrix=i,Ju.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ju.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Gm=Nm([Ya(),Wm(0,Wa(lo)),Wm(0,$a(tg)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};const Km=["","repeat-x","repeat-y","repeat"];let qm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[jf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Pf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Km[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Nc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Cc(t).image;this._draw(t,a,!1,i)}};qm=Ym([Ya(),Xm(0,Wa(lo)),Xm(0,$a(eg)),$m("design:paramtypes",[Object])],qm);const Zm=Symbol.for("IncrementalDrawContribution"),Jm=Symbol.for("ArcRender"),Qm=Symbol.for("AreaRender"),tv=Symbol.for("CircleRender"),ev=Symbol.for("GraphicRender"),iv=Symbol.for("GroupRender"),sv=Symbol.for("LineRender"),nv=Symbol.for("PathRender"),rv=Symbol.for("PolygonRender"),av=Symbol.for("RectRender"),ov=Symbol.for("SymbolRender"),lv=Symbol.for("TextRender"),hv=Symbol.for("RichTextRender"),cv=Symbol.for("GlyphRender"),dv=Symbol.for("ImageRender"),uv=Symbol.for("DrawContribution"),pv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===wu,!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+=Vt;for(;o<0;)o+=Vt;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 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},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mv=Symbol.for("DrawItemInterceptor"),vv=new Ve,_v=new Ve;class yv{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){vv.copy(s.dirtyBounds),_v.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(vv),s.backupDirtyBounds.copy(_v)),!0}}class bv{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 xv=class{constructor(){this.order=1,this.interceptors=[new yv,new Av,new Sv,new bv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Ju.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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},Mv=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)}};let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=kv([Ya(),Tv(0,Wa(uv)),Mv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(_o).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=Cc(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 ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=pv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(Hu).to(gg),t(Vu).toConstantValue(hf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&vo.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Bh).to(Ph).inSingletonScope(),co(t,Bh)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=yo.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=Oh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Op).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=yo.global,this.layerService=yo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Zu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,ql.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=wm.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())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),wm.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||vo.get(Zm);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 h_=class extends rm{constructor(){super(...arguments),this.numberType=Ru}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=Cc(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=Wp(u,p,c),_=Yp(u,g),y=Np(c),b=Up(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends um{constructor(){super(...arguments),this.numberType=Cu}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=Cc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Wp(u,d,c),f=Np(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,ql.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,ql.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(ev)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(mv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(mf).toSelf().inSingletonScope(),t(xf).toSelf().inSingletonScope(),t(uv).to(o_),t(Zm).to(v_),t(iv).to(Gm).inSingletonScope(),t(ev).toService(iv),co(t,tg),t(_f).toSelf().inSingletonScope(),co(t,og),co(t,ev),t(xv).toSelf().inSingletonScope(),t(mv).toService(xv),co(t,mv)}));function y_(){y_.__loaded||(y_.__loaded=!0,vo.load(Vp),vo.load(jv),vo.load(Cv),vo.load(zv),vo.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(vo),function(t){t.load(__)}(vo))}y_.__loaded=!1,y_();const b_=vo.get(mo);yo.global=b_;const x_=vo.get(Lp);yo.graphicUtil=x_;const S_=vo.get(Pp);yo.transformUtil=S_;const A_=vo.get(Hu);yo.graphicService=A_;const k_=vo.get(Rp);yo.layerService=k_;class M_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class T_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=yo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=yo.global.getRequestAnimationFrame();this.rafId=t((()=>{yo.global.devicePixelRatio!==this.dpr&&(this.dpr=yo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=yo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,yo.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 C_=new Ve;class E_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(C_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(C_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=yo.global&&yo.global.env;return t?"browser"===t:B_}let L_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};L_._pluginClasses={};const R_="white";class O_ extends Cp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Tc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=yo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=vo.get(uc),this.renderService=vo.get(_o),this.pluginService=vo.get(Vv),this.layerService=vo.get(Rp),this.graphicService=vo.get(Hu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Vc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=L_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=L_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=L_.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 M_))}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 T_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new E_,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=L_.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=L_.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=L_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=vo.get(uc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=vo.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},D_=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 F_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return D_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};F_=I_([Ya()],F_);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 H_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};H_=z_([Ya(),j_("design:paramtypes",[])],H_);var V_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},N_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},U_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=yo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Cc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=Cc(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&&Ju.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}};function G_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Y_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function J_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),sy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ny=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return sy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return sy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ny(n[0],s,i),ny(n[1],e-s,i)}};let ry=!1;const ay=new Ra((t=>{ry||(ry=!0,t(qf).toSelf().inSingletonScope(),t(Jm).to(qf).inSingletonScope(),t(ev).toService(Jm),t(Zp).toService(_f),co(t,Zp))}));let oy=!1;const ly=new Ra((t=>{oy||(oy=!0,t(Sm).toSelf().inSingletonScope(),t(av).to(Sm).inSingletonScope(),t(ev).toService(av),t(If).toSelf(),t(Of).toSelf(),t(ng).toService(If),t(ng).toService(Of),t(ng).toService(_f),co(t,ng))}));let hy=!1;const cy=new Ra((t=>{hy||(hy=!0,t(rm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(sv).to(rm).inSingletonScope(),t(ev).toService(sv))}));let dy=!1;const uy=new Ra((t=>{dy||(dy=!0,t(um).toSelf().inSingletonScope(),t(Qm).to(um).inSingletonScope(),t(ev).toService(Qm),t(Jp).toService(_f),co(t,Jp),t(d_).toSelf().inSingletonScope())}));let py=!1;const gy=new Ra((t=>{py||(py=!0,t(Tm).toSelf().inSingletonScope(),t(ov).to(Tm).inSingletonScope(),t(ev).toService(ov),t(rg).toService(_f),co(t,rg))}));let fy=!1;const my=new Ra((t=>{fy||(fy=!0,t(tm).toSelf().inSingletonScope(),t(tv).to(tm).inSingletonScope(),t(ev).toService(tv),t(Qp).toService(_f),co(t,Qp))}));let vy=!1;const _y=new Ra((t=>{vy||(vy=!0,t(lv).to(Lm).inSingletonScope(),t(ev).toService(lv),t(ag).toService(_f),co(t,ag))}));let yy=!1;const by=new Ra((t=>{yy||(yy=!0,t(_m).toSelf().inSingletonScope(),t(nv).to(_m).inSingletonScope(),t(ev).toService(nv),t(ig).toService(_f),co(t,ig))}));let xy=!1;const Sy=new Ra((t=>{xy||(xy=!0,t(rv).to(Vm).inSingletonScope(),t(ev).toService(rv),t(sg).toService(_f),co(t,sg))}));var Ay=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Bu}reInit(){}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=Cc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Ay([Ya()],ky);let My=!1;const Ty=new Ra((t=>{My||(My=!0,t(cv).to(ky).inSingletonScope(),t(ev).toService(cv))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ey=class extends Yf{constructor(){super(),this.numberType=Fu,this.builtinContributions=[Cm],this.init()}drawShape(t,e,i,s,n){const r=Cc(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=Wp(o,l,!0),d=Wp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Cc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Pf(e,i-t,s-n,v,_,f,!0)),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=Cc(t).richtext;this._draw(t,s,!1,i)}};Ey=wy([Ya(),Cy("design:paramtypes",[])],Ey);let By=!1;const Py=new Ra((t=>{By||(By=!0,t(hv).to(Ey).inSingletonScope(),t(ev).toService(hv))}));let Ly=!1;const Ry=new Ra((t=>{Ly||(Ly=!0,t(dv).to(qm).inSingletonScope(),t(ev).toService(dv),t(eg).toService(_f),co(t,eg))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Fy=(t,e)=>(d(jy.warnHandler)&&jy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),zy=(t,e,i)=>{if(!d(jy.errorHandler))throw new Error(t);jy.errorHandler.call(null,t,e)},jy={silent:!1,warnHandler:!1,errorHandler:!1},Hy=P_(),Vy=Hy&&globalThis?globalThis.document:void 0;function Ny(t){return("desktop-browser"===t||"mobile-browser"===t)&&Hy}function Uy(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Gy=0;function Yy(){return Gy>=9999999&&(Gy=0),Gy++}function $y(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Ky=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class qy extends Cp{constructor(t,e){super(t),this._skipRenderAttributes=Ky,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},kb=(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,e={}){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.startTime=Dc.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=Dc.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||Ab(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=kb(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=Dc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Ab(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("pointerleave",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("pointerleave",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=Dc.now()-i>this.config.press.time&&kb(s[0],t){yo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Cb=[0,0,0];let Eb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Wl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},$l),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&vp.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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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,e=yo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=yo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:$l.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:$l.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&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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=fh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:gh(this,a,this.dpr),r.strokeStyle=fh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};Eb.env="browser",Eb=Tb([Ya(),wb("design:paramtypes",[Object,Number])],Eb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lb=class extends rp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=yo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Eb(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 Rb(t,e){return new Ra((i=>{i(Lh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Rh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Lb.env="browser",Lb=Bb([Ya(),Pb("design:paramtypes",[Object])],Lb);const Ob=Rb(Lb,Eb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fb=function(t,e){return function(i,s){e(i,s,t)}};let zb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=hc.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 Hb=class{constructor(){this.type="group",this.numberType=Pu}contains(t,e,i){return!1}};Hb=jb([Ya()],Hb);const Vb=new Ra(((t,e,i,s)=>{Vb.__vloaded||(Vb.__vloaded=!0,t(xb).to(Hb).inSingletonScope(),t(Sb).toService(xb),co(t,Sb))}));Vb.__vloaded=!1;var Nb=Vb;const Ub=new Ra(((t,e,i,s)=>{i(zb)||t(zb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(zb):t(Ev).toService(zb)}));var Wb,Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let $b=Wb=class extends H_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=yo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Lb(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 Lb({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)}};$b.env="browser",$b.idprefix="visactor_window",$b.prefix_count=0,$b=Wb=Gb([Ya(),Yb("design:paramtypes",[])],$b);const Xb=new Ra((t=>{t($b).toSelf(),t(pc).toDynamicValue((t=>t.container.get($b))).whenTargetNamed($b.env)}));var Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zb=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 Jb{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 Qb(t,e=!1){const i=document.createElement("img");if(yo.global.isImageAnonymous&&(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 tx=class extends F_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Jb(t)}return new Ve}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 Qb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qb(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:La.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(...t){}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}}loadFont(t,e,i){return Zb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};tx=Kb([Ya(),qb("design:paramtypes",[])],tx);const ex=new Ra((t=>{ex.isBrowserBound||(ex.isBrowserBound=!0,t(tx).toSelf().inSingletonScope(),t(fo).toService(tx))}));function ix(t,e=!0){ix.__loaded||(ix.__loaded=!0,t.load(ex),t.load(Ob),t.load(Xb),e&&function(t){t.load(Nb),t.load(Ub)}(t))}ex.isBrowserBound=!1,ix.__loaded=!1;var sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 nx=class extends Eb{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}};nx.env="feishu",nx=sx([Ya()],nx);var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let ox=class extends rp{constructor(t){super(t)}init(){this._context=new nx(this,this._dpr)}release(...t){}};ox.env="feishu",ox=rx([Ya(),ax("design:paramtypes",[Object])],ox);const lx=Rb(ox,nx);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},cx=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)}};class ux{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 px=class extends H_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ux}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ox(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 ox({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()}};px.env="feishu",px=hx([Ya(),dx(0,Wa(mo)),cx("design:paramtypes",[Object])],px);const gx=new Ra((t=>{t(px).toSelf(),t(pc).toDynamicValue((t=>t.container.get(px))).whenTargetNamed(px.env)}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 sp(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}};_x=fx([Ya(),vx(0,Wa(lo)),vx(0,$a(Zy)),vx(1,Wa(lo)),vx(1,$a(Pv)),vx(2,Wa(lo)),vx(2,$a(Lv)),mx("design:paramtypes",[Object,Object,Object])],_x);const yx=new Ra((t=>{yx.__vloaded||(yx.__vloaded=!0,co(t,Zy))}));yx.__vloaded=!1;var bx=yx;class xx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:gh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Mx=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};Mx=Sx([Ya(),kx(0,Wa(Jm)),Ax("design:paramtypes",[Object])],Mx);let Tx=!1;const wx=new Ra(((t,e,i,s)=>{Tx||(Tx=!0,t(Jy).to(Mx).inSingletonScope(),t(Zy).toService(Jy))}));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)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Px=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};Px=Cx([Ya(),Bx(0,Wa(Qm)),Ex("design:paramtypes",[Object])],Px);let Lx=!1;const Rx=new Ra(((t,e,i,s)=>{Lx||(Lx=!0,t(Qy).to(Px).inSingletonScope(),t(Zy).toService(Qy))}));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},Ix=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 xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};Fx=Ox([Ya(),Dx(0,Wa(tv)),Ix("design:paramtypes",[Object])],Fx);let zx=!1;const jx=new Ra(((t,e,i,s)=>{zx||(zx=!0,t(tb).to(Fx).inSingletonScope(),t(Zy).toService(tb))}));class Hx{constructor(){this.type="glyph",this.numberType=Bu}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},Nx=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 Wx=class extends Hx{constructor(t){super(),this.canvasRenderer=t}};Wx=Vx([Ya(),Ux(0,Wa(cv)),Nx("design:paramtypes",[Object])],Wx);let Gx=!1;const Yx=new Ra(((t,e,i,s)=>{Gx||(Gx=!0,t(lb).to(Wx).inSingletonScope(),t(Wx).toService(lb))}));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 Xx=class{constructor(){this.type="image",this.numberType=Lu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Xx=$x([Ya()],Xx);let Kx=!1;const qx=new Ra(((t,e,i,s)=>{Kx||(Kx=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=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 tS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};tS=Zx([Ya(),Qx(0,Wa(sv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new Ra(((t,e,i,s)=>{eS||(eS=!0,t(ib).to(tS).inSingletonScope(),t(Zy).toService(ib))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};aS=sS([Ya(),rS(0,Wa(rv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new Ra(((t,e,i,s)=>{oS||(oS=!0,t(ob).to(aS).inSingletonScope(),t(Zy).toService(ob))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};uS=hS([Ya(),dS(0,Wa(nv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new Ra(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(uS).inSingletonScope(),t(Zy).toService(sb))})),fS=new Ve;class mS{constructor(){this.type="rect",this.numberType=Du}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:gh(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;fS.setValue(i.x1,i.y1,i.x2,i.y2),fS.expand(-r/2),h=!fS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yS=function(t,e){return function(i,s){e(i,s,t)}};let bS=class extends mS{constructor(t){super(),this.canvasRenderer=t}};bS=vS([Ya(),yS(0,Wa(av)),_S("design:paramtypes",[Object])],bS);let xS=!1;const SS=new Ra(((t,e,i,s)=>{xS||(xS=!0,t(nb).to(bS).inSingletonScope(),t(Zy).toService(nb))}));let AS=!1;const kS=new Ra(((t,e,i,s)=>{AS||(AS=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));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},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}};CS=MS([Ya(),wS(0,Wa(ov)),TS("design:paramtypes",[Object])],CS);let ES=!1;const BS=new Ra(((t,e,i,s)=>{ES||(ES=!0,t(rb).to(CS).inSingletonScope(),t(Zy).toService(rb))}));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};let LS=class{constructor(){this.type="text",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};LS=PS([Ya()],LS);let RS=!1;const OS=new Ra(((t,e,i,s)=>{RS||(RS=!0,t(ab).to(LS).inSingletonScope(),t(Zy).toService(ab))})),IS=new Ra(((t,e,i,s)=>{i(_x)||t(_x).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(_x):t(Ev).toService(_x)}));class DS{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 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},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jS=class extends F_{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 DS(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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};jS=FS([Ya(),zS("design:paramtypes",[])],jS);const HS=new Ra((t=>{HS.isFeishuBound||(HS.isFeishuBound=!0,t(jS).toSelf().inSingletonScope(),t(fo).toService(jS))}));function VS(t,e=!0){VS.__loaded||(VS.__loaded=!0,t.load(HS),t.load(lx),t.load(gx),e&&function(t){t.load(bx),t.load(IS),t.load(wx),t.load(Rx),t.load(jx),t.load(Yx),t.load(qx),t.load(iS),t.load(lS),t.load(gS),t.load(SS),t.load(kS),t.load(BS),t.load(OS)}(t))}HS.isFeishuBound=!1,VS.__loaded=!1;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},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends Eb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};WS.env="node",WS=NS([Ya(),US("design:paramtypes",[Object,Number])],WS);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},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends rp{constructor(t){super(t)}init(){this._context=new WS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};$S.env="node",$S=GS([Ya(),YS("design:paramtypes",[Object])],$S);const XS=Rb($S,WS);var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZS=function(t,e){return function(i,s){e(i,s,t)}};let JS=class extends H_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new $S(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new $S({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};JS.env="node",JS=KS([Ya(),ZS(0,Wa(mo)),qS("design:paramtypes",[Object])],JS);const QS=new Ra((t=>{t(JS).toSelf(),t(pc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)}));var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eA=class extends F_{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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};eA=tA([Ya()],eA);const iA=new Ra((t=>{iA.isNodeBound||(iA.isNodeBound=!0,t(eA).toSelf().inSingletonScope(),t(fo).toService(eA))}));function sA(t,e=!0){sA.__loaded||(sA.__loaded=!0,t.load(iA),t.load(XS),t.load(QS))}iA.isNodeBound=!1,sA.__loaded=!1;var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};oA=nA([Ya(),aA(0,Wa(Jm)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new Ra(((t,e,i,s)=>{lA||(lA=!0,t(hb).to(oA).inSingletonScope(),t(Sb).toService(hb))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends mS{constructor(t){super(),this.canvasRenderer=t}};pA=cA([Ya(),uA(0,Wa(av)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new Ra(((t,e,i,s)=>{gA||(gA=!0,t(fb).to(pA).inSingletonScope(),t(Sb).toService(fb))}));class mA extends Yf{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:gh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};bA=vA([Ya(),yA(0,Wa(sv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Ra(((t,e,i,s)=>{xA||(xA=!0,t(pb).to(bA).inSingletonScope(),t(Sb).toService(pb))}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MA=function(t,e){return function(i,s){e(i,s,t)}};let TA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};TA=AA([Ya(),MA(0,Wa(Qm)),kA("design:paramtypes",[Object])],TA);let wA=!1;const CA=new Ra(((t,e,i,s)=>{wA||(wA=!0,t(cb).to(TA).inSingletonScope(),t(Sb).toService(cb))}));class EA extends Yf{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&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let RA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}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:gh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Ju.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};RA=BA([Ya(),LA(0,Wa(ov)),PA("design:paramtypes",[Object])],RA);let OA=!1;const IA=new Ra(((t,e,i,s)=>{OA||(OA=!0,t(mb).to(RA).inSingletonScope(),t(Sb).toService(mb))}));var DA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};let jA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};jA=DA([Ya(),zA(0,Wa(tv)),FA("design:paramtypes",[Object])],jA);let HA=!1;const VA=new Ra(((t,e,i,s)=>{HA||(HA=!0,t(db).to(jA).inSingletonScope(),t(Sb).toService(db))}));var NA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let GA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ju}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=hg(a,u,n),v=lg(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&&Ju.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};GA=NA([Ya(),WA(0,Wa(lv)),UA("design:paramtypes",[Object])],GA);let YA=!1;const $A=new Ra(((t,e,i,s)=>{YA||(YA=!0,t(vb).to(GA).inSingletonScope(),t(Sb).toService(vb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};ZA=XA([Ya(),qA(0,Wa(nv)),KA("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new Ra(((t,e,i,s)=>{JA||(JA=!0,t(gb).to(ZA).inSingletonScope(),t(Sb).toService(gb))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ek=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 sk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};sk=tk([Ya(),ik(0,Wa(rv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new Ra(((t,e,i,s)=>{nk||(nk=!0,t(_b).to(sk).inSingletonScope(),t(Sb).toService(_b))}));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 Hx{constructor(t){super(),this.canvasRenderer=t}};hk=ak([Ya(),lk(0,Wa(cv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new Ra(((t,e,i,s)=>{ck||(ck=!0,t(bb).to(hk).inSingletonScope(),t(Sb).toService(bb))}));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 fk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};fk=uk([Ya(),gk(0,Wa(hv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new Ra(((t,e,i,s)=>{mk||(mk=!0,t(yb).to(fk).inSingletonScope(),t(Sb).toService(yb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Lu}};xk=_k([Ya(),bk(0,Wa(dv)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new Ra(((t,e,i,s)=>{Sk||(Sk=!0,t(ub).to(xk).inSingletonScope(),t(Sb).toService(ub))})),kk=P_();function Mk(){Mk.__loaded||(Mk.__loaded=!0,hf.RegisterGraphicCreator("arc",sf),vo.load(ay),vo.load(kk?hA:wx))}Mk.__loaded=!1;const Tk=Mk;function wk(){wk.__loaded||(wk.__loaded=!0,hf.RegisterGraphicCreator("area",Qg),vo.load(uy),vo.load(kk?CA:Rx))}wk.__loaded=!1;const Ck=wk;function Ek(){Ek.__loaded||(Ek.__loaded=!0,hf.RegisterGraphicCreator("circle",_g),vo.load(my),vo.load(kk?VA:jx))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,hf.RegisterGraphicCreator("glyph",Og),vo.load(Ty),vo.load(kk?dk:Yx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,hf.RegisterGraphicCreator("group",Ep))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,hf.RegisterGraphicCreator("image",Hg),vo.load(Ry),vo.load(kk?Ak:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,hf.RegisterGraphicCreator("line",Cg),vo.load(cy),vo.load(kk?SA:iS))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,hf.RegisterGraphicCreator("path",qg),vo.load(by),vo.load(kk?QA:gS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,hf.RegisterGraphicCreator("polygon",af),vo.load(Sy),vo.load(kk?rk:lS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,hf.RegisterGraphicCreator("rect",Lg),vo.load(ly),vo.load(kk?fA:SS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,hf.RegisterGraphicCreator("richtext",$g),vo.load(Py),vo.load(kk?vk:kS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,hf.RegisterGraphicCreator("shadowRoot",lf))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,hf.RegisterGraphicCreator("symbol",Mg),vo.load(gy),vo.load(kk?IA:BS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,hf.RegisterGraphicCreator("text",Sg),vo.load(_y),vo.load(kk?$A:OS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Ok(),Wk()}const tM=-.5*Math.PI,eM=1.5*Math.PI,iM="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 sM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sM||(sM={}));const nM={[sM.selectedReverse]:{},[sM.selected]:{},[sM.hover]:{},[sM.hoverReverse]:{}},rM={container:"",width:30,height:30,style:{}},aM="scrollDrag";function oM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const lM={debounce:xt,throttle:St};Qk();let hM=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=oM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:lM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(aM,{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",lM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};hM.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};var cM,dM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 uM=cM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=cM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(aM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new hM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(uM)||(t(uM).toSelf(),t(Hv).toService(uM))}));function gM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&gM(t,e)}))}const fM=t=>!u(t)&&!1!==t.visible;function mM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function vM(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 yM=["#ffffff","#000000"];function bM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return xM(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(...yM);for(const n of a)if(t!==n&&xM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function xM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(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=AM(t),s=AM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function AM(t){const e=si(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 kM(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 MM(t,e){return[t[0]*e,t[1]*e]}function TM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const CM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:iM,fontSize:14},s),getTextBounds:i?void 0:uf,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function EM(t,e,i={}){if(!t)return{width:0,height:0};const s=uf({text:t,fontFamily:e.fontFamily||i.fontFamily||iM,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 BM(t,e="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 PM(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 LM(t,e="type"){const i=BM(t,e);return"rich"===i?hf.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),hf.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 DM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function FM(){Ok(),Wk(),qk(),Yk(),Jk()}var zM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=zM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Hl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},jM.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))}}jM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const HM={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}},VM={poptip:j({},HM)};var NM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}KM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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 ZM=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={};j(s,KM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new KM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,VM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};ZM=qM([Ya()],ZM);var JM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 QM{constructor(){this.activeEvent="onRegister",this._uid=La.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 tT=class extends QM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};tT=JM([Ya()],tT);let eT=class extends QM{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)}};eT=JM([Ya()],eT);const iT=new Ra(((t,e,i,s)=>{i(ZM)||(t(ZM).toSelf().inSingletonScope(),t(og).toService(ZM)),i(tT)||(t(tT).toSelf(),t(Hv).toService(tT)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT))}));class sT extends qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ok(),zk();class nT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nT.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})}}nT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ok(),Wk();class rT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Tk();class aT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}aT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ok(),Tk();class oT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=tM,endAngle:s=eM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}oT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Hk();class lT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function hT(){Ok(),zk(),Nk(),qk()}function cT(){Ok(),zk(),Tk(),qk()}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},hT();class dT extends qy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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(k(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=hf.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),P(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=hf.line;Y(i)[0].cornerRadius&&(t=hf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=hf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}dT.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}}},cT();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=hf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var pT,gT;!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"}(pT||(pT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gT||(gT={}));const fT={[gT.selectedReverse]:{},[gT.selected]:{},[gT.hover]:{},[gT.hoverReverse]:{}},mT={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}}},vT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const _T=Math.sin(Math.PI/10);function yT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function bT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function xT(t){const e={};return gM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ST(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function AT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return MM(r,(s?-1:1)*(n?-1:1)*t/TM(r))}function kT(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 TT(t,e,i){var s;if(bT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function wT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(sM.hover,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.hoverReverse,!0)})),s):i},ET=(t,e,i)=>i?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),null):i,BT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(sM.selected)?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.selectedReverse),t.removeState(sM.selected))})),null):s.name&&!P(s.states)?(s.addState(sM.selected,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.selectedReverse,!0)})),s):i};class PT extends qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const LT={type:"default",duration:300,easing:"linear"};class RT extends PT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=CT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=hf.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._prepare(),this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(LT)}_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=hf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pT.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=hf.group({x:0,y:0,pickable:!1});t.name=pT.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=hf.group({x:0,y:0,pickable:!1});i.name=pT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=hf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=pT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=nM;else{const t=this.data[s],e=j({},nM,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=hf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=pT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=nM;else{const i=j({},nM,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=hf.group({x:0,y:0,pickable:!1});return r.name=`${pT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=LM(this._getLabelAttribute(t,e,n,i));if(a.name=pT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=nM;else{const s=j({},nM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new jM(Object.assign({},e));i.name=pT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ST(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},mT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},gM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const OT={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&&TT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function IT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function DT(t,e,i,s,n=!1){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:OT[n]||OT.parity;if(s.length>=3&&wT(s,r)){do{s=a(s,r)}while(s.length>=3&&wT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);TT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),DT(l,s,n,(t=>TT(t,l,r))),DT(h,s,o,(t=>TT(t,h,r)||!(!n||t===l)&&TT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function zT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},VT(t,e.attribute.angle)),{angle:HT(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({},NT(t,e.attribute.angle)),{angle:HT(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 HT(t=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 VT(t,e=0){let 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=HT(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 NT(t,e=0){let 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=HT(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 UT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=bT(h),m=yT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 WT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class GT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=TM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return MM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class YT{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-YT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*YT.bounceIn(2*t):.5*YT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){YT[t]=e}}function $T(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}YT.quadIn=YT.getPowIn(2),YT.quadOut=YT.getPowOut(2),YT.quadInOut=YT.getPowInOut(2),YT.cubicIn=YT.getPowIn(3),YT.cubicOut=YT.getPowOut(3),YT.cubicInOut=YT.getPowInOut(3),YT.quartIn=YT.getPowIn(4),YT.quartOut=YT.getPowOut(4),YT.quartInOut=YT.getPowInOut(4),YT.quintIn=YT.getPowIn(5),YT.quintOut=YT.getPowOut(5),YT.quintInOut=YT.getPowInOut(5),YT.backIn=YT.getBackIn(1.7),YT.backOut=YT.getBackOut(1.7),YT.backInOut=YT.getBackInOut(1.7),YT.elasticIn=YT.getElasticIn(1,.3),YT.elasticOut=YT.getElasticOut(1,.3),YT.elasticInOut=YT.getElasticInOut(1,.3*1.5),YT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),YT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},YT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)YT[`flicker${t}`]=e=>$T(e,t);for(let t=2;t<10;t++)YT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function XT(t,e,i){return t+(e-t)*i}const KT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=XT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=XT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=XT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=XT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=XT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=XT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=XT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=XT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=XT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=hp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?dp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=hp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?dp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=XT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=XT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=XT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=XT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=XT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=XT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=XT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Jc(e,i,s),r.addUpdateBoundTag()}}};function qT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=YT[s])&&void 0!==n?n:YT.linear:YT.linear,"wait"===t&&(this.onUpdate=ZT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=ZT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=op.Get(i,ap.Color255),r=op.Get(s,ap.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(KT["fill"===e?"fillPure":"strokePure"])}else KT[e]?t.push(KT[e]):t.push(qT)}else KT[e]?t.push(KT[e]):t.push(qT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class QT extends JT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Po.END?this.removeAnimate(t,!0):t.status!==Po.RUNNING&&t.status!==Po.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ew=new tw;ew.isGlobal=!0;class iw{constructor(t=La.GenAutoIncrementId(),e=ew,i){this.id=t,this.status=Po.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new JT(Bo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new QT(Bo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new JT(Bo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Po.RUNNING&&(this.status=Po.PAUSED)}resume(){this.status===Po.PAUSED&&(this.status=Po.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Po.END&&this.onEnd(),this.status=Po.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Po.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Po.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Po.END);this.status=Po.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const sw=new xo;class nw{constructor(){this.released=!1}tick(t,e){sw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class rw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Eo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Eo.INITIAL,yo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),yo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new nw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Eo.INITIAL&&(this.status=Eo.PAUSE,!0)}resume(){return this.status!==Eo.INITIAL&&(this.status=Eo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Eo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Eo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Eo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}ow.getInstance();class lw{static registerBuiltInAnimate(t,e){lw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Po.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}lw.builtInAnimateMap={};const hw="appear",cw="disappear",dw="update",uw="highlight",pw="unhighlight";class gw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=ow.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hw],[{name:hw,animation:t}],e)}applyDisappearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyUpdateState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyHighlightState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mw)._getAnimationStateManager(t),t}}class vw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new iw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:ew,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new tw}createTicker(t){return new rw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _w(){G(Tp,mw),G(Tp,vw)}class yw extends JT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bw extends yw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Sw(t){return new xw(t)}class Aw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kw=1e3,Mw="quadInOut",Tw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],ww=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=hp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Cw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Z_(t):[],n=Z_(e);i&&s&&(i.fromTransform&&J_(s,i.fromTransform.clone().getInverse()),J_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Bw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Pw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Bw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?op.Get(t,ap.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lw extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Cw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&ww(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Rw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Ew(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Pw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Mw);return c.play(d),c};class Ow extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Cw(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&ww(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Iw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Tw.includes(t))(i)||(e[i]=t[i])})),e},Dw=(t,e,i)=>{const s=Iw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=yo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Fw=(t,e,i)=>{const s=[],n=i?null:Iw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Iw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Eg(t.attribute),n=ty(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(yo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ty(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ty(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ey(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ey(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(yo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:iy(i)}];const s=[];return ny(i,e,s),s})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ny(l,e,h),h})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Z_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(yo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Dw(t,s,e),s};class jw extends yw{constructor(t,e,i,s,n){super(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(){super.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:Yo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Yo.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:Yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Hw extends jw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=yo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vw extends jw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=yo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Nw extends yw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Zc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Uw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends Uw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const $w=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Xw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Kw extends Xw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$w(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class qw extends Xw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Zw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Jw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Qw=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class tC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Qw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const iC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class sC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Zc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class nC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:iC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class rC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:iC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const aC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class oC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:aC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class lC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:aC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const hC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class cC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class dC extends sC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const uC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class pC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends pC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=uC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class fC extends pC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const mC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class vC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=mC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _C extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{onBind(){var t;const e=Sw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class bC extends bw{onBind(){const t=Sw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function xC(){Ok(),zk(),Yk(),Jk(),lw.registerBuiltInAnimate("axisEnter",yC),lw.registerBuiltInAnimate("axisUpdate",bC)}var SC=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=hf.group({zIndex:999});e.name=pT.axisBreak,e.id=this._getNodeId(`${pT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},vT,s),a=null!==(e=r.size)&&void 0!==e?e:vT.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=hf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=pT.axisBreakSymbol;const h=hf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=pT.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=hf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=pT.background,n.id=this._getNodeId("background"),n.states=j({},fT,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=SC(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];P(l)||(c.state={line:j({},fT,l),symbol:j({},fT,l)});const d=new dT(c);d.name=pT.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=SC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},fT,c.text),shape:j({},fT,c.shape),panel:j({},fT,c.background)}});return E.angle=w,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 VT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return NT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),jT(i,t),!zT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=bT(a),l=yT(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=WT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=WT(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);k(i)&&(c=Yt(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&&k(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);UT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&FT(t,{orient:o,method:m,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(k(c)&&(!k(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=hf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pT.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=EM(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=ri(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}}AC.defaultAttributes=mT,G(AC,GT);class kC{isInValidValue(t){const{startAngle:e=tM,endAngle:i=eM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=tM,endAngle:i=eM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return AT(t,i,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 MC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=MC(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 CC=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),k(l)&&l>=3){const t=kT(n,l,c,e,i);h=hf.path(Object.assign(Object.assign({},a.style),{path:MT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=hf.circle(t)}h.name=pT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},fT,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=CC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},fT,d.text),shape:j({},fT,d.shape),panel:j({},fT,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}=MC(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&&TC(e,c,i)}else e.AABBBounds.width()>r&&TC(e,r,i)}else o>a.x&&h.x2>n.x2?(TC(e,n.x2-o,i),r&&wC(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}}EC.defaultAttributes=mT,G(EC,kC);const BC=t=>t.map(((t,e)=>({index:e,value:t}))),PC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},LC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=CM(a),_=t.range();let y=[];for(let i=0;i{IC[t]=!0}));const HC=t=>-Math.log(-t),VC=t=>-Math.exp(-t),NC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,UC=t=>10===t?NC:t===Math.E?Math.exp:e=>Math.pow(t,e),WC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),GC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),YC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function $C(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 XC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function KC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function qC(t,e,i,s){return 1===i&&(i=0),KC(t,i,s)*(e/(1-i))}function ZC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function JC(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]{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 tE{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=ZC(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 eE=Symbol("implicit");class iE extends tE{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=OC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=eE}clone(){const t=(new iE).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!==eE)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 sE(t,e,r,n)}class rE extends iE{constructor(t){super(),this.type=OC.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=qC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:nE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return nE(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 rE(!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:aE}=ni;function oE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=aE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?aE(t,e):e instanceof ei?aE(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):At(Number(t),Number(e))}class lE extends tE{constructor(t=jC,e=jC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jC,this._piecewise=XC,this._interpolate=oE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?JC:XC,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:jC),this.rescale(i)):this._clamp!==jC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 hE=Math.sqrt(50),cE=Math.sqrt(10),dE=Math.sqrt(2),uE=[1,2,5,10],pE=(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=vE(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?fE(0,-(e-1)/s,s):fE((e-1)/s,0,s)},gE=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 pE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pE(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=fE(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=fE(t,e,l);return n&&r.reverse(),r})),vE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uE[0];return i>=hE?s=uE[3]:i>=cE?s=uE[2]:i>=dE&&(s=uE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _E(t,e,i){const s=(e-t)/Math.max(0,i);return vE(s)}function yE(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;e0;){if(s=_E(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function xE(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 SE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AE=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})),kE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=mE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SE(t,e,n):SE(t,e,QC(n)),h=SE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),ME=mt(((t,e,i,s,n)=>yE(s(t),s(e),i).map((t=>QC(n(t))))));class TE extends lE{constructor(){super(...arguments),this.type=OC.Linear}clone(){var t;const e=new TE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return gE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=mE(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(t=10){const e=this.calculateVisibleDomain(this._range);return yE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 CE(t){return e=>-t(-e)}function EE(t=Number.EPSILON){return e=>Math.max(e,t)}class BE extends lE{constructor(){super(WC(10),UC(10)),this.type=OC.Log,this._limit=EE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new BE).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=WC(this._base),s=UC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=HC,this.untransformer=VC):(this._logs=i,this._pows=s,this._limit=EE(),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 jC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return AE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(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))))}}}G(BE,wE);class PE extends TE{constructor(){super(GC(1),YC(1)),this.type=OC.Symlog,this._const=1}clone(){return(new PE).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=GC(t),this.untransformer=YC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return AE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(PE,wE);class LE{constructor(){this.type=OC.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)&&k(+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 LE).domain(this._domain).range(this._range).unknown(this._unknown)}}function RE(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 OE(t,e,i,s,n=!1){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,n,r;if(!DC(t.type))return BC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return BC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=RE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=RE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=RE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=RC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=RC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?DE.greedy:DE.parity;for(;l.length>=3&&wT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;TT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),OE(t,l,a,(e=>TT(e,t,i))),OE(n,l,o,(e=>TT(e,n,i)||!(!a||e===t)&&TT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return BC(m)},DE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&TT(i,t,e)||(i=t,0))))}},FE=(t,e,i,s)=>{const n=RC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},zE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,jE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?BC([s[s.length-1]]):BC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=FE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=VE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=FE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!zE(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?jE(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=CM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=ST(r,AT(s,r,e,n));return o=a,l=AT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 BC(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=NE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WE(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 BC(c)},WE=(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&&PC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},GE=new Uint32Array(33),YE=new Uint32Array(33);YE[0]=0,GE[0]=~YE[0];for(let t=1;t<=32;++t)YE[t]=YE[t-1]<<1|1,GE[t]=~YE[t];function $E(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&GE[31&o]&YE[1+(31&l)])return!0}else{if(i[h]&GE[31&o])return!0;if(i[c]&YE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,GE[31&o]&YE[1+(31&l)]);else for(s(h,GE[31&o]),s(c,YE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,YE[31&a]|GE[1+(31&o)]);else for(n(l,YE[31&a]),n(h,GE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 XE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function KE(t,e,i=!1){return i?XE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function qE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=KE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=XE(t,r)),e.getRange(r)))}function ZE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return ZE(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 ZE(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 ZE(t,e,n,s,h,c)}return!1}const QE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],tB=["top","inside-top","inside"];function eB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const iB={mode:"same-time",duration:300,easing:"linear"};function sB(t){return 3===t||4===t}function nB(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 rB=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 aB(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)}}var oB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const cB=(t,e)=>Math.ceil(t)>Math.floor(e),dB=([t,e],[i,s])=>s>t&&e>i;function uB(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 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);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(sM.hover,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gM(this,(t=>{P(t.states)||(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void gM(this,(t=>{P(t.states)||(t.removeState(sM.selectedReverse),t.removeState(sM.selected))}));P(e.states)||(e.addState(sM.selected,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.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)===Yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Yo.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(Se(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[aB(g,f,c,d,a,o),aB(-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=hf.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.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return LM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&cB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&cB(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(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(uB([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])&&!dB([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 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},h),{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(KE(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(KE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(KE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{fB[t]=e};var vB=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{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,i,s)}}_B.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const yB=()=>{mB("symbol",_B),mB("line-data",_B)};var bB=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{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}}}xB.tag="rect-label",xB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var SB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};AB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const kB=()=>{mB("line",AB),mB("area",AB)};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);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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new TB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):sB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=sB(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=sB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=sB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?sB(t.quadrant)?"left":"right":sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 BB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 PB(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=MT(t,!!n),o=MT(r,!!n);const h=re.distancePP(s,l),c=re.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=BB(e,t,!1,!!n),o=BB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=MT(t,!!n),o=MT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}EB.defaultAttributes={pickable:!1};class LB extends qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.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 ST(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?`${pT.grid}-sub`:`${pT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=MT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BB(t,o,!1,!!a)}const u=hf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:LB.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=MT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=hf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:LB.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}}LB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ok(),Hk();class RB extends LB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LB.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=tM,endAngle:r=eM}=this.attribute;i=kT(t,s,re.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=j({},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})}}G(RB,GT);var OB=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"})}}G(IB,kC);const DB="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",FB={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:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zB={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 jB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={}));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);nt,this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=oM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===jB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===jB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=jB.endHandler):h+=l:this._activeTag===jB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===jB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=oM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===jB.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===jB.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=HB(c,["formatMethod"]),{formatMethod:g}=d,f=HB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},zB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},zB.horizontal),V),{pickable:!U&&(null===(b=V.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},zB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},zB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},zB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},zB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zB.vertical),{pickable:!U}),"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 jM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var UB,WB,GB,YB;function $B(){Ok(),FM(),_w()}NB.defaultAttributes=FB,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"}(UB||(UB={})),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"}(WB||(WB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(GB||(GB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(YB||(YB={}));class XB extends qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=CT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=hf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=hf.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=hf.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 KB(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 qB(t,e,i,s){t&&(KB(t.startSymbol,e,i,s),t.lines.forEach((t=>KB(t,e,i,s))),KB(t.line,e,i,s),KB(t.endSymbol,e,i,s))}function ZB(t,e,i,s){t&&(KB(t.getTextShape(),e,i,s),KB(t.getBgRect(),e,i,s))}function JB(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 QB(t,e,i,s){t&&(JB(t.startSymbol,e,i,s),t.lines.forEach((t=>JB(t,e,i,s))),JB(t.line,e,i,s),JB(t.endSymbol,e,i,s))}function tP(t,e,i,s){t&&(JB(t.getTextShape(),e,i,s),JB(t.getBgRect(),e,i,s))}function eP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;KB(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)})),KB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;KB(t.getTextShape(),e,l,n),KB(t.getBgRect(),e,l,n)}))}function iP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function sP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function nP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function rP(t,e,i,s,n,r){var a;qB(t,n,s,r),KB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?ZB(i,n,s,r):KB(i,n,s,r)}function aP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;KB(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)})),KB(e,n+o+l,h,r),KB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(KB(i.getTextShape(),n+o+l+h+c,d,r),KB(i.getBgRect(),n+o+l+c,d,r)):KB(i,n+o+l+c,d,r)}function oP(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?eP(t,e,s,r,a):"fadeIn"===i&&iP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?eP(t,e,s,n,a):"fadeIn"===i&&iP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function lP(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&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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?rP(n,r,e,i,s,o):"callIn"===t&&aP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?rP(n,r,e,i,s,a):"callIn"===t&&aP(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;QB(t,n,s,r),JB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?tP(i,n,s,r):JB(i,n,s,r)}(n,r,e,t,i,s)}}const dP={type:"clipIn",duration:500,easing:"linear",delay:0},uP={type:"fadeIn",duration:500,easing:"linear",delay:0},pP={type:"callIn",duration:500,easing:"linear",delay:0},gP={type:"fadeOut",duration:500,easing:"linear",delay:0};class fP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new jM(Object.assign(Object.assign({},h),{state:{panel:j({},nM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},nM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},nM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},nM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class mP extends XB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=dP,this.defaultExitAnimation=gP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;DM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(mP,fP);const vP=.001,_P={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:UB.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]}},yP={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"}}},bP={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:{autoRotate:!0,position:GB.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]}},xP={interactive:!0,label:{position:WB.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}},SP={interactive:!0,label:{autoRotate:!0,position:GB.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}},AP={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"}},kP={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"}},MP={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 TP(){wP._animate=oP}$B(),hT(),_w();class wP extends mP{markerAnimate(t){wP._animate&&this._animationConfig&&wP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(mM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return vM(Math.abs(e),Math.PI/2,vP)||vM(Math.abs(e),3*Math.PI/2,vP)?_M(i,e,t):mM(e)?yP.postiveXAxis[t]:yP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new dT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",wP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(wP.defaultAttributes.label)}}function CP(){EP._animate=lP}wP.defaultAttributes=_P,$B(),Nk(),_w();class EP extends XB{markerAnimate(t){EP._animate&&this._animationConfig&&EP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},EP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=hf.polygon(Object.assign({points:e},i));n.states=j({},nM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",EP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},nM,null==i?void 0:i.area)),this._updateMarkLabels(EP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}EP.defaultAttributes=xP,G(EP,fP),$B(),cT(),_w();class BP extends mP{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case GB.arcInnerStart:l=n;case GB.arcOuterStart:l=n;break;case GB.arcInnerEnd:l=r;case GB.arcOuterEnd:l=r;break;case GB.center:case GB.arcInnerMiddle:case GB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return AP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new uT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",BP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(BP.defaultAttributes.label)}}BP.defaultAttributes=bP,$B(),Tk(),_w();class PP extends XB{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case GB.center:h=(s+n)/2,c=(r+a)/2;break;case GB.arcInnerStart:h=s,c=r;break;case GB.arcOuterStart:h=n,c=r;break;case GB.arcInnerEnd:h=s,c=a;break;case GB.arcOuterEnd:h=n,c=a;break;case GB.arcInnerMiddle:h=s,c=(r+a)/2;break;case GB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},AP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=hf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},nM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",PP.defaultAttributes.label)}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=j({},nM,null==o?void 0:o.area)),this._updateMarkLabels(PP.defaultAttributes.label)}isValidPoints(){return!0}}function LP(){RP._animate=cP}PP.defaultAttributes=SP,G(PP,fP),$B(),hT(),cT(),qk(),Dk(),zk(),_w();class RP extends XB{markerAnimate(t){RP._animate&&this._animationConfig&&RP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=gP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return vM(Math.abs(s),Math.PI/2,vP)||vM(Math.abs(s),3*Math.PI/2,vP)?_M(t,s,n):mM(s)?MP.postiveXAxis[n]:MP.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,style:d,position:u=YB.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},nM,null==p?void 0:p.textBackground),text:j({},nM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},nM,null==p?void 0:p.itemContent));const v=mM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=hf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"text"===n?o=new jM(Object.assign(Object.assign({},i),{state:{panel:j({},nM,null==s?void 0:s.textBackground),text:j({},nM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=hf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"image"===n?(o=hf.image(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},nM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=vM(c,0,vP)||vM(d,0,vP),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=OM(e-u,t-d),o=OM(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(NP.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(NP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===NP.focus||"focus"===o){const s=a.hasState(HP.focus);a.toggleState(HP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover,HP.focus],t),this._setLegendItemState(e,HP.selected,t)})):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover,HP.focus],t),this._setLegendItemState(e,HP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(VP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HP.selected,HP.selectedHover],t),this._setLegendItemState(a,HP.unSelected,t)):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t))}else this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover],t),this._setLegendItemState(e,HP.unSelected,t))}))}this._dispatchLegendEvent(VP.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,HP.selected),this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover])):(this._removeLegendItemState(e,[HP.selected,HP.selectedHover]),this._setLegendItemState(e,HP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FP,spaceRow:l=zP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=hf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=hf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,NP.item,t,w)):(w=hf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,NP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?HP.selected:HP.unSelected);const C=hf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=hf.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,NP.itemShape,t,w,S.state),s.addState(e?HP.selected:HP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=hf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,NP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=LM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,NP.itemLabel,t,w,A.state),D.addState(e?HP.selected:HP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=LM(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,NP.itemValue,t,w,k.state),r.addState(e?HP.selected:HP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 DP(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 DP(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 hM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new hM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FP,spaceRow:o=zP}=n,l=this._itemsContainer,{space:h=jP,defaultCurrent:c=1}=r,d=YP(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=hf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FP,spaceRow:a=zP}=s,o=this._itemsContainer,{space:l=jP,defaultCurrent:h=1}=n,c=YP(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 _=hf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=hf.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(HP.selected)?this._setLegendItemState(t,HP.selectedHover,e):this._setLegendItemState(t,HP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===NP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(VP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HP.unSelectedHover)||t.hasState(HP.selectedHover))&&(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HP.unSelectedHover)&&!t.hasState(HP.selectedHover)||(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===NP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(VP.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!==NP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(VP.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!==NP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},$P,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(HP.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 KP;function qP(t){return y(t)?t:[t,t]}function ZP(t){return t?"ew-resize":"ns-resize"}XP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FP,spaceRow:zP,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:jP,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"}(KP||(KP={})),WP();class JP extends qy{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:j({},JP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:qP(d)[0],endValue:qP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=hf.group({x:0,y:0});f.name=KP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=hf.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)),m.name=KP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=hf.group({x:g?v:0,y:g?0:v});f.add(_);const y=hf.group({x:0,y:0});let b;if(y.name=KP.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=hf.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=KP.endText,f.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=hf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KP.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,f]=qP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(v.name=KP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(i.name=KP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=KP.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 f=hf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=KP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":ZP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=hf.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=KP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return hf.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":ZP(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),hf.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=hf.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=hf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===KP.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===KP.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===KP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}JP.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}}},GP(),WP();class QP extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},QP.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tL(t="bottom"){let 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`}QP.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"}}},GP(),WP(),Hk();class eL extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=hf.group({x:0,y:0});this._innerView.add(x);const S=new JP({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:tL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=hf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eL.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)"}},Ok(),Jk(),Yk();let iL=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},rM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},rM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};iL.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 sL={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"}}};Ok(),Jk(),Yk();let nL=class extends qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(sL,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=LM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=EM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 rL extends kg{constructor(t){super(t)}}var aL,oL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aL||(aL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oL||(oL={}));class lL extends qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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"},lL.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"},lL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.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 rL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rL(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(aL.OnPlay)},this.pause=()=>{this._dispatchEvent(aL.OnPause)},this.forward=()=>{this._dispatchEvent(aL.OnForward)},this.backward=()=>{this._dispatchEvent(aL.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()}}lL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lL.defaultAttributes={[oL.Start]:{},[oL.Pause]:{},[oL.Backward]:{},[oL.Forward]:{}};const hL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cL=[200,10];var dL,uL;!function(t){t.Default="default",t.Reverse="reverse"}(dL||(dL={})),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"}(uL||(uL={}));const pL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),fL=t=>"top"===t||"bottom"===t;class mL extends qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(fL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cL[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:cL[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 JP(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=fL(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 lL(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=fL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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:fL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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 vL(){WP(),Ok(),qk()}mL.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({},hL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hL),{key:"backward",position:"start"})}},vL();class _L extends mL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:dL.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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(uL.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(uL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.change),this.dispatchCustomEvent(uL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yL,bL=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())}))};vL();class xL extends mL{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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change))},this.play=()=>bL(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(uL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.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(uL.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.brushActive="brushActive",t.brushClear="brushClear"}(yL||(yL={}));const SL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},AL=5;const kL={debounce:xt,throttle:St};Ok(),Nk();let ML=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=SL.updateTrigger,endTrigger:i=SL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:kL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=SL.trigger,resetTrigger:e=SL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(yL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(yL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=AL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(yL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(yL.brushActive,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._dispatchBrushEvent(yL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=AL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=SL.updateTrigger,endTrigger:e=SL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=hf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};ML.defaultAttributes=SL;const TL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},wL=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}},CL={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:iM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ok(),Wk(),qk(),Jk(),Yk();let BL=class t extends qy{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=ri(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:fM(u)&&fM(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:fM(u)&&fM(u.value)},wL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:fM(u)&&fM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:fM(u)&&fM(u.value)},wL(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},rM),u.value),visible:fM(u)&&fM(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=fM(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 _=fM(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(!fM(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)+(fM(n.key)?r+n.key.spacing:0)+(fM(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&&(RM(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:fM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(fM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=id(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(fM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},wL(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},wL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},rM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(fM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},wL(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},wL(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=>EL.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)&&fM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=fM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=CM(d),_=CM(u);let y=0;if(fM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(fM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&au[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 TL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return TL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};BL.defaultAttributes=CL;const PL=pt;function LL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function OL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function IL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function DL(t,e){const i=IL(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 FL(t,e){const i=zL(t),s=zL(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 zL(t,e={x:0,y:0}){return re.distancePP(t,e)}function jL(t){return k(t.x)&&k(t.y)}function HL(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 VL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const NL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function WL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&WL(t[i],e)}}var GL,YL,$L;function XL(t){var e,i;const{type:s}=t;return s===YL.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(GL||(GL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(YL||(YL={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}($L||($L={}));const KL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},qL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function ZL(t,e){var i;if(!t)return[];const s=nR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?iR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>eR(i)?QL(t,i,e):i)).filter(p)}))):i.map((i=>eR(i)?QL(t,i,e):i)).filter(p):[]}return[]}function JL(t,e){var i,s;return iR(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 QL(t,e,i){var s;const n=nR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=KL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=qL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 tR=(t,e)=>{if(e&&eR(t)){const i=QL(e,t);if(i)return i}return t};function eR(t){return t&&"palette"===t.type&&!!t.key}function iR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function sR(t){return y(t)?{dataScheme:t}:t}function nR(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=XL(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 rR extends iE{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(!iR(this._range))return void super.range(this._range);const t=JL(this._range,this._domain);super.range(t)}}const aR={linear:TE,band:rE,point:class extends rE{constructor(t){super(!1),this.type=OC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:iE,threshold:LE,colorOrdinal:rR};function oR(t){const e=aR[t];return e?new e:null}function lR(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 hR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function cR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function dR(t){return!!_(t)&&(!!t.endsWith("%")&&$y(t.substring(0,t.length-1)))}function uR(t){return!!g(t)&&("percent"in t||"offset"in t)}function pR(t,e,i,s=0){var n,r;return S(t)?t:dR(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 gR(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]=pR(t[s],e.size,i)}))})),o}function fR(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}}function mR(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)||dR(t)||d(t)||uR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function vR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const _R=(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},yR=[{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"]}];function bR(t,e){return t&&e.key in t?t[e.key]:e.default}function xR(t){return t&&"token"===t.type&&!!t.key}const SR={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%"},AR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:yR,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"}}},token:SR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},kR={name:"dark",colorScheme:{default:{dataScheme:yR,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}}}}}},MR=(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]={}),MR(t[s],e.slice(1),i))};function TR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=sR(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)})}wR._charts={},wR._series={},wR._components={},wR._graphicComponents={},wR._marks={},wR._regions={},wR._animations={},wR._implements={},wR._chartPlugin={},wR._vChartPlugin={},wR._componentPlugin={},wR.transforms={fields:Yr,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}},wR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},wR._layout={},wR._grammarTransforms={},wR._stageEventPlugins={},wR.registerStageEventPlugin=(t,e)=>{wR._stageEventPlugins[t]=e},wR.getStageEventPlugin=t=>wR._stageEventPlugins[t],wR._interactionTriggers={},wR.registerInteractionTrigger=(t,e)=>{wR._interactionTriggers[t]=e},wR._composedEventMap={},wR.registerComposedEvent=(t,e)=>{wR._composedEventMap[t]=e},wR._tooltipProcessors={},wR.registerTooltipProcessor=(t,e)=>{wR._tooltipProcessors[t]=e},wR.createTooltipProcessor=(t,e)=>{const i=wR._tooltipProcessors[t];return i?new i(e):null};const BR=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},PR=BR(),LR={[AR.name]:AR},RR=AR.name,OR=new Map(Object.keys(LR).map((t=>[t,LR[t]]))),IR=new Map,DR=new Map(Object.keys(LR).map((t=>[t,t===RR]))),FR=(t,e)=>{if(!t)return;const i=VR(e);OR.set(t,i),DR.set(t,!0)},zR=(t=RR)=>(DR.has(t)&&!DR.get(t)&&FR(t,OR.get(t)),OR.get(t)),jR=t=>OR.delete(t)&&IR.delete(t)&&DR.delete(t),HR=t=>!!_(t)&&OR.has(t),VR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:RR;return CR({},zR(i),t)};class NR{static registerInstance(t){NR.instances.set(t.id,t)}static unregisterInstance(t){NR.instances.delete(t.id)}static getInstance(t){return NR.instances.get(t)}static instanceExist(t){return NR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return NR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}NR.instances=new Map;class UR{static registerTheme(t,e){FR(t,e)}static getTheme(t,e=!1){return zR(t)}static removeTheme(t){return jR(t)}static themeExist(t){return HR(t)}static getDefaultTheme(){return UR.themes.get(RR)}static setCurrentTheme(t){UR.themeExist(t)&&(UR._currentThemeName=t,NR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return UR.getTheme(UR._currentThemeName,t)}static getCurrentThemeName(){return UR._currentThemeName}}function WR(t){return _(t)?UR.themeExist(t)?UR.getTheme(t):{}:g(t)?t:{}}UR.themes=OR,UR._currentThemeName=RR;const GR=["animationThreshold","colorScheme","name","padding"];function YR(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];GR.includes(n)?s[n]=r:m(r)?eR(r)?s[n]=tR(r,e):xR(r)?s[n]=bR(i,r):s[n]=YR(r,e,i):s[n]=r})),s}function $R(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]=$R(t[s],e)}return i}return y(t)?t.map((t=>$R(t,e))):t}function XR(t,e){if(!t)return t;if(m(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}const KR=(t,e,i,s)=>((t,e,i)=>CM(t,e,i,{fontFamily:SR.fontFamily,fontSize:SR.fontSize}))(e,i,s).measure(t),qR="__VCHART",ZR=500,JR=500,QR=`${qR}_MEASURE_CANVAS_ID`,tO=`${qR}_DEFAULT_DATA_INDEX`,eO=`${qR}_DEFAULT_DATA_KEY`,iO=`${qR}_DEFAULT_DATA_SERIES_FIELD`,sO=`${qR}_DEFAULT_SERIES_STYLE_NAME`,nO=`${qR}_STACK_KEY`,rO=`${qR}_STACK_START`,aO=`${qR}_STACK_END`,oO=`${qR}_STACK_START_PERCENT`,lO=`${qR}_STACK_END_PERCENT`,hO=`${qR}_STACK_START_OffsetSilhouette`,cO=`${qR}_STACK_END_OffsetSilhouette`,dO=`${qR}_STACK_TOTAL`,uO=`${qR}_STACK_TOTAL_PERCENT`,pO=`${qR}_STACK_TOTAL_TOP`,gO=`${qR}_STACK_TOTAL_BOTTOM`,fO=`${qR}_MOSAIC_VALUE_START_PERCENT`,mO=`${qR}_MOSAIC_VALUE_END_PERCENT`,vO=`${qR}_MOSAIC_CAT_START_PERCENT`,_O=`${qR}_MOSAIC_CAT_END_PERCENT`,yO=`${qR}_SEGMENT_START`,bO=`${qR}_SEGMENT_END`,xO=`${qR}_KEY`;function SO(t,e){for(let i=0;it.key===e))}function kO(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 MO(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:{}},BO(t,a,n[o],l,e,r))})),s?TO(n):n}function TO(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))):TO(t[e].nodes);return t}function wO(t,e){if("values"in t&&t.values.length){const i=OL(t.values,e),s=RL(t.values,lO);t.values.forEach((t=>{t[dO]=i,t[uO]=s}))}else for(const i in t.nodes)wO(t.nodes[i],e)}function CO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][aO]/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)EO(t.nodes[r],e,i,s,n)}function BO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[aO]=function(t){if(k(t))return t;const e=+t;return k(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)),BO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const PO=(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]=RO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function OO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>FO(t.style(e,i,s,n)):P(t.style)||(e.style=FO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>FO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=FO(t.state[e]))})),e.state=i}return e}function IO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e,s,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}function DO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),FO(i)}function FO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const zO=t=>"line"===t||"area"===t,jO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return zO(i)?e:null==e?void 0:e[0]},HO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let VO=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},n=wR.getComposedEvent(t);if(n){const e=new n(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(wR.getComposedEvent(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()}};var NO;!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"}(NO||(NO={}));const UO=["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 WO,GO,YO;t.ChartEvent=void 0,(WO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",WO.rendered="rendered",WO.renderFinished="renderFinished",WO.animationFinished="animationFinished",WO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",WO.afterInitData="afterInitData",WO.afterInitEvent="afterInitEvent",WO.afterInitMark="afterInitMark",WO.rawDataUpdate="rawDataUpdate",WO.viewDataFilterOver="viewDataFilterOver",WO.viewDataUpdate="viewDataUpdate",WO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",WO.markDeltaYUpdate="markDeltaYUpdate",WO.viewDataLabelUpdate="viewDataLabelUpdate",WO.scaleDomainUpdate="scaleDomainUpdate",WO.scaleUpdate="scaleUpdate",WO.dataZoomChange="dataZoomChange",WO.drill="drill",WO.layoutStart="layoutStart",WO.layoutEnd="layoutEnd",WO.layoutRectUpdate="layoutRectUpdate",WO.playerPlay="playerPlay",WO.playerPause="playerPause",WO.playerEnd="playerEnd",WO.playerChange="playerChange",WO.playerForward="playerForward",WO.playerBackward="playerBackward",WO.scrollBarChange="scrollBarChange",WO.brushStart="brushStart",WO.brushChange="brushChange",WO.brushEnd="brushEnd",WO.brushClear="brushClear",WO.brushActive="brushActive",WO.legendSelectedDataChange="legendSelectedDataChange",WO.legendFilter="legendFilter",WO.legendItemClick="legendItemClick",WO.legendItemHover="legendItemHover",WO.legendItemUnHover="legendItemUnHover",WO.tooltipShow="tooltipShow",WO.tooltipHide="tooltipHide",WO.tooltipRelease="tooltipRelease",WO.afterResize="afterResize",WO.afterRender="afterRender",WO.afterLayout="afterLayout",WO.afterMarkLayoutEnd="afterMarkLayoutEnd",WO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(GO||(GO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(YO||(YO={}));const $O=[YO.mark,YO.model,YO.chart,YO.vchart];class XO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(YO.vchart,[]),this._levelNodes.set(YO.chart,[]),this._levelNodes.set(YO.model,[]),this._levelNodes.set(YO.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 KO={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 qO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>jO(t)))};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)||GO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||GO.chart);o.get(t)||o.set(t,new XO);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)||GO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||GO.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)||GO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||GO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i<$O.length;)n=this._invoke(s.getHandlers($O[i]),t,e),i++}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?$O.indexOf(t.filter.level)<$O.indexOf(e.level)&&t.callback!==e.handler&&s.preventHandler(t):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(){[GO.chart,GO.window,GO.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&&L(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 KO[a]&&(a=KO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?YO.model:YO.vchart:YO.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=GO.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!==YO.model&&s!==YO.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=YO.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 GO.chart:return this._viewBubbles;case GO.window:return this._windowBubbles;case GO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case GO.chart:return this._viewListeners;case GO.window:return this._windowListeners;case GO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return UO.includes(t)||Object.values(NO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&wR.hasInteractionTrigger(e)}}function ZO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QO=new Map;let tI;function eI(){tI||(tI=new Ta,JO(tI,"geojson",ba),JO(tI,"topojson",Sa),ZO(tI,"simplify",Wr))}function iI(t,e,i={type:"geojson",centroid:!0}){QO.has(t)&&Fy(`map type of '${t}' already exists, will be overwritten.`),eI();const s=new wa(tI),n=j({},{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}),QO.set(t,s)}function sI(t){QO.has(t)?QO.delete(t):Fy(`map type of '${t}' does not exists.`)}function nI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const rI=(t,e)=>0===t.length?[]:1===t.length?nI(t[0],null==e?void 0:e.deep):t.map((t=>nI(t,null==e?void 0:e.deep)));function aI(e,i,s){ZO(i=i instanceof Ta?i:e.dataSet,"copyDataView",rI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function oI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Fy(`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 Fy(`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([]),Fy("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 lI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var hI,cI,dI,uI;t.TransformLevel=void 0,(hI=t.TransformLevel||(t.TransformLevel={}))[hI.copyDataView=-10]="copyDataView",hI[hI.treemapFilter=-8]="treemapFilter",hI[hI.treemapFlatten=-7]="treemapFlatten",hI[hI.dotObjFlat=-7]="dotObjFlat",hI[hI.linkDotInfo=-7]="linkDotInfo",hI[hI.sankeyLayout=-7]="sankeyLayout",hI[hI.dataZoomFilter=-6]="dataZoomFilter",hI[hI.legendFilter=-5]="legendFilter",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"}(cI||(cI={})),function(t){t.data="data",t.mark="mark"}(dI||(dI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(uI||(uI={}));const pI=["line","area","trail"];function gI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(xO,i?t.slice().sort(i):t.slice()),{keys:[xO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const fI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function mI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{mI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function _I(t,e,i,s){const n=gI(t,(t=>i(t))),r=gI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 yI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Ep({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Uy(o))&&!1!==c&&wR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=uI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>mI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>mI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{mI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Dy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===uI.before&&(this._layoutState=uI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=uI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Dy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=vI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=_I(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=_I(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=gI(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=gI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===GO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:jO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===GO.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===GO.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===GO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===GO.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===GO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{mI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=vI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Ny(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return _u(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{yo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{mI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function bI(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:zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function xI(t){t.crosshair=Y(t.crosshair||{}).map((e=>TR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function SI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Ny(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Wy(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 AI(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 kI(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}}var MI,TI,wI,CI,EI,BI;t.LayoutZIndex=void 0,(MI=t.LayoutZIndex||(t.LayoutZIndex={}))[MI.SeriesGroup=0]="SeriesGroup",MI[MI.Axis_Grid=50]="Axis_Grid",MI[MI.CrossHair_Grid=100]="CrossHair_Grid",MI[MI.Region=450]="Region",MI[MI.Mark=300]="Mark",MI[MI.Node=400]="Node",MI[MI.Axis=100]="Axis",MI[MI.MarkLine=500]="MarkLine",MI[MI.MarkArea=100]="MarkArea",MI[MI.MarkPoint=500]="MarkPoint",MI[MI.DataZoom=500]="DataZoom",MI[MI.ScrollBar=500]="ScrollBar",MI[MI.Player=500]="Player",MI[MI.Legend=500]="Legend",MI[MI.CrossHair=500]="CrossHair",MI[MI.Indicator=500]="Indicator",MI[MI.Title=500]="Title",MI[MI.Label=500]="Label",MI[MI.Brush=500]="Brush",MI[MI.CustomMark=500]="CustomMark",MI[MI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(TI=t.LayoutLevel||(t.LayoutLevel={}))[TI.Indicator=10]="Indicator",TI[TI.Region=20]="Region",TI[TI.Axis=30]="Axis",TI[TI.DataZoom=40]="DataZoom",TI[TI.Player=40]="Player",TI[TI.ScrollBar=40]="ScrollBar",TI[TI.Legend=50]="Legend",TI[TI.Title=70]="Title",TI[TI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(wI=t.AttributeLevel||(t.AttributeLevel={}))[wI.Default=0]="Default",wI[wI.Theme=1]="Theme",wI[wI.Chart=2]="Chart",wI[wI.Base_Series=3]="Base_Series",wI[wI.Series=4]="Series",wI[wI.Mark=5]="Mark",wI[wI.User_Chart=6]="User_Chart",wI[wI.User_Series=7]="User_Series",wI[wI.User_Mark=8]="User_Mark",wI[wI.User_SeriesStyle=9]="User_SeriesStyle",wI[wI.Built_In=99]="Built_In";class PI{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({},PI.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]))))}}PI.defaultMarkInfo={};class LI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class RI{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=>TR({},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 OI extends LI{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=RI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new PI,this._lastLayoutRect=null,this.id=Yy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new VO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${qR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=wR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class II{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=gR(mR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:pR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:pR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:pR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:pR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:pR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:pR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=pR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=pR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=pR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(fR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class DI extends OI{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,this._transformLayoutPadding=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 II(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 FI extends RI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zI extends DI{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(e,i){var s;super(e,i),this.transformerConstructor=FI,this.modelType="region",this.specKey="region",this.type=zI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function jI(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 HI(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 VI(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 NI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),VI(d,!0,p,l),s&&HI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function UI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=YI(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),VI(d,!1,p,o),s&&HI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function GI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=YI(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=YI(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"left",s),r.length&&NI(r,e,i,!0,"left",s),a.length&&UI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"top",s),r.length&&WI(r,e,i,!0,"top",s),a.length&&GI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"right",s),r.length&&NI(r,e,i,!0,"right",s),a.length&&UI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"bottom",s),r.length&&WI(r,e,i,!0,"bottom",s),a.length&&GI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=YI(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=YI(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:zy)("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}}}$I.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(CI||(CI={})),t.STATE_VALUE_ENUM=void 0,(EI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",EI.STATE_HOVER="hover",EI.STATE_HOVER_REVERSE="hover_reverse",EI.STATE_DIMENSION_HOVER="dimension_hover",EI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",EI.STATE_SELECTED="selected",EI.STATE_SELECTED_REVERSE="selected_reverse",EI.STATE_SANKEY_EMPHASIS="selected",EI.STATE_SANKEY_EMPHASIS_REVERSE="blur",EI.STATE_HIGHLIGHT="highlight",EI.STATE_BLUR="blur",EI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(BI||(BI={}));const XI=["linear","radial","conical"],KI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const qI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{qI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class ZI extends LI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class JI extends ZI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,pI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!qI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(qR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(qR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(DC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class QI extends LI{constructor(){super(...arguments),this.id=Yy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=wR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class tD extends QI{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const eD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,iD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=eD(l.delay,n,a,o),d=eD(l.duration,n,a,o),u=eD(l.oneByOne,n,a,o),p=eD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Rw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ew(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Pw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Yo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kw,null!==(l=i.easing)&&void 0!==l?l:Mw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Ow({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Mw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Rw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},sD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},nD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class rD extends QI{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new tD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Ep("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Hl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new JI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&TR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(FC(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=oR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):XI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):FC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=JL(ZL(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({},KI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)XI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=JL(ZL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return gI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return wR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[eO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=gI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{nD(t),s.push(...t.getGraphics())})),e.forEach((t=>{nD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);iD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=sD(e,n),r=sD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===cI.exit?cI.exit:i===cI.update?cI.update:cI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===CI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===CI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=CI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=CI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=CI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=cI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=cI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return fI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=fI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=HO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=wR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=wR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===uI.before||(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===CI.exit&&!e.isExiting)if(e.context.animationState===CI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Ep({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var aD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(aD||(aD={}));class oD extends rD{constructor(){super(...arguments),this.type=oD.type,this._marks=[],this._diffState=CI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Fy("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?(Fy("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))}getMarkInUserId(t){let e;return mI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===CI.update){const t=this.hasAnimation(),e=HO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=CI.update}render(){this._isCommited&&(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}oD.type="group";const lD={measureText:KR};class hD{static instance(){return hD.instance_||(hD.instance_=new hD),hD.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 cD{constructor(){this.id=Yy(),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))?Fy("不要重复添加相同的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 dD extends cD{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}}const uD={type:"fadeIn"};function pD(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 uD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const gD={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"}},fD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},mD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},vD=()=>{wR.registerAnimation("scaleInOut",(()=>fD))},_D=()=>{wR.registerAnimation("fadeInOut",(()=>mD))},yD=(t,e)=>({appear:pD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Nw,duration:gD.update.duration,easing:gD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),bD=()=>{wR.registerAnimation("line",yD)},xD=()=>{lw.registerBuiltInAnimate("growPointsIn",nC),lw.registerBuiltInAnimate("growPointsOut",rC),lw.registerBuiltInAnimate("growPointsXIn",oC),lw.registerBuiltInAnimate("growPointsXOut",lC),lw.registerBuiltInAnimate("growPointsYIn",cC),lw.registerBuiltInAnimate("growPointsYOut",dC),lw.registerBuiltInAnimate("clipIn",Gw),lw.registerBuiltInAnimate("clipOut",Yw)},SD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class AD{constructor(t){this._markSet=new PI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 kD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class MD extends AD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},kD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}MD.type="element-highlight",MD.defaultOptions=kD;const TD=()=>{wR.registerInteractionTrigger(MD.type,MD)},wD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class CD extends AD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},wD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}CD.type="element-select",CD.defaultOptions=wD;const ED=()=>{wR.registerInteractionTrigger(CD.type,CD)};class BD extends cD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class PD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>wR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>wR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>wR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return wR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>wR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){wR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}static getFunction(t){return t?hD.instance().getFunction(t):null}static getFunctionList(){return hD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=wR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=wR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,QO.get(e);var e}static registerSVG(t,e,i){const s=wR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=wR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){NR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Yy(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=AI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?wR.getSeriesBuiltInTheme(e):wR.getComponentBuiltInTheme(e);i=i?TR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=YR({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},WL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Ny(v);if(S?ix(vo):"node"===v&&sA(vo),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=UR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new yI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new qO(this,this._compiler),this._event=new VO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),NR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=TR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=$R(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;PD.getFunctionList()&&PD.getFunctionList().length&&(t=XR(t,PD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=wR.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=wR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=wR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 SI(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:ZR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:JR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,JO(this._dataSet,"dataview",Aa),JO(this._dataSet,"array",s),ZO(this._dataSet,"copyDataView",rI);for(const t in wR.transforms)ZO(this._dataSet,t,wR.transforms[t]);for(const t in wR.dataParser)JO(this._dataSet,t,wR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?cI.none:cI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,NR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=oI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?TR({},t[n][e.index],i):i):t[n]=s?TR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?TR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?TR({},t[n],i):i)}))}(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=TR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=CR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=WR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}else{const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(VM.poptip,HM,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=!!Ny(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.getTheme("background")||this._option.background}getCurrentTheme(){return WR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!UR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 bI(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(!Ny(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?vR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Fy("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?vR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Fy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return hD.instance().getFunction(t)}registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}getFunctionList(){return hD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=wR.getChartPlugins();t.length>0&&(this._chartPlugin=new dD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=wR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new BD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}PD.InstanceManager=NR,PD.ThemeManager=UR,PD.globalConfig={uniqueTooltip:!0},PD.Utils=lD,PD.vglobal=b_;wR.registerRegion("region",zI),wR.registerLayout("base",$I),Xk(),Ok(),wR.registerMark(oD.type,oD),wR.registerStageEventPlugin("gesture",Mb),TD(),ED(),FR(kR.name,kR);const LD="monotone",RD="linear",OD="bevel";function ID(t,e){return e("component",t)}function DD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=wR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const FD=(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},zD=(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)))},jD=(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},HD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=DD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VD=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const ND=(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 UD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=GD(HD(h,r,a,c),d,g),o.value=GD(HD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=HD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function WD(t,e,i,s,n,r,a){if(d(e)){UD(t,e(n,a),i,s,r,a)}else e&&UD(t,e,i,s,r,a)}const GD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class YD{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 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=>{y(t)?t.forEach((t=>{WD(a,t,e,i,s,n,r)})):d(t)?WD(a,t,e,i,s,n,r):t&&UD(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:HD(r.visible,t,n),value:GD(HD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:HD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=HD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&ND(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 $D={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}},XD=(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=SO([],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 KD(a,n,o)},KD=(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)=>{$y(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=>{$y(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$D[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},qD=(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=>{$y(t[e])||(t[e]=0)}))})),t},ZD=`${qR}_HIERARCHY_DEPTH`,JD=`${qR}_HIERARCHY_ROOT`,QD=`${qR}_HIERARCHY_ROOT_INDEX`;function tF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function eF(t,e,i){t&&(i.needDefaultSeriesField&&(t[iO]=i.defaultSeriesField),t[tO]=e,t[eO]=i.getKey(t,e,i))}function iF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function sF(t,e,i,s=0,n,r){void 0===r&&(r=e),eF(t,e,i),t[ZD]=s,t[JD]=n||t[i.categoryField],t[QD]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>sF(e,s,i,t[ZD]+1,t[JD],r)))}const nF={label:{name:"label",type:"text"}},rF=`${qR}_rect_x`,aF=`${qR}_rect_x1`,oF=`${qR}_rect_y`,lF=`${qR}_rect_y1`,hF={data:!0},cF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},dF=[...Object.keys(gD),"normal"];function uF(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 vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=TR({},o[e],a);return vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function pF(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;const i=["custom","customParameters"];return t=I(t,null,i),_F(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}),i),t}(h,i)}function gF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function fF(t,e){var i;return null!==(i=null==t?void 0:t[tO])&&void 0!==i?i:e.context.graphicIndex}function mF(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 vF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _F(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),_F(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),_F(t[s],e,i))}function yF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class bF extends RI{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=XL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=wR.getSeriesMarkMap(o)?function(t,e,i){const s=wR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=TR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return TR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=TR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>TR({},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 xF extends OI{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:`${qR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=bF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=yF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(ZO(this._rawData.dataSet,"invalidTravel",qD),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=oI(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=aI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=aI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new tD(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=KD(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(){ZO(this._dataSet,"dimensionStatistics",XD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&SO(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){ZO(this._dataSet,"dimensionStatistics",XD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=SO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&SO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=uF({},pF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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)||Wy(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=TR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=TR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=SD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=SD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=SD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:iO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:sO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,sO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new YD(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},hF),cF),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=>cF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||lI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();yF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:iO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new rR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return ZL(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:iO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,TR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:eO}_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!==aO&&t!==lO&&t!==rO&&t!==oO||(t=this.getStackValueField()),null!==(e=kO(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=>$y(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:iO]}}function SF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();DC(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 AF(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}}}xF.mark=nF,xF.transformerConstructor=bF;class kF extends xF{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);DC(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:`${qR}_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(aO),this.setFieldX2(rO)):(this.setFieldY(aO),this.setFieldY2(rO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(lO),this.setFieldX2(oO)):(this.setFieldY(lO),this.setFieldY2(oO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(cO),this.setFieldX2(hO)):(this.setFieldY(cO),this.setFieldY2(hO))}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(t.ChartEvent.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)&&(SF("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)}}function MF(t){return"bottom"===t||"top"===t}function TF(t){return"left"===t||"right"===t}function wF(t){return"z"===t}function CF(t,e){return cR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function EF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function BF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?MF(t)?"linear":"band":MF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const PF=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):["linear","log","symlog"].includes(e)?ID("axisLinear",i):{})&&void 0!==s?s:{},r=MF(t)?ID("axisX",i):TF(t)?ID("axisY",i):ID("axisZ",i);return TR({},ID("axis",i),n,r)};class LF{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:zy)("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:zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>zC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return MF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class RF extends LF{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:GO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const OF=(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))},IF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},DF=(t,e,i,s)=>{var n;const r=e.getScale(),a=zC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:FF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,zF=(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};class jF extends LF{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)=>!OF(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:GO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:GO.canvas}),callback:this.onMouseOut}),Uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:GO.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})}}var HF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(HF||(HF={}));const VF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class NF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(VF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:OD,curveType:RD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===LD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(VF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:mF(this._spec,VF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${qR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[VF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,TR({},this._spec[VF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const UF=Object.assign(Object.assign({},nF),VF),WF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>WF(t,e[i])));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]))},GF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class YF extends rD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return GF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(FC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?WF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[eO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class $F extends YF{constructor(){super(...arguments),this.type=$F.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)===YL.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}$F.type="line";const XF=()=>{wR.registerMark($F.type,$F),Xk(),zk(),kB(),yB(),xD(),wR.registerGraphicComponent("line",Cg)};class KF extends rD{constructor(){super(...arguments),this.type=KF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}KF.type="symbol";const qF=()=>{wR.registerMark(KF.type,KF),Xk(),qk(),yB(),wR.registerGraphicComponent("symbol",Mg)};class ZF extends bF{_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 JF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function QF(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:!k(o.min),extendable_max:!k(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 tz(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 ez(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 iz(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 sz(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 nz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return BC(v)};class rz{constructor(t){this.id=Yy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class az extends rz{constructor(){super(az.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!DC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&JF(c)&&JF(d)))return;const u=QF(t,c),p=QF(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!ez(u,p))return}else if(0===y&&0===b){if(!ez(p,u))return}else if(_||A)if(_&&!A){if(!tz(u,p))return}else if(A&&!_){if(!tz(p,u))return}else{if(f===b)return;if(f>b){if(!iz(u,p))return}else if(!iz(p,u))return}else{if(0===f&&0===y){if(!sz(u,p))return}else if(0===b&&0===g&&!sz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){ZO(e.getOption().dataSet,"tickAlign",nz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}az.pluginType="component",az.type="AxisSyncPlugin";const oz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function lz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function hz(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 cz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const dz=t=>"band"===t||"ordinal"===t||"point"===t;function uz(t,e){return{id:t,label:t,value:e,rawValue:t}}function pz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class gz extends cD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const fz=`${qR}_ARC_TRANSFORM_VALUE`,mz=`${qR}_ARC_RATIO`,vz=`${qR}_ARC_START_ANGLE`,_z=`${qR}_ARC_END_ANGLE`,yz=`${qR}_ARC_K`,bz=`${qR}_ARC_MIDDLE_ANGLE`,xz=`${qR}_ARC_QUADRANT`,Sz=`${qR}_ARC_RADIAN`,Az=-Math.PI/2,kz=3*Math.PI/2,Mz=.6,Tz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},wz=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):"linear"===e?ID("axisLinear",i):{})&&void 0!==s?s:{},r=ID("angle"===t?"axisAngle":"axisRadius",i);return TR({},ID("axis",i),n,r)};function Cz(t,e,i,s){switch(t){case r.cartesianBandAxis:return PF(CF(i,["z"]),"band",e);case r.cartesianLinearAxis:return PF(CF(i,["z"]),"linear",e);case r.cartesianLogAxis:return PF(CF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return PF(CF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return PF(CF(i),void 0,e);case r.polarBandAxis:return wz(i.orient,"band",e);case r.polarLinearAxis:return wz(i.orient,"linear",e);case r.polarAxis:return wz(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>MF(t.orient)));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>TF(t.orient)));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Ez(i,ID(t,e));default:return ID(t,e)}}const Ez=(t,e)=>{var i;const s=TR({},e,e[EF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Bz extends RI{getTheme(t,e){return Cz(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({},mR(e)),{[s]:0}))}}class Pz extends DI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Bz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Ic||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:GO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 gz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Lz,Rz;Pz.transformerConstructor=Bz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Lz||(Lz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Rz||(Rz={}));class Oz extends rD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=wR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(NO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Oz.type="component";const Iz=()=>{wR.registerMark(Oz.type,Oz)},Dz=t=>t;class Fz extends Pz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Lz.circleAxis:Lz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Rz.circleAxisGrid:Rz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=uF(null===(h=wR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new tD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return HL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?DC(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 HL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=VL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(HL(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=OO(s=t.domainLine)).startSymbol=OO(s.startSymbol),s.endSymbol=OO(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 FO(TR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:FO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 FO(TR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:FO(t.tick.style)),t.tick.state&&(i.tick.state=IO(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 FO(TR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:FO(t.subTick.style)),t.subTick.state&&(i.subTick.state=IO(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=oz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:TR({},d,FO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:FO(h.style)}),h.state&&(i.title.state.shape=IO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:FO(o.style)}),o.state&&(i.title.state.background=IO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=IO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=FO(t.background.style)),t.background.state&&(i.panel.state=IO(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 FO(TR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:FO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:FO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=DD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){JO(this._option.dataSet,"scale",Dz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===pT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Fz.specKey="axes";const zz=()=>{Iz(),wR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},jz=[az];class Hz extends Fz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),HL(this._regions,(t=>{const e=this.getOrient();MF(e)?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):TF(e)?pz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):wF(e)&&pz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=TR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(TR({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=MF(this.getOrient()),n=t=>{var e;return(s?!MF(t.getOrient()):MF(t.getOrient()))&&DC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=CF(i,["z"]),wF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!cz(e))return null;const{axisType:t,componentName:s}=BF(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=>TF(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(!cz(t))return;const{axisType:s,componentName:n}=BF(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=wR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return MF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):wF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(jz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){MF(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&&!MF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!wF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;TF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=MF(this.getOrient())?t.fieldX:wF(this.getOrient())?t.fieldZ:t.fieldY,DC(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:DC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(NO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(MF(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=MF(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)}))}collectScale(){const t=[];return HL(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]:MF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:wF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HL(this._regions,(e=>{MF(t)?pz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):TF(t)?pz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):wF(t)&&pz(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=MF(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=MF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=TR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=MF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return uz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:DC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Hz.type=r.cartesianAxis,Hz.specKey="axes";const Vz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Nz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Wz=(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 Gz(t,e,i="count"){const s=Wz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Yz=Math.sqrt(50),$z=Math.sqrt(10),Xz=Math.sqrt(2);class Kz{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=hz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=MF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Uz),e.sort(Uz),{domain:Nz(t,e),scope:Gz(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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}=hz(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>=Yz?10:n>=$z?5:n>=Xz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const qz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Zz={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}}},Jz={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}}},Qz={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}}};class tj extends Hz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!wF(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=MF(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=dR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 ZO(this._option.dataSet,t,IE),t}}tj.type=r.cartesianLinearAxis,tj.specKey="axes",tj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(tj,Kz);const ej=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(tj.type,tj)};class ij{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new tD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=uz(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=>uz(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 sj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class nj extends Hz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,HE),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=qC(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{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(nj.type,nj,!1)};class aj extends tj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{MF(this.getOrient())?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):pz(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=TR({},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 wa(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 tD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>uz(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=>uz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}aj.type=r.cartesianTimeAxis,aj.specKey="axes",aj.builtInTheme={axis:Qz,axisX:Zz,axisY:Jz};class oj extends tj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new BE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}oj.type=r.cartesianLogAxis,oj.specKey="axes",oj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(oj,Kz);class lj extends tj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}lj.type=r.cartesianSymlogAxis,lj.specKey="axes",lj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(lj,Kz);const hj=`${qR}_hide_`;function cj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const dj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[hj]&&(cj(t,!0),t[hj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[hj]=!0,cj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},uj=()=>{wR.registerGrammarTransform("symbolOverlap",{transform:dj,runType:"afterEncode"})},pj={min:K,max:X,average:IL,sum:OL};function gj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function fj(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 mj(t,e,i,s){return fj(t,e,i,"min",s)}function vj(t,e,i,s){return fj(t,e,i,"max",s)}function _j(t,e,i,s){return fj(t,e,i,"average",s)}function yj(t,e,i,s){return fj(t,e,i,"sum",s)}const bj=(t,e)=>{let i=d(t.size)?t.size():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=gj;if("min"===n?l=mj:"max"===n?l=vj:"average"===n?l=_j:"sum"===n&&(l=yj),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[]},xj=()=>{wR.registerGrammarTransform("dataSampling",{transform:bj})};class Sj extends kF{constructor(){super(...arguments),this.type=YL.line,this.transformerConstructor=ZF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(uF(null===(i=wR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Sj.type=YL.line,Sj.mark=UF,Sj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Sj.transformerConstructor=ZF,G(Sj,NF);class Aj{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)=>{lI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];Fy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Fy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class kj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{SO(e,[{key:t,operations:DC(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&&SO(e,[{key:i.field,operations:DC(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?oR("colorOrdinal"):oR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:U(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=DC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=DC(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;DC(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(DC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=DC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));DC(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 Mj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Tj extends LI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Yy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ZR,height:JR},this._viewRect={width:ZR,height:JR},this._viewBox={x1:0,y1:0,x2:ZR,y2:JR},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=mR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new VO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Aj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Mj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=wR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=wR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=wR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof OI)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 rD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof rD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&lI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=SI(this._spec,this._option,{width:ZR,height:JR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=ZL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new kj(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){AI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=ZL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{AI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,AI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):AI(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()];AI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=gR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NO.AFTER_MARK_RENDER_END,e)};this._event.on(NO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:jO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(zO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===HF.dimensionHover||s===HF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>zC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const wj=(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 Cj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):MR(t,a,c.spec),MR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=wj(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=wj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(wR.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(wR.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=wR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=wR.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=wR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):FD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=FD(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"];return 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}))}_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 Ej extends Cj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&TR(i,kI(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 Bj extends Ej{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),xI(t)}}const Pj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=MO(t,!0);for(const e in o)for(const i in o[e].nodes)EO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)CO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&wO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Rj{_beforeInit(){this._dataSet&&ZO(this._dataSet,"stackSplit",Pj)}_initStack(){this._stack=new Lj(this),this._stack.init()}}const Oj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:HF.dimensionHover};class Ij extends AD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Oj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=jO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Ij.type="dimension-hover",Ij.defaultOptions=Oj;const Dj=()=>{wR.registerInteractionTrigger(Ij.type,Ij)},Fj=()=>{wR.registerComposedEvent(HF.dimensionHover,jF),wR.registerComposedEvent(HF.dimensionClick,RF)},zj=t=>t.fieldX[0],jj=t=>t.fieldY[0],Hj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Vj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Nj=(t,e)=>t?e?zj:Hj:e?jj:Vj,Uj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=zF(t,(t=>MF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=zF(t,(t=>TF(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=>{zC(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=Wj(t,i,Nj(e,zC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Wj(t,i,Nj(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},Wj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Gj(t,s,i)},Gj=(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=DF(e,t,"cartesian",null!=i?i:MF(t.getOrient())?zj:jj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},Yj=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(zC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(DC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=lz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Xj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&$j(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),$j=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=DD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Xj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},Kj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},qj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Zj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return Yj(c,r,e),c.xField.cacheInfo?Kj(c.xField):c.yField.cacheInfo?Kj(c.yField):void 0},Jj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],Qj=(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])&&Jj.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(tH(s).every((t=>{var e;return!ND("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},tH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},eH={dom:`${qR}_TOOLTIP_HANDLER_DOM`,canvas:`${qR}_TOOLTIP_HANDLER_CANVAS`},iH={key:"其他",value:"..."};var sH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sH||(sH={}));class nH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=Qj(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({},iH),t):iH;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)&&ND(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 rH extends nH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!zC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aH=()=>{wR.registerTooltipProcessor("dimension",rH)};class oH extends nH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Go.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(jO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lH=()=>{wR.registerTooltipProcessor("mark",oH)};class hH extends nH{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 cH=()=>{wR.registerTooltipProcessor("group",hH)};class dH extends Tj{constructor(){super(...arguments),this.transformerConstructor=Bj,this.type="line",this.seriesType=YL.line}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}dH.type="line",dH.seriesType=YL.line,dH.transformerConstructor=Bj,G(dH,Rj);const uH=[...GF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class pH extends YF{constructor(){super(...arguments),this.type=pH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return uH}_getIgnoreAttributes(){return[]}}pH.type="area";const gH=()=>{wR.registerMark(pH.type,pH),Xk(),Ck(),kB(),yB(),xD(),wR.registerGraphicComponent("area",Qg)};class fH extends YD{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 mH=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}}),vH=()=>{wR.registerAnimation("area",yD),bD(),vD()};class _H extends ZF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=TR({},f.style,g.style),l.state=TR({},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 yH extends kF{constructor(){super(...arguments),this.type=YL.area,this.transformerConstructor=_H,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(yH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===LD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return lR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[aO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(uF(null===(e=wR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("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 fH(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(){super.onLayoutEnd(),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}}}yH.type=YL.area,yH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},yH.mark=mH,yH.transformerConstructor=_H,G(yH,NF);class bH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(t)}}class xH extends Tj{constructor(){super(...arguments),this.transformerConstructor=bH,this.type="area",this.seriesType=YL.area}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}xH.type="area",xH.seriesType=YL.area,xH.transformerConstructor=bH,G(xH,Rj);function SH(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 AH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SH(t,e)}),kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SH(t,e)}),MH={type:"fadeIn"},TH={type:"growCenterIn"};function wH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MH;case"scaleIn":return TH;default:return AH(t)}}class CH extends rD{constructor(){super(...arguments),this.type=CH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CH.type="rect";const EH=()=>{Xk(),Wk(),mB("rect",xB),wR.registerMark(CH.type,CH),lw.registerBuiltInAnimate("growHeightIn",tC),lw.registerBuiltInAnimate("growHeightOut",eC),lw.registerBuiltInAnimate("growWidthIn",vC),lw.registerBuiltInAnimate("growWidthOut",_C),lw.registerBuiltInAnimate("growCenterIn",Zw),lw.registerBuiltInAnimate("growCenterOut",Jw),wR.registerGraphicComponent("rect",Lg)},BH=Object.assign(Object.assign({},nF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function PH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=_R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[rF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):lR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):lR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=lR(this._dataToPosX(t),e,i),n=lR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[oF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):lR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):lR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=lR(this._dataToPosY(t),e,i),n=lR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},OH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:mF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(OH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(ZO(this._option.dataSet,"addVChartProperty",jD),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};ZO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new tD(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=lF,s=oF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=aF,s=rF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=MO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PH(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=lR(this[r](t),l,i),u=lR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[rO],n=t[aO],r=t[oO],h=t[lO];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]),{[rO]:i,[aO]:s}),a?{[oO]:o,[lO]: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(Lg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>lR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>lR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=AF(this);this._barMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pF(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=_R(this._spec.barWidth,a)),l&&(c=Math.max(c,_R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,_R(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=_R(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=DC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}OH.type=YL.bar,OH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},OH.mark=BH,OH.transformerConstructor=RH;const IH=()=>{xj(),EH(),wR.registerAnimation("bar",((t,e)=>({appear:wH(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t)}))),rj(),ej(),wR.registerSeries(OH.type,OH)};class DH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(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 FH extends Tj{constructor(){super(...arguments),this.transformerConstructor=DH,this.type="bar",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}FH.type="bar",FH.seriesType=YL.bar,FH.transformerConstructor=DH,G(FH,Rj);const zH=[10,20],jH=OC.Linear,HH="circle",VH=OC.Ordinal,NH=["circle","square","triangle","diamond","star"],UH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},WH=Object.assign(Object.assign({},nF),{point:{name:"point",type:"symbol"}});class GH extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class YH extends kF{constructor(){super(...arguments),this.type=YL.scatter,this.transformerConstructor=GH,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=`${qR}_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=`${qR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:jH,defaultRange:zH},"size")}getShapeAttribute(t,e){return u(e)?HH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VH,defaultRange:NH},"shape")}initMark(){this._symbolMark=this._createMark(YH.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,YH.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=AF(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(uF(null===(i=wR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:HH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}YH.type=YL.scatter,YH.mark=WH,YH.builtInTheme={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"}}}}},YH.transformerConstructor=GH;const $H=()=>{qF(),wR.registerAnimation("scatter",((t,e)=>Object.assign({appear:UH(0,e)},fD))),rj(),ej(),wR.registerSeries(YH.type,YH)};class XH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class KH extends Tj{constructor(){super(...arguments),this.transformerConstructor=XH,this.type="scatter",this.seriesType=YL.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}KH.type="scatter",KH.seriesType=YL.scatter,KH.transformerConstructor=XH,G(KH,Rj);class qH extends xF{constructor(){super(...arguments),this.type=YL.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=`${qR}_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 ZH=`${qR}_MAP_LOOK_UP_KEY`,JH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[tO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[ZH]=e.nameMap[n]:t[ZH]=n})),t.features);class QH extends YD{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 tV extends rD{constructor(){super(...arguments),this.type=tV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}tV.type="path";const eV=()=>{wR.registerMark(tV.type,tV),Xk(),Hk(),wR.registerGraphicComponent("path",qg)},iV=Object.assign(Object.assign({},nF),{area:{name:"area",type:"path"}});class sV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 nV{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(){}}class rV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:nV}:Uy(e)||Wy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:rV}:null}const oV={debounce:xt,throttle:St};class lV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Uy(this._renderMode)||Wy(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,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,oV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,oV[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:YO.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:YO.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||aV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:YO.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:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=oV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=oV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:YO.chart})}));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:YO.chart,source:GO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp)}))}}function hV(t,e){return`${qR}_${e}_${t}`}class cV extends Pz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:hV(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=TR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 sV(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===YL.map||e.type===YL.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),HL(this._regions,(t=>{var e;if(t.type===YL.map||t.type===YL.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==YL.map&&e.type!==YL.pictogram||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[ZH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}cV.type=r.geoCoordinate,G(cV,lV);const dV=()=>{wR.registerComponent(cV.type,cV)};class uV extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class pV extends qH{constructor(){super(...arguments),this.type=YL.map,this.transformerConstructor=uV,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 !`),QO.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),ZO(this._dataSet,"copyDataView",rI),ZO(this._dataSet,"map",JH),ZO(this._dataSet,"lookup",zD);const s=QO.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:ZH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(pV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:mF(this._spec,pV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:iO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:iO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(uF(null===(t=wR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new QH(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[tO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[tO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 tO}getActiveMarks(){return[this._pathMark]}}pV.type=YL.map,pV.mark=iV,pV.builtInTheme={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"}}}}},pV.transformerConstructor=uV;const gV=`${qR}_waterfall_default_seriesField`,fV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[pO]=!0:delete t[pO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=mV([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 f=g[0];let{start:m,end:v}=vV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=mV(r,t,n,a,c,h,i,e),a.push(n)})),a};function mV(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}=vV(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===gV)&&(t[gV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function vV(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?Fy("total.collectCountField error"):n=e[a].start;o<0?Fy("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=ie(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 _V=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},yV={type:"fadeIn"},bV={type:"growCenterIn"};function xV(t,e){switch(e){case"fadeIn":return yV;case"scaleIn":return bV;default:return AH(t,!1)}}class SV extends rD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Cg(t)}}SV.type="rule";const AV=()=>{wR.registerMark(SV.type,SV),Xk(),zk(),wR.registerGraphicComponent("line",Cg)},kV=Object.assign(Object.assign({},BH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),MV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:TV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function TV(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)=>TV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class wV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),ZO(e,"dimensionTree",MV),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 CV extends RH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const EV={rect:IV,symbol:RV,arc:FV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=RV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:zV,line:jV,area:jV,rect3d:IV,arc3d:FV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function BV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=EV[t])&&void 0!==i?i:EV.point;return e.series.type===YL.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=LV(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:HV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function PV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==YL.sankey){const{formatFunc:t,args:n}=DD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function LV(t){return d(t)?e=>t(e.data):t}function RV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=LV(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:OV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function OV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function IV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=LV(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:DV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function DV(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 FV(t){var e;const{labelSpec:i}=t,s=null!==(e=LV(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 zV(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=PV(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),Sg(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 jV(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}))):[{index:0,[iO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function HV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class VV extends OH{constructor(){super(...arguments),this.type=YL.waterfall,this.transformerConstructor=CV,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 wV(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=gV)}getSeriesKeys(){return this._seriesField===gV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),ZO(this._dataSet,"waterfallFillTotal",_V),ZO(this._dataSet,"waterfall",fV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=aI(this.getViewData(),this._dataSet,{name:`${qR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new tD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:rO,endAs:aO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=AF(this);this._barMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("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(){super.initMark();const t=this._createMark(VV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return zV(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?lR(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):lR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}VV.type=YL.waterfall,VV.mark=kV,VV.builtInTheme={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}}}},VV.transformerConstructor=CV;const NV=()=>{AV(),EH(),wR.registerAnimation("waterfall",((t,e)=>({appear:xV(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t,!1)}))),_D(),rj(),ej(),wR.registerSeries(VV.type,VV)},UV=`${qR}_BOX_PLOT_OUTLIER_VALUE`;var WV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(WV||(WV={}));const GV=(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={[UV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class YV extends YD{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return this.series.getOutliersField();if(t===WV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case WV.MIN:return this.series.getMinField();case WV.MAX:return this.series.getMaxField();case WV.MEDIAN:return this.series.getMedianField();case WV.Q1:return this.series.getQ1Field();case WV.Q3:return this.series.getQ3Field();case WV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return e[UV];if(t===WV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case WV.MIN:return e[this.series.getMinField()];case WV.MAX:return e[this.series.getMaxField()];case WV.MEDIAN:return e[this.series.getMedianField()];case WV.Q1:return e[this.series.getQ1Field()];case WV.Q3:return e[this.series.getQ3Field()];case WV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[UV])}getDefaultContentList(t){return[{key:this.getContentKey(WV.OUTLIER),value:this.getContentValue(WV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(WV.MAX),value:this.getContentValue(WV.MAX)},{key:this.getContentKey(WV.Q3),value:this.getContentValue(WV.Q3)},{key:this.getContentKey(WV.MEDIAN),value:this.getContentValue(WV.MEDIAN)},{key:this.getContentKey(WV.Q1),value:this.getContentValue(WV.Q1)},{key:this.getContentKey(WV.MIN),value:this.getContentValue(WV.MIN)},{key:this.getContentKey(WV.SERIES_FIELD),value:this.getContentValue(WV.SERIES_FIELD)}]}}class $V extends rD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Og(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=wR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const XV=()=>{wR.registerGraphicComponent("glyph",Og),Xk(),Lk()},KV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],qV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class ZV extends $V{constructor(){super(...arguments),this.type=ZV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=KV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}ZV.type="boxPlot";const JV=Object.assign(Object.assign({},nF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),QV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},eN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),iN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=eN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=eN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=eN(t,"box").attribute.width,i=eN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=eN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=eN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=eN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=eN(t,"box").attribute.height,i=eN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=eN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=eN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=eN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=eN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=eN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=eN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=eN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=eN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=eN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class nN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return QV(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class rN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends nN{computeAttribute(){return QV(sN)(this.target,this.params,this.params.options)}}class oN extends rN{computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}}class lN extends kF{constructor(){super(...arguments),this.type=YL.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(){this._boxPlotMark=this._createMark(lN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(lN.mark.outlier,{key:tO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>lR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>lR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>lR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>lR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>lR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;ZO(this._dataSet,"foldOutlierData",GV),ZO(this._dataSet,"addVChartProperty",jD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${qR}_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:tF.bind(this),call:eF}},!1),this._outlierDataView=new tD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=AF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=wR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uF(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(uF(null===(a=wR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new YV(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]}}lN.type=YL.boxPlot,lN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},lN.mark=JV;const hN=()=>{XV(),zk(),Wk(),wR.registerGraphicComponent("line",(t=>Cg(t))),wR.registerGraphicComponent("rect",(t=>Lg(t))),wR.registerMark(ZV.type,ZV),qF(),vD(),rj(),ej(),lw.registerBuiltInAnimate("boxplotScaleIn",nN),lw.registerBuiltInAnimate("boxplotScaleOut",rN),lw.registerBuiltInAnimate("barBoxplotScaleIn",aN),lw.registerBuiltInAnimate("barBoxplotScaleOut",oN),wR.registerSeries(lN.type,lN)};class cN extends rD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?$g(t):Sg(t)}}cN.type="text";const dN=()=>{wR.registerMark(cN.type,cN),Xk(),Jk(),Yk(),wR.registerGraphicComponent("text",Sg),wR.registerGraphicComponent("richtext",$g)};class uN extends YD{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 pN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),gN={type:"fadeIn"},fN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function mN(t,e){return"fadeIn"===e?gN:pN(t)}const vN=Object.assign(Object.assign({},BH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class _N extends RH{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 yN extends OH{constructor(){super(...arguments),this.type=YL.rangeColumn,this._barMarkType="rect",this._barName=YL.bar,this.transformerConstructor=_N}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,yN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(yN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(yN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=AF(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(uF(null===(i=wR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uF(null===(n=wR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new uN(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)}}yN.type=YL.rangeColumn,yN.mark=vN,yN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},yN.transformerConstructor=_N;const bN=()=>{EH(),dN(),wR.registerAnimation("rangeColumn",((t,e)=>({appear:mN(t,e),enter:pN(t),exit:fN(t),disappear:fN(t)}))),_D(),rj(),ej(),wR.registerSeries(yN.type,yN)};var xN,SN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(xN||(xN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(SN||(SN={}));class AN extends YD{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 kN=Object.assign({},mH);class MN extends yH{constructor(){super(...arguments),this.type=YL.rangeArea}initMark(){this._areaMark=this._createMark(MN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AN(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))}}MN.type=YL.rangeArea,MN.mark=kN;class TN extends xF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Mz,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:[]};DC(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:[]};DC(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(t.ChartEvent.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)&&SF(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 wN(t){return $y(t)?Number.parseFloat(t):0}const CN=(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&&EN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[fz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[fz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},EN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===wN(t[e])))||!i&&0===t.reduce(((t,i)=>t+wN(i[e])),0)));function BN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const PN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:BN(t,!0,cI.appear)}),LN={type:"fadeIn"},RN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:BN(t,!0,cI.enter)}),ON=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:BN(t,!0,cI.exit)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:BN(t,!0,cI.exit)});function DN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return LN;case"growRadius":return PN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return PN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class FN extends rD{constructor(t,e){super(t,e),this.type=zN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[bz])[t]+s,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 zN extends FN{constructor(){super(...arguments),this.type=zN.type}}zN.type="arc";const jN=()=>{Xk(),Tk(),mB("arc",wB),lw.registerBuiltInAnimate("growRadiusIn",gC),lw.registerBuiltInAnimate("growRadiusOut",fC),lw.registerBuiltInAnimate("growAngleIn",Kw),lw.registerBuiltInAnimate("growAngleOut",qw),wR.registerGraphicComponent("arc",sf),wR.registerMark(zN.type,zN)},HN=Object.assign(Object.assign({},nF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class VN extends bF{_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=TR({},this._theme,i,t);const n=(t,e)=>TR({},"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 NN=`${qR}_LABEL_VISIBLE`;class UN extends TN{constructor(){super(...arguments),this.transformerConstructor=VN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:pR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:pR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Az,this._endAngle=kz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[bz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;ZO(this._dataSet,"pie",CN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:vz,asEndAngle:_z,asRatio:mz,asMiddleAngle:bz,asRadian:Sz,asQuadrant:xz,asK:yz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new tD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},UN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return UL(vz)(t)}endAngleScale(t){return UL(_z)(t)}_computeLayoutRadius(){return Tz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:hR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:hR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:UL(NN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[bz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===cI.appear)return this._startAngle;if(i===cI.disappear)return this._endAngle;const r=[cI.disappear,cI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[tO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=uF(null===(i=wR.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]}}UN.transformerConstructor=VN,UN.mark=HN,UN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class WN extends UN{constructor(){super(...arguments),this.type=YL.pie}}WN.type=YL.pie;const GN=()=>{jN(),wR.registerAnimation("pie",((t,e)=>({appear:DN(t,e),enter:RN(t),exit:ON(t),disappear:IN(t)}))),wR.registerAnimation("emptyCircle",((t,e)=>({appear:DN(t,e)}))),wR.registerSeries(WN.type,WN)};function YN(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const $N=t=>({type:YN(t.growField),options:{overall:!0}}),XN={type:"fadeIn"},KN=t=>({type:YN(t.growField)}),qN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},ZN=qN;function JN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XN;case"growAngle":return $N(Object.assign(Object.assign({},t),{growField:"angle"}));default:return $N(Object.assign(Object.assign({},t),{growField:"radius"}))}}class QN extends TN{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(aO),this.setInnerRadiusField(rO)}setValueFieldToPercent(){this.setRadiusField(lO),this.setInnerRadiusField(oO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const tU=Object.assign(Object.assign({},nF),{rose:{name:"rose",type:"arc"}});class eU extends bF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class iU extends Fz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=wR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=Az,this._endAngle=kz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):pz(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:pR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:pR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:lz(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(){HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):pz(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 DC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:DC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>uz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 Tz((()=>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=Mz,e=0;const i=this.getChart().getSpec();return HL(this.getRegions(),(s=>{const n=s;if(r=n.type,[YL.rose,YL.radar,YL.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(TR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(TR({},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)}}iU.type=r.polarAxis,iU.specKey="axes";const sU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},nU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class rU extends iU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}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 ZO(this._option.dataSet,t,IE),t}}rU.type=r.polarLinearAxis,rU.specKey="axes",rU.builtInTheme={axis:Qz,axisLinear:qz,axisAngle:nU,axisRadius:sU},G(rU,Kz);const aU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(rU.type,rU)};class oU extends iU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,UE),t}transformScaleDomain(){}}oU.type=r.polarBandAxis,oU.specKey="axes",oU.builtInTheme={axis:Qz,axisBand:sj,axisAngle:nU,axisRadius:sU},G(oU,ij);const lU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(oU.type,oU)};class hU extends QN{constructor(){super(...arguments),this.type=YL.rose,this.transformerConstructor=eU,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(){this._roseMark=this._createMark(hU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,hU.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=>lR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=lR(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(uF(null===(i=wR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}hU.type=YL.rose,hU.mark=tU,hU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},hU.transformerConstructor=eU;const cU=()=>{wR.registerSeries(hU.type,hU),jN(),wR.registerAnimation("rose",((t,e)=>({appear:JN(t,e),enter:KN(t),exit:qN(t),disappear:ZN(t)}))),lU(),aU()};class dU extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,PL(this._fromAngle,this._toAngle)&&PL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class uU extends Nw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!jL(t)&&!jL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const pU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function gU(t,e,i){return"fadeIn"===e?pU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function fU(t,e,i){return"fadeIn"===e?pU(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 mU=(t,e)=>({custom:Hw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),vU=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}});class _U extends QN{constructor(){super(...arguments),this.type=YL.radar,this.transformerConstructor=ZF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(_U.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:RD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):Az},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(uF(null===(s=wR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=wR.getAnimationInKey(e);t.setAnimationConfig(uF(null==i?void 0:i(n,r),pF(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}}}_U.type=YL.radar,_U.mark=vU,_U.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_U.transformerConstructor=ZF,G(_U,NF);const yU=()=>{wR.registerSeries(_U.type,_U),gH(),XF(),qF(),wR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:gU(t,e,"in"),enter:gU(t,e,"in"),exit:gU(t,e,"out"),disappear:"clipIn"===e?void 0:gU(t,e,"out"),update:[{channel:["points","center"],custom:uU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),wR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:dU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing}]}))),wR.registerAnimation("radarGroup",((t,e)=>({appear:mU(t,"in"),disappear:mU(t,"out")}))),Tk(),lU(),aU()};class bU extends YD{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=>fi.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 xU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(qR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[tO]:r,[eO]:`${s}_${e}`})),r++}))})),n},SU={fill:"#bbb",fillOpacity:.2},AU=Object.assign(Object.assign({},nF),{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 kU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZO(this._option.dataSet,"objFlat",xU),ZO(this._option.dataSet,"copyDataView",rI),JO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(TR(SU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(kU.mark.group),this._containerMark=this._createMark(kU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(kU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(kU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(kU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(kU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(kU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(kU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:iO}}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 rR).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:iO}}initTooltip(){this._tooltipHelper=new bU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}kU.type=YL.dot,kU.mark=AU,kU.builtInTheme={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"}}}}};class MU extends YD{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=>fi.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 TU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),wU=(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 CU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),ZO(this._option.dataSet,"linkDotInfo",wU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(CU.mark.group),this._containerMark=this._createMark(CU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(CU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(CU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:iO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new MU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}CU.type=YL.link,CU.mark=TU,CU.builtInTheme={link:{arrow:{style:{size:10}}}};const EU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"}});class BU extends TN{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()?rO:yO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?aO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):Az;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):kz,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=lR(this.angleAxisHelper.dataToPosition([t[rO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=lR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?lR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(BU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return sf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Lg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 OU=()=>{wR.registerAnimation("circularProgress",((t,e)=>({appear:RU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class IU extends bF{constructor(){super(...arguments),this._supportStack=!0}}class DU extends BU{constructor(){super(...arguments),this.type=YL.circularProgress,this.transformerConstructor=IU,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(k(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(k(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(){return this._progressMark=this._createMark(DU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:mF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(DU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?rO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?aO: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",t.AttributeLevel.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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DU.type=YL.circularProgress,DU.mark=PU,DU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DU.transformerConstructor=IU;const FU=()=>{wR.registerSeries(DU.type,DU),jN(),OU(),_D(),lU(),aU()};function zU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const jU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:zU(t)}),HU={type:"fadeIn"};function VU(t,e="grow"){return!1===e?{}:"fadeIn"===e?HU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zU(t)}))(t)}class NU extends YD{enableByType(t){return"dimension"!==t}}const UU=Object.assign(Object.assign({},nF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class WU extends kF{constructor(){super(...arguments),this.type=YL.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;return this._progressMark=this._createMark(WU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return lR(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+n},y1:t=>{var e,i;return lR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return lR(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 e,s;return lR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(WU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return lR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(uF(null===(i=wR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}WU.type=YL.linearProgress,WU.mark=UU,WU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const GU=()=>{EH(),wR.registerAnimation("linearProgress",((t,e)=>({appear:VU(t,e),enter:VU(t),disappear:jU(t)}))),_D(),wR.registerSeries(WU.type,WU)},YU=[0],$U=[20,40],XU=[200,500],KU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},qU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],ZU=`${qR}_WORD_CLOUD_TEXT`,JU=Object.assign(Object.assign({},nF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),QU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class tW extends xF{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=$U}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:XU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:YU,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)?ZU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:KU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Ny(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:YU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!qU.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 e;this._wordMark=this._createMark(tW.mark.word,{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(tW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(uF(wR.getAnimationInKey("wordCloud")(n,s),pF("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 rR).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:iO])}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 TE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new TE).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[tO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:eO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:uf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:Hg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}tW.mark=JU,tW.builtInTheme={wordCloud:QU};function eW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||gD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=iW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},sW=(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=sW(t.children,e,t,n))})),s},nW=(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=nW(t.children,e,t,n)),n=e(t,s,i,n)})),n},rW=(t,e=[],i)=>{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):rW(t.children,e,i)))})),e};function aW(t,e){let i,s;if(hW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function hW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function pW(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 gW(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 fW(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 mW(t){return{_:t,next:null,prev:null}}function vW(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];pW(n,s,r);let a,o,l,h,c,d,u,p=mW(s),g=mW(n),f=mW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=iW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:xW.defaultOpionts.nodeSort;sW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)sW([o],_W(h)),nW([o],yW(this._getPadding,.5,a)),sW([o],bW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);sW([o],_W(xW.defaultOpionts.setRadius)),nW([o],yW(Lt,1,a)),c&&nW([o],yW(this._getPadding,o.radius/t,a)),sW([o],bW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}xW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const SW=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=SW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function AW(t){return t.depth}function kW(t,e){return e-1-t.endDepth}const MW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),TW=(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},wW={left:AW,right:kW,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:AW,end:kW},CW=yt(0,1);class EW{constructor(t){this._ascendingSourceBreadth=(t,e)=>MW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>MW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},EW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):wW[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)};"vertical"===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<=0)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))),"vertical"===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=[];SW(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:Mt(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+=Mt(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=[TW(s[t.source]),TW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*CW(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(MW),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(MW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];BW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),PW);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({},LW.defaultOpionts,t):Object.assign({},LW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=iW(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=he({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)}}}function RW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:BW,slice:RW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?RW:BW)(t,e,i,s,n)}};class DW{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({},DW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?OW(this.options.aspectRatio):null!==(e=IW[this.options.splitType])&&void 0!==e?e:IW.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=iW(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)}))}}function FW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=FW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=zW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function GW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*YW({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},XW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||HW,s=e.lossFunction||jW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:$W(l),arcs:l})}))},KW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:qW,triangle:qW,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 qW(){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 ZW(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 JW=t=>KW[t]?KW[t]():KW.circle(),QW=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function tG(t){return d(t)?t:function(){return t}}class eG{constructor(t){var e,i;switch(this.options=j({},eG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=JW(this.options.shape),this.getText=null!==(e=tG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=tG(this.options.fontWeight),this.getTextFontSize=tG(this.options.fontSize),this.getTextFontStyle=tG(this.options.fontStyle),this.getTextFontFamily=tG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>QW(10,50);break;case"random-light":this.getTextColor=()=>QW(50,90);break;default:this.getTextColor=tG(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 ae(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():Tt(e);return ae(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 sG extends eG{constructor(t){var e;super(j({},sG.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<=sG.defaultOptions.minFontSize&&(this.options.minFontSize=sG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=iG[this.options.spiral])&&void 0!==e?e:iG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=tG(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}=ZW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(aG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}oG(p,this._size)&&(p=lG(p,this._size))}else if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||rG(p,i))&&(!i||!nG(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 nG(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 rG(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,oG=(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 lG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},cG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},dG=(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()},uG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=ZW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=JW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)dG(n,cG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)dG(n,cG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=cG({x:l,y:h},o,-Math.PI/2,5),e=cG({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]);dG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let gG=class t extends iG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?cG(t,o,l.width,l.height,h):"geometric"===t.type&&pG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=JW(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()}};gG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class fG extends iG{constructor(t){super(j({},fG.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)}fG.defaultOptions={enlarge:!1};const vG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},_G=(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?yG(t.fontFamily):"sans-serif",d=t.fontStyle?yG(t.fontStyle):"normal",u=t.fontWeight?yG(t.fontWeight):"normal",p=t.rotate?yG(t.rotate):0,g=yG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?yG(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},vG),t.as):vG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?yG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=xG(SG(t,l),C);w=i=>e(t(i))}let E=nG;"fast"===t.layoutType?E=fG:"grid"===t.layoutType&&(E=gG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},yG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],bG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),xG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=bG(t[0]),n=bG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(bG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},SG=(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 AG(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{CR.registerGrammarTransform("wordcloud",{transform:_G}),uN(),CR.registerAnimation("wordCloud",((t,e)=>({appear:iW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),CR.registerSeries(kG.type,kG)},TG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},wG=(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},CG=`${ZR}_FUNNEL_TRANSFORM_RATIO`,EG=`${ZR}_FUNNEL_REACH_RATIO`,BG=`${ZR}_FUNNEL_HEIGHT_RATIO`,PG=`${ZR}_FUNNEL_VALUE_RATIO`,LG=`${ZR}_FUNNEL_LAST_VALUE_RATIO`,RG=`${ZR}_FUNNEL_NEXT_VALUE_RATIO`,OG=`${ZR}_FUNNEL_LAST_VALUE`,IG=`${ZR}_FUNNEL_CURRENT_VALUE`,DG=`${ZR}_FUNNEL_NEXT_VALUE`,FG=`${ZR}_FUNNEL_TRANSFORM_LEVEL`;class zG extends $D{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[EG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class jG extends aD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class HG extends jG{constructor(){super(...arguments),this.type=HG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}HG.type="polygon";const VG=()=>{CR.registerMark(HG.type,HG),Kk(),Uk(),hw.registerBuiltInAnimate("growPointsOut",aC),CR.registerGraphicComponent("polygon",rf)},NG=Object.assign(Object.assign({},rF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class UG extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class WG extends SF{constructor(){super(...arguments),this.type=$L.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=UG,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;JO(this._dataSet,"funnel",TG),JO(this._dataSet,"funnelTransform",wG);const t=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new eD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:IG,asTransformRatio:CG,asReachRatio:EG,asHeightRatio:BG,asValueRatio:PG,asNextValueRatio:RG,asLastValueRatio:LG,asLastValue:OG,asNextValue:DG,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:FG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},WG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:vF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},WG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(WG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(WG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new zG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Dy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Dy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*WL(EG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),gF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("fadeInOut")(),gF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("funnel")({},o),gF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(pF(null===(a=CR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),gF("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[LG])/2:this._getSecondaryAxisLength(t[PG])/2,n=this._getSecondaryAxisLength(t[PG])/2):(s=this._getSecondaryAxisLength(t[PG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[RG])/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[FG])}_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[iO]===t[iO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{VG(),uN(),kV(),CR.registerSeries(WG.type,WG),CR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vD))),CR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),yD()},YG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},$G=t=>{const e=t.filter((t=>t.context.diffState===EI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},XG=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},KG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),qG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},ZG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),JG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},QG=(t,e={})=>{if(!t)return[];const i=[];return aW(t,i,e),i},tY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new RW(i).layout(t,{width:s,height:n})};class eY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var iY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(iY||(iY={}));const sY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===iY.DrillDown){return Y(LO(t,n,s,"children"))}if(i.type===iY.DrillUp){const e=RO(t,n,s,"children");if(e)return Y(e)}return t};class nY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=oV(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;JO(t,"drillFilter",sY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:iY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:iY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:iY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:iY.DrillUp},model:this}),r}}const rY=Object.assign(Object.assign({},rF),{sunburst:{name:"sunburst",type:"arc"}}),aY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:JD,operations:["max","min","values"]}),t.push({key:QD,operations:["values"]}),t),oY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class lY extends wN{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),JO(this._dataSet,"sunburstLayout",tY),JO(this._dataSet,"flatten",QG),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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(lY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(lY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new eY(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(pF(null===(e=CR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}lY.type=$L.sunburst,lY.mark=rY,lY.builtInTheme={sunburst:oY},G(lY,nY);const hY=()=>{CR.registerSeries(lY.type,lY),HN(),uN(),yD(),CR.registerAnimation("sunburst",((t,e)=>({appear:JG(0,e),enter:KG(t),exit:ZG(t),disappear:ZG(t)})))},cY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new SW(i).layout(t,{width:s,height:n})};class dY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const uY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},pY=Object.assign(Object.assign({},rF),{circlePacking:{name:"circlePacking",type:"arc"}});class gY extends MF{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},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),JO(this._dataSet,"circlePackingLayout",cY),JO(this._dataSet,"flatten",QG),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)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return aY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new dY(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(pF(null===(i=CR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}gY.type=$L.circlePacking,gY.mark=pY,gY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(gY,nY);const fY=()=>{CR.registerSeries(gY.type,gY),HN(),uN(),_D(),CR.registerAnimation("circlePacking",((t,e)=>({appear:uY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},mY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&mY(t,e.children,i)}))},vY=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},_Y=(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 BW(e),r=[];return r.push(n.layout(s,i)),r},yY=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:[]},bY=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 xY extends $D{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 SY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),AY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:SY(t),kY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class MY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const wY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},CY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class EY extends XV{constructor(){super(...arguments),this.type=EY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?CY:wY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}EY.type="linkPath";const BY=Object.assign(Object.assign({},rF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class PY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const LY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class RY extends MF{constructor(){super(...arguments),this.type=$L.sankey,this.transformerConstructor=PY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=HO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=HO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=HO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),LY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=HO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=HO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=HO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=HO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=HO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(HO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=HO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=HO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){JO(this._dataSet,"sankeyLayout",_Y),JO(this._dataSet,"sankeyFormat",vY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;JO(o,"sankeyNodes",yY),JO(o,"flatten",QG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._nodesSeriesData=l,JO(o,"sankeyLinks",bY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(RY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(RY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=FD(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(pF(null===(i=CR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),gF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),gF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:$O.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(HO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new xY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new aR;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 mY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}RY.type=$L.sankey,RY.transformerConstructor=PY,RY.mark=BY,RY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const OY=()=>{BH(),KV(),Vk(),CR.registerGraphicComponent("path",(t=>Kg(t))),CR.registerMark(EY.type,EY),uN(),CR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:AY(t,e)},vD))),CR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:kY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),hw.registerBuiltInAnimate("linkPathGrowOut",TY),hw.registerBuiltInAnimate("linkPathGrowIn",MY),yD(),CR.registerSeries(RY.type,RY)},IY=(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=QG(n);return i=KD([{latestData:r}],e),i};class DY extends $D{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 FY=Object.assign(Object.assign({},rF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),zY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class jY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const HY=(t,e)=>{if(e.getViewBox()){const i=new FW(e).layout(t,e.getViewBox()),s=[];return aW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[QD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class VY extends MF{constructor(){super(...arguments),this.type=$L.treemap,this.transformerConstructor=jY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:QD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:iO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),JO(this._dataSet,"treemap",HY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=IY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){JO(this._dataSet,"hierarchyDimensionStatistics",IY),JO(this._dataSet,"flatten",QG);const i=new wa(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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(VY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(VY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),gF(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 DY(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(UO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(UO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}VY.type=$L.treemap,VY.mark=FY,VY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},VY.transformerConstructor=jY,G(VY,nY),G(VY,hV);const NY=()=>{CR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),CR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),BH(),uN(),CR.registerAnimation("treemap",((t,e)=>({appear:zY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),yD(),CR.registerSeries(VY.type,VY)},UY=Object.assign(Object.assign({},BU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),WY=Object.assign(Object.assign({},rF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),GY={type:"fadeIn"};function YY(t,e){return"fadeIn"===e?GY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class $Y extends xF{constructor(){super(...arguments),this._supportStack=!1}}class XY extends $D{enableByType(t){return"dimension"!==t}}const KY="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",qY={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:KY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:KY,fill:"#ddd"}}};class ZY extends PU{constructor(){super(...arguments),this.type=$L.gaugePointer,this.transformerConstructor=$Y,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(ZY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},ZY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(ZY.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 XY(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ZY.type=$L.gaugePointer,ZY.mark=WY,ZY.builtInTheme={gaugePointer:qY},ZY.transformerConstructor=$Y;const JY=()=>{CR.registerSeries(ZY.type,ZY),iV(),BH(),CR.registerAnimation("gaugePointer",((t,e)=>{const i=YY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),hU(),oU()};class QY extends xF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class t$ extends PU{constructor(){super(...arguments),this.type=$L.gauge,this.transformerConstructor=QY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();JO(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[xO]=t[this._angleField[0]],t[bO]=e>0?i[e-1][xO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(t$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(t$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[bO])?this.angleAxisHelper.dataToPosition([t[bO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[xO]])}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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}t$.type=$L.gauge,t$.mark=UY,t$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},t$.transformerConstructor=QY;class e$ extends aD{constructor(){super(...arguments),this.type=e$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}e$.type="cell";function i$(t){return!1===t?{}:{type:"fadeIn"}}class s$ extends $D{enableByType(t){return"dimension"!==t}}const n$=Object.assign(Object.assign({},rF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class r$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class a$ extends MF{constructor(){super(...arguments),this.type=$L.heatmap,this.transformerConstructor=r$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(a$.mark.cell,{isSeriesMark:!0},{morph:vF(this._spec,a$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(a$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=kF(this);this._cellMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),gF("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 s$(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]}}a$.type=$L.heatmap,a$.mark=n$,a$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},a$.transformerConstructor=r$;const o$=()=>{uN(),CR.registerMark(e$.type,e$),CR.registerGraphicComponent("symbol",kg),Kk(),Zk(),bB(),CR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vD),{appear:i$(e)}))),aj(),ij(),CR.registerSeries(a$.type,a$)},l$=Object.assign(Object.assign({},rF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),h$=`${ZR}_CORRELATION_X`,c$=`${ZR}_CORRELATION_Y`,d$=`${ZR}_CORRELATION_SIZE`,u$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=p$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),g$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},g$=(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,[eO]:null==n?void 0:n[eO],[sO]:null==n?void 0:n[sO]}};class m$ extends XV{constructor(){super(...arguments),this.type=m$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}m$.type="ripple";const v$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class _$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class y$ extends wN{constructor(){super(...arguments),this.type=$L.correlation,this.transformerConstructor=_$,this._viewBox=new He}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;JO(this._dataSet,"correlation",u$);const s=new Ta;QO(s,"dataview",Aa),JO(s,"correlationCenter",f$);const n=new wa(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 eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(y$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:eO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(y$.mark.ripplePoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(y$.mark.centerPoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[h$],y:t=>t[c$],size:t=>t[d$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),gF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}y$.type=$L.correlation,y$.mark=l$,y$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},y$.transformerConstructor=_$;const b$=()=>{ZF(),KV(),Zk(),CR.registerMark(m$.type,m$),CR.registerGraphicComponent("symbol",(t=>kg(t))),CR.registerSeries(y$.type,y$),CR.registerAnimation("correlation",((t,e)=>Object.assign({appear:v$(0,e)},mD)))},x$=Object.assign(Object.assign({},rF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class S$ extends XV{constructor(){super(...arguments),this.type=S$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}S$.type="liquid";const A$=(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 k$ extends $D{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 M$ extends SF{constructor(){super(...arguments),this.type=$L.liquid,this.transformerConstructor=JF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:A$(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=vR(this._spec.outlineMargin),this._paddingSpec=vR(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=Gt(...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(M$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(M$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(M$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(M$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new k$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),gF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),gF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=xM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}M$.type=$L.liquid,M$.mark=x$,M$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},M$.transformerConstructor=JF;const T$=t=>Y(t).join(",");class w$ extends $D{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const C$=Object.assign(Object.assign({},rF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class E$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const B$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?KW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class P$ extends SF{constructor(){super(...arguments),this.type=$L.venn,this.transformerConstructor=E$,this._viewBox=new He}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:iO)}initData(){var t;super.initData(),JO(this._dataSet,"venn",B$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(P$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(P$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new w$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:T$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return T$(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[T$(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(T$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}}P$.type=$L.venn,P$.mark=C$,P$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},P$.transformerConstructor=E$;class L$ extends IH{constructor(){super(...arguments),this.type=$L.mosaic,this.transformerConstructor=OH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(vO),this.setFieldX2(mO)),this.setFieldY(yO),this.setFieldY2(_O)):(t&&(this.setFieldY(vO),this.setFieldY2(mO)),this.setFieldX(yO),this.setFieldX2(_O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}L$.type=$L.mosaic,L$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},L$.transformerConstructor=OH;class R$ extends Ej{_isValidSeries(t){return t===$L.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class O$ extends wj{constructor(){super(...arguments),this.transformerConstructor=R$,this.type="map",this.seriesType=$L.map}}O$.type="map",O$.seriesType=$L.map,O$.transformerConstructor=R$;class I$ extends Ej{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 D$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=cz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,wR({},s,l)),n&&Object.assign(o,wR({},n,o))}}class F$ extends I${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class z$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class j$ extends wj{constructor(){super(...arguments),this.transformerConstructor=z$}}j$.transformerConstructor=z$;class H$ extends j${constructor(){super(...arguments),this.transformerConstructor=z$,this.type="pie",this.seriesType=$L.pie}}H$.type="pie",H$.seriesType=$L.pie,H$.transformerConstructor=z$;class V$ extends F${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Tz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Tz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const N$=(t,e)=>{if(!t)return null;const i=jF(t,(t=>"angle"===t.getOrient()),e),s=jF(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&&jC(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=zL({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=jL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=FF(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&&jC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=zL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jL(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 _=FF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class U$ extends wj{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rose",this.seriesType=$L.rose}_setModelOption(){this._modelOption.getDimensionInfo=N$}}U$.type="rose",U$.seriesType=$L.rose,U$.transformerConstructor=V$,G(U$,Oj);class W$ extends F${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=wR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class G$ extends wj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="radar",this.seriesType=$L.radar}_setModelOption(){this._modelOption.getDimensionInfo=N$}}G$.type="radar",G$.seriesType=$L.radar,G$.transformerConstructor=W$,G(G$,Oj);class Y$ extends Ej{_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=>{L(e,"trimPadding")&&wR(e,MI(this.type,t))})),this._transformAxisSpec(t)}}class $$ extends wj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Wj(t,e,i))&&void 0!==s?s:[],...null!==(n=N$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}$$.type="common",$$.transformerConstructor=Y$,G($$,Oj);class X$ extends Bj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class K$ extends wj{constructor(){super(...arguments),this.transformerConstructor=X$}}K$.transformerConstructor=X$,G(K$,Oj);class q$ extends X${transformSpec(t){super.transformSpec(t),SI(t)}}class Z$ extends K${constructor(){super(...arguments),this.transformerConstructor=q$,this.type="histogram",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}Z$.type="histogram",Z$.seriesType=$L.bar,Z$.transformerConstructor=q$;class J$ extends D${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Q$ extends wj{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="circularProgress",this.seriesType=$L.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=N$}}Q$.type="circularProgress",Q$.seriesType=$L.circularProgress,Q$.transformerConstructor=J$,G(Q$,Oj);class tX extends D${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=$L.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===$L.gauge||t.type===$L.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===$L.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class eX extends wj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="gauge",this.seriesType=$L.gaugePointer}}eX.type="gauge",eX.seriesType=$L.gaugePointer,eX.transformerConstructor=tX;class iX extends Ej{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class sX extends wj{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}sX.transformerConstructor=iX;class nX extends sX{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}nX.type="wordCloud",nX.seriesType=$L.wordCloud,nX.transformerConstructor=iX;class rX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class aX extends wj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="funnel",this.seriesType=$L.funnel}}aX.type="funnel",aX.seriesType=$L.funnel,aX.transformerConstructor=rX;class oX extends Bj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=cz(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=cz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class lX extends wj{constructor(){super(...arguments),this.transformerConstructor=oX,this.type="linearProgress",this.seriesType=$L.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}lX.type="linearProgress",lX.seriesType=$L.linearProgress,lX.transformerConstructor=oX,G(lX,Oj);class hX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),SI(t)}}class cX extends wj{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="rangeColumn",this.seriesType=$L.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}cX.type="rangeColumn",cX.seriesType=$L.rangeColumn,cX.transformerConstructor=hX;class dX extends Ej{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class uX extends wj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="sunburst",this.seriesType=$L.sunburst}}uX.type="sunburst",uX.seriesType=$L.sunburst,uX.transformerConstructor=dX;class pX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gX extends wj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="circlePacking",this.seriesType=$L.circlePacking}}gX.type="circlePacking",gX.seriesType=$L.circlePacking,gX.transformerConstructor=pX;class fX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class mX extends wj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="treemap",this.seriesType=$L.treemap}}mX.type="treemap",mX.seriesType=$L.treemap,mX.transformerConstructor=fX;class vX extends FH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),SI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class _X extends zH{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="waterfall",this.seriesType=$L.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}_X.type="waterfall",_X.seriesType=$L.waterfall,_X.transformerConstructor=vX;class yX extends Bj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),SI(t)}}class bX extends wj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="boxPlot",this.seriesType=$L.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}bX.type="boxPlot",bX.seriesType=$L.boxPlot,bX.transformerConstructor=yX;class xX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class SX extends wj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="sankey",this.seriesType=$L.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=HO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}SX.type="sankey",SX.seriesType=$L.sankey,SX.transformerConstructor=xX;class AX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),SI(t)}}class kX extends wj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rangeArea",this.seriesType=$L.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}kX.type="rangeArea",kX.seriesType=$L.rangeArea,kX.transformerConstructor=AX;class MX extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class TX extends wj{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="heatmap",this.seriesType=$L.heatmap}}TX.type="heatmap",TX.seriesType=$L.heatmap,TX.transformerConstructor=MX;class wX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CX extends wj{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="correlation",this.seriesType=$L.correlation}}CX.type="correlation",CX.seriesType=$L.correlation,CX.transformerConstructor=wX;function EX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=zO(t.style)),P(t.textStyle)||wR(s.textStyle,zO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&zO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&zO(s.background.style),s}const BX=(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},PX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:sO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class LX extends Lz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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=dR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new eD(this._option,e),this._initSelectedData(),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(VL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(wR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}LX.specKey="legends";class RX extends LX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){JO(this._option.dataSet,"discreteLegendFilter",PX),JO(this._option.dataSet,"discreteLegendDataMake",BX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return VL(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(!Ky(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=MO(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:f,regionIndex:m,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=EX(s):b.title={visible:!1},P(n.focusIconStyle)||zO(n.focusIconStyle),n.shape&&(n.shape=IO(n.shape)),n.label&&(n.label=IO(n.label)),n.value&&(n.value=IO(n.value)),n.background&&(n.background=IO(n.background)),uR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),uR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),uR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||zO(r.railStyle),P(r.sliderStyle)||zO(r.sliderStyle)):(P(r.textStyle)||zO(r.textStyle),r.handler&&IO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(wR(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 KP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(NP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(NP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=FD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=FD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}RX.specKey="legends",RX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},RX.type=r.discreteLegend;const OX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},IX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?OO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const DX={color:tL,size:iL},FX={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}},zX=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({},FX),{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"}}}})},jX={horizontal:zX(!0),vertical:zX(!1)},HX=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({},FX),{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"}}}})},VX={horizontal:HX(!0),vertical:HX(!1)},NX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UX=[2,10];class WX extends LX{static getSpecInfo(t){const e=zD(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(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){JO(this._option.dataSet,"continuousLegendFilter",IX),JO(this._option.dataSet,"continuousLegendDataMake",OX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NL(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=MO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Ky(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MO(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()),P(a)&&(a="color"===this._legendType?NX:UX);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=wR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=EX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=zO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=zO(r.style)),P(a.style)||(w.trackStyle=zO(a.style)),w.startText=IO(o),w.endText=IO(l),w.handlerText=IO(h),P(c)||(w.sizeBackground=zO(c)),d.visible&&!P(d.style)&&(wR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return DX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}WX.specKey="legends",WX.builtInTheme={colorLegend:jX,sizeLegend:VX},WX.type=r.continuousLegend;const GX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,YX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),$X=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function XX(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=KX(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=>YX(i,s)(t)&&YX(n,r)(t)&&(u(a)||YX([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: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:YO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.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:YO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.hideTooltip(l.id),c}return"none"}const KX=(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=GX(c,t);let _=GX(d,t);const y=$X(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(YX(c,v));if(!y&&(_=GX(d,i),!$X(_)))return;const n=e.type===$L.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=jC(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(YX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=GX(d,o),!$X(_))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(YX(c,n));if(!y&&(_=GX(d,r),!$X(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===$L.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(YX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=GX(d,i),!$X(_))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},qX=t=>p(t)&&!y(t),ZX=t=>p(t)&&y(t);class JX extends Pz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=wR({},this._theme,r.style),r.offset=wR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Gy(this._option.mode)||!Uy(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=b_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Ny?void 0:Ny.body)}}const QX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class tK extends Lz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=JX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&qX(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&&LD.globalConfig.uniqueTooltip&&l&&LD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:YO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:YO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?iH.canvas:iH.dom,n=CR.getComponentPluginInType(t);n||jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=CR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Wy(s)||Gy(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=XX(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(ZX(t)){if(qX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>IF(t,e[i])))}if(ZX(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}}tK.type=r.tooltip,tK.transformerConstructor=JX,tK.builtInTheme={tooltip:QX},tK.specKey="tooltip";var eK,iK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eK||(eK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iK||(iK={}));const sK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nK extends Lz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{jC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:$O.chart}:{source:YO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Wy(e)||Gy(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(t.ChartEvent.tooltipHide,{source:YO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:YO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:YO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{sK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}nK.specKey="crosshair";const rK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class aK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=TF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){TF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:wF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"cartesian");e&&($j(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=qj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new rT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new aT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:rK},aK.type=r.cartesianCrosshair;class oK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=hz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=FD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new rT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new lT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new hT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new oT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}oK.specKey="crosshair",oK.builtInTheme={crosshair:rK},oK.type=r.polarCrosshair;const lK=(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},hK=(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)},cK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class dK extends Lz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=EF(t),this._isHorizontal="horizontal"===BF(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=>!FC(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(FC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};VL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,FC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;FC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else VL(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:n}=this._option;QO(n,"dataview",Aa),JO(n,"dataFilterComputeDomain",cK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new eD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(FC(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&&FC(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,FC(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=FC(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 aE,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||(JO(this._option.dataSet,"dataFilterWithNewDomain",hK),JO(this._option.dataSet,"lockStatisticsFilter",lK),VL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(FC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&jC(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,jC(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]}clear(){this._throttledHide=null}}G(dK,hV);class uK extends Pz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=wR({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}}}const pK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),gK={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:pK(!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:pK(!0)};class fK extends dK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=uK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new wE;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(!FC(t.type)||e[0]!==$(e))&&(!jC(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 UB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:zO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:zO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:zO(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:zO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:zO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:zO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:zO(g.style)},selectedBackgroundStyle:zO(this._spec.selectedBackground.style),dragMaskStyle:zO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:wR(zO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:wR(zO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(d=m.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}=FD(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()}}fK.type=r.dataZoom,fK.transformerConstructor=uK,fK.builtInTheme={dataZoom:gK},fK.specKey="dataZoom";const mK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class vK extends dK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 cM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=LL(this._start,e)&&LL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=zO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=zO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}vK.type=r.scrollBar,vK.builtInTheme={scrollBar:mK},vK.specKey="scrollBar";const _K=(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},yK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),bK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:yK("l1FontSize","primaryFontColor")},content:{visible:!0,style:yK("l2FontSize","tertiaryFontColor")}};class xK extends Lz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return zD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){JO(this._option.dataSet,"indicatorFilter",_K);const t=new wa(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 eD(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=wR({},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({},FO(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?yR(l,this._computeLayoutRadius()):0,dy:h?yR(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({},FO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}xK.type=r.indicator,xK.builtInTheme={indicator:bK},xK.specKey="indicator";const SK=["sum","average","min","max","variance","standardDeviation","median"];function AK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&AK(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=uR(t.x)?CK(t.x,n)+r.x:EK(l.getXAxisHelper(),[t.x])+r.x,h}function MK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&AK(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=uR(t.y)?CK(t.y,n)+r.y:EK(l.getYAxisHelper(),[t.y])+r.y,h}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&AK(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)),EK(a.angleAxisHelper,[t.angle])}function wK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&AK(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)),EK(a.radiusAxisHelper,[t.radius])}function CK(t,e){return Number(t.substring(0,t.length-1))*e/100}function EK(t,e){const i=t.getScale(0);return FC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function BK(t){return SK.includes(t)}function PK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=kK(t,_,n,u,c,o),r=MK(t,y,n,u,d,o),LK(s,b,S,g.length),LK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=kK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);LK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=MK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);LK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function LK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=TK(t,l,n,r),i=wK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=TK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=wK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function OK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=uR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=uR(i)?Number(i.substring(0,i.length-1))*f/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])&&AK(_,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])&&AK(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:EK(d.getXAxisHelper(),b)+p.x+m,y:EK(d.getYAxisHelper(),x)+p.y+v})})),n}function IK(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])&&AK(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])&&AK(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:EK(l.angleAxisHelper,d),radius:EK(l.radiusAxisHelper,u)})})),s}function DK(t,e,i){let{x:s,y:n}=t;return uR(s)&&(s=CK(s,e)),uR(n)&&(n=CK(n,i)),{x:s,y:n}}function FK(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}=DK(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=>DK(t,n,r)))}function zK(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 jK(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},zO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},VK(zO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=VK(zO(r),i,s)),t}return{visible:!1}}function HK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function VK(t,e,i){return d(t)?t(e,i):t}function NK(t,e){return d(t)?t(e):t}function UK(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 WK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=WK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function YK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=WK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function $K(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function XK(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])&&BK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&BK(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])&&BK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&BK(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=>qK(i,t,e))):i.x=qK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>qK(i,t,e))):i.y=qK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>qK(i,t,e))):i.angle=qK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>qK(i,t,e))):i.radius=qK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=qK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const KK={min:(t,e)=>RL(t[0].latestData,e.field),max:(t,e)=>OL(t[0].latestData,e.field),sum:function(t,e){return IL(t[0].latestData,e.field)},average:function(t,e){return DL(t[0].latestData,e.field)},variance:function(t,e){return FL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(FL(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 qK(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(m(t)){const{aggrType:i,field:s}=t;return KK[i](e,{field:s})}return t}function ZK(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 JK extends Lz{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 zD(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)&&BK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=UL(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){u(this._spec.offsetX)||(this._layoutOffsetX=gR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=gR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerFilter",ZK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function QK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=RL(t,e),r=OL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class tq extends JK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=GK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:VK(zO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{line:HK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return HK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return HK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:VK(zO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:VK(zO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=zK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=GK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerRegression",QK),JO(this._option.dataSet,"markerFilter",ZK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}tq.specKey="markLine";const eq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},sq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eq(!1),endSymbol:eq(!0),label:iq};class nq extends tq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new CP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=GK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=PK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=OK(i,r,d,e.coordinatesOffset):c&&(y=FK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(uR(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:u}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&p(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=Y(n.label),_=Y(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:u,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=GK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}nq.type=r.markLine,nq.coordinateType="cartesian",nq.builtInTheme={markLine:sq};class rq extends tq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=GK(this._spec);return e||i?new PP(t):new CP(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}=GK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=IK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=GK(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}}}rq.type=r.polarMarkLine,rq.coordinateType="polar",rq.builtInTheme={polarMarkLine:sq};class aq extends Lz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=dR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return zD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=gR(this._spec.width,l.width,null,l.width),c=gR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new sL(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}}aq.type=r.title,aq.specKey=r.title,aq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class oq extends JK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=YK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:VK(zO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{area:HK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>HK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return HK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=zK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=YK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}oq.specKey="markArea";const lq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class hq extends oq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new BP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=YK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=OK(s,a,u,i.coordinatesOffset):d&&(f=FK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=YK(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}}}hq.type=r.markArea,hq.coordinateType="cartesian",hq.builtInTheme={markArea:lq};class cq extends oq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=YK(this._spec);return i||e||s?new LP(t):new BP(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}=YK(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=RK(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=IK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=YK(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}}}cq.type=r.polarMarkArea,cq.coordinateType="polar",cq.builtInTheme={polarMarkArea:lq};const dq=t=>zO(Object.assign({},t)),uq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},zO(t.style))}),pq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=dq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=dq(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:{},zO(Object.assign({},y)));var y;const b=uq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=uq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=uq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=uq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},gq=t=>"left"===t||"right"===t,fq=t=>"top"===t||"bottom"===t,mq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class vq extends Lz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},pq(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({},pq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new yL(t):this._playerComponent=new SL(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=gq(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=gq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(pL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(pL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(pL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=gq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=fq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):gq(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))):fq(this._orient)?this._maxSize():t.height}_computeDx(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return fq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}vq.builtInTheme={player:mq},vq.specKey="player",vq.type=r.player;class _q extends Lz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=eR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==EI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}_q.type=r.label;class yq extends dN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}yq.type="text",yq.constructorType="label";const bq=()=>{uN(),CR.registerMark(yq.constructorType,yq)};class xq extends Pz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sq extends _q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=xq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(UO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(UO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),VL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=wR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},PV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[fO])):t=>t.filter((t=>t.data[gO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?LV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Sq.type=r.label,Sq.specKey="label",Sq.transformerConstructor=xq;class Aq extends _q{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[uO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return wR({textStyle:{pickable:!0===this._spec.interactive},position:kq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[fO]:t.data[gO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>LV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function kq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Aq.type=r.totalLabel,Aq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Aq.specKey="totalLabel";class Mq extends JK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=$K(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=jK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=VK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=zO(VK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=VK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=VK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:NK(R.offsetX,this._relativeSeries.getRegion()),offsetY:NK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:VK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:VK(I.style,this._markerData,this._markAttributeContext)},state:{line:HK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:HK(J,this._markerData,this._markAttributeContext),textBackground:HK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:HK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:zO(st.style)}):{visible:!1};return new OP(et)}_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}=zK([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:UK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:UK(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}=$K(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Mq.specKey="markPoint";const Tq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class wq extends Mq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=PK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=OK(n,r,h,s.coordinatesOffset)[0]:l&&(c=FK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=$K(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}}}wq.type=r.markPoint,wq.coordinateType="cartesian",wq.builtInTheme={markPoint:Tq};class Cq extends Mq{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=RK(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:he({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}])]}}}Cq.type=r.polarMarkPoint,Cq.coordinateType="polar",Cq.builtInTheme={polarMarkPoint:Tq};class Eq extends Mq{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}])]}}}Eq.type=r.geoMarkPoint,Eq.coordinateType="geo",Eq.builtInTheme={geoMarkPoint:Tq};const Bq="inBrush",Pq="outOfBrush";class Lq extends Lz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Bq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Pq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new TL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:zO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(bL.brushActive,(s=>{this._initMarkBrushState(i,Pq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(bL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(bL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(bL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},zO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Bq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Bq),i.addState(Pq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Bq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Bq),i.addState(Pq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Bq),s.removeState(Pq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Lq.type=r.brush,Lq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Lq.specKey="brush";class Rq extends Lz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${ZR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=pF({},gF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Rq.type=r.customMark,Rq.specKey="customMark";class Oq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Iq(t))),a=n.filter((t=>!Iq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Iq(t))),h=o.filter((t=>!Iq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Iq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Oq.type="grid";const Dq="vchart-tooltip",Fq=`${Dq}-container`,zq=`${Dq}-title`,jq=`${Dq}-content-box`,Hq={offsetX:10,offsetY:10},Vq="99999999999999";function Nq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Uq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Wq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Nq(t):"",Gq=(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},Yq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},$q=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Yq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class Xq extends az{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=ND(null==T?void 0:T.position,b,e),C=null!==(r=ND(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:JR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:QR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Uq(e,F),V=Uq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch($q(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Gq(t,_),W.top=Gq(i,_),W.right=Gq(e,_),W.bottom=Gq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Gq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=$q(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",qq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Kq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Kq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},Zq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?gR(e,t.fontSize):0},Jq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Kq(o)),{panelStyle:a,panelPadding:o}};function Qq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class tZ extends Xq{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(tZ.type),this.type=iH.dom,this._tooltipContainer=null==Ny?void 0:Ny.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Ny&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Jq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Kq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=qq(h),x=qq(d),S=qq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Kq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Kq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Kq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(Zq(p),Zq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(zq))),l=a.find((t=>t.className.includes(jq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(zq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Qq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Dq}-column`),e.classList.add(`${Dq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(jq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Qq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Qq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Dq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Wq(e.key),e.keyStyle&&qq(e.keyStyle,l)):"value"===i?(o.innerHTML=Wq(e.value),e.valueStyle&&qq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Nq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Nq(c):m,y=p,b=t=>new Ag({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=dh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Nq(u):"currentColor",`\n \n \n \n `;const w=T?dh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Qq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(jq))),h=[...o.children].find((t=>t.className.includes(zq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(zq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=gR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Qq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},cf||(cf=lf.CreateGraphic("richtext",{})),cf.setAttributes(a),cf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function sZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nZ=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 rZ extends Xq{constructor(){super(rZ.type),this.type=iH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=vR(d.padding),x=sZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=sZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=sZ(m,i),k={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},M={panel:nZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=wR({},S,sZ(b,void 0,{})),{width:s,height:n,text:r}=iZ(h,i);T.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(m)){const t=wR({},A,sZ(x,void 0,{})),{width:e,height:s,text:n}=iZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=wR({},x,sZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=iZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}rZ.type=iH.canvas;const aZ=/\{([^}]+)\}/,oZ=/\{([^}]+)\}/g,lZ=/:/;class hZ extends az{constructor(){super(hZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[hZ.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)),CR.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=aZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(oZ,((t,i)=>{if(!lZ.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(bi.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}}hZ.pluginType="chart",hZ.specKey="formatter",hZ.type="formatterPlugin";LD.useRegisters([()=>{oH(),hH(),dH(),zj(),Fj(),Sj(),pj(),KF(),ZF(),xD(),_D(),aj(),ij(),CR.registerSeries(Aj.type,Aj),CR.registerChart(uH.type,uH)},()=>{oH(),hH(),dH(),Fj(),Sj(),pj(),KF(),fH(),ZF(),_H(),aj(),ij(),CR.registerSeries(bH.type,bH),zj(),CR.registerChart(SH.type,SH)},()=>{oH(),hH(),dH(),Fj(),DH(),zj(),CR.registerChart(zH.type,zH)},()=>{oH(),hH(),zj(),Fj(),XH(),CR.registerChart(qH.type,qH)},()=>{hH(),YN(),CR.registerChart(H$.type,H$)},()=>{oH(),hH(),zj(),Fj(),dU(),CR.registerChart(U$.type,U$)},()=>{oH(),hH(),dH(),zj(),Fj(),bU(),CR.registerChart(G$.type,G$)},()=>{oH(),hH(),dH(),zj(),Fj(),DH(),CR.registerChart(Z$.type,Z$)},()=>{hH(),uV(),iV(),CR.registerSeries(gV.type,gV),CR.registerImplement("registerMap",sI),CR.registerImplement("unregisterMap",nI),yD(),CR.registerChart(O$.type,O$)},()=>{hH(),JY(),CR.registerSeries(t$.type,t$),HN(),IU(),oU(),zU(),CR.registerChart(eX.type,eX)},()=>{hH(),MG(),CR.registerChart(nX.type,nX)},()=>{hH(),GG(),CR.registerChart(aX.type,aX)},()=>{oH(),hH(),dH(),zj(),Fj(),UV(),CR.registerChart(_X.type,_X)},()=>{oH(),hH(),zj(),Fj(),cN(),CR.registerChart(bX.type,bX)},()=>{oH(),hH(),zj(),Fj(),zU(),CR.registerChart(Q$.type,Q$)},()=>{oH(),hH(),zj(),Fj(),YU(),CR.registerChart(lX.type,lX)},()=>{oH(),hH(),zj(),Fj(),xN(),CR.registerChart(cX.type,cX)},()=>{oH(),hH(),dH(),zj(),Fj(),fH(),aj(),ij(),CR.registerSeries(TN.type,TN),CR.registerChart(kX.type,kX)},()=>{hH(),hY(),CR.registerChart(uX.type,uX)},()=>{hH(),fY(),CR.registerChart(gX.type,gX)},()=>{hH(),NY(),CR.registerChart(mX.type,mX)},()=>{hH(),Bh.load(gM),OY(),CR.registerChart(SX.type,SX)},()=>{hH(),o$(),CR.registerChart(TX.type,TX)},()=>{hH(),b$(),CR.registerChart(CX.type,CX)},()=>{oH(),hH(),dH(),zj(),CR.registerChart($$.type,$$),Fj()},ij,aj,()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(oj.type,oj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(lj.type,lj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(hj.type,hj)},hU,oU,()=>{CR.registerComponent(RX.type,RX)},()=>{CR.registerComponent(WX.type,WX)},()=>{CR.registerComponent(tK.type,tK)},()=>{CR.registerComponent(aK.type,aK)},()=>{CR.registerComponent(oK.type,oK)},()=>{CR.registerComponent(fK.type,fK)},()=>{CR.registerComponent(vK.type,vK)},()=>{CR.registerComponent(xK.type,xK)},uV,()=>{CR.registerComponent(nq.type,nq),wP()},()=>{CR.registerComponent(hq.type,hq),EP()},()=>{CR.registerComponent(wq.type,wq),RP()},()=>{CR.registerComponent(rq.type,rq),PP._animate=lP,wP()},()=>{CR.registerComponent(cq.type,cq),LP._animate=cP,EP()},()=>{CR.registerComponent(Cq.type,Cq),RP()},()=>{CR.registerComponent(Eq.type,Eq),RP()},()=>{CR.registerComponent(aq.type,aq)},()=>{CR.registerComponent(vq.type,vq)},()=>{CR.registerGraphicComponent(Sq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Sq.type,Sq,!0,1/0)},()=>{CR.registerGraphicComponent(Aq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Aq.type,Aq,!0)},()=>{CR.registerComponent(Lq.type,Lq)},()=>{CR.registerComponent(Rq.type,Rq)},()=>{Bh.load(sT)},()=>{CR.registerLayout(Oq.type,Oq)},()=>{var t;t=rZ,CR.registerComponentPlugin(t.type,t)},()=>{var t;t=hZ,CR.registerChartPlugin(t.type,t)},wD,BD]),LD.useRegisters([()=>{NS(Bh)}]),t.DEFAULT_CHART_HEIGHT=QR,t.DEFAULT_CHART_WIDTH=JR,t.DEFAULT_CLOSE_STROKE_JOIN=ID,t.DEFAULT_DATA_INDEX=eO,t.DEFAULT_DATA_KEY=iO,t.DEFAULT_DATA_SERIES_FIELD=sO,t.DEFAULT_KEY=SO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=OD,t.DEFAULT_MEASURE_CANVAS_ID=tO,t.DEFAULT_SERIES_STYLE_NAME=nO,t.DEFAULT_SMOOTH_INTERPOLATE=RD,t.Factory=CR,t.MOSAIC_CAT_END_PERCENT=yO,t.MOSAIC_CAT_START_PERCENT=_O,t.MOSAIC_VALUE_END_PERCENT=vO,t.MOSAIC_VALUE_START_PERCENT=mO,t.ManualTicker=class extends aw{constructor(t){super(t),this.lastFrameTime=0,this.status=wo.RUNNING}setupTickHandler(){const t=new ow;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,!0}},t.PREFIX=ZR,t.SEGMENT_FIELD_END=xO,t.SEGMENT_FIELD_START=bO,t.STACK_FIELD_END=oO,t.STACK_FIELD_END_OffsetSilhouette=dO,t.STACK_FIELD_END_PERCENT=hO,t.STACK_FIELD_KEY=rO,t.STACK_FIELD_START=aO,t.STACK_FIELD_START_OffsetSilhouette=cO,t.STACK_FIELD_START_PERCENT=lO,t.STACK_FIELD_TOTAL=uO,t.STACK_FIELD_TOTAL_BOTTOM=fO,t.STACK_FIELD_TOTAL_PERCENT=pO,t.STACK_FIELD_TOTAL_TOP=gO,t.StreamLight=class extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=vo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new zl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=vo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=nl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=nl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?hG(t,o,l.width,l.height,h):"geometric"===t.type&&uG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=ZW(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()}};pG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class gG extends eG{constructor(t){super(j({},gG.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)}gG.defaultOptions={enlarge:!1};const mG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},vG=(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?_G(t.fontFamily):"sans-serif",d=t.fontStyle?_G(t.fontStyle):"normal",u=t.fontWeight?_G(t.fontWeight):"normal",p=t.rotate?_G(t.rotate):0,g=_G(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?_G(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},mG),t.as):mG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?_G(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=bG(xG(t,l),C);w=i=>e(t(i))}let E=sG;"fast"===t.layoutType?E=gG:"grid"===t.layoutType&&(E=pG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},_G=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],yG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),bG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=yG(t[0]),n=yG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(yG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},xG=(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 SG(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{wR.registerGrammarTransform("wordcloud",{transform:vG}),dN(),wR.registerAnimation("wordCloud",((t,e)=>({appear:eW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),wR.registerSeries(AG.type,AG)},MG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},TG=(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},wG=`${qR}_FUNNEL_TRANSFORM_RATIO`,CG=`${qR}_FUNNEL_REACH_RATIO`,EG=`${qR}_FUNNEL_HEIGHT_RATIO`,BG=`${qR}_FUNNEL_VALUE_RATIO`,PG=`${qR}_FUNNEL_LAST_VALUE_RATIO`,LG=`${qR}_FUNNEL_NEXT_VALUE_RATIO`,RG=`${qR}_FUNNEL_LAST_VALUE`,OG=`${qR}_FUNNEL_CURRENT_VALUE`,IG=`${qR}_FUNNEL_NEXT_VALUE`,DG=`${qR}_FUNNEL_TRANSFORM_LEVEL`;class FG extends YD{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[CG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class zG extends rD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class jG extends zG{constructor(){super(...arguments),this.type=jG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}jG.type="polygon";const HG=()=>{wR.registerMark(jG.type,jG),Xk(),Nk(),lw.registerBuiltInAnimate("growPointsOut",rC),wR.registerGraphicComponent("polygon",af)},VG=Object.assign(Object.assign({},nF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class NG extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class UG extends xF{constructor(){super(...arguments),this.type=YL.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=NG,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;ZO(this._dataSet,"funnel",MG),ZO(this._dataSet,"funnelTransform",TG);const t=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new tD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:OG,asTransformRatio:wG,asReachRatio:CG,asHeightRatio:EG,asValueRatio:BG,asNextValueRatio:LG,asLastValueRatio:PG,asLastValue:RG,asNextValue:IG,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:DG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},UG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:mF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},UG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(UG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(UG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new FG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Iy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*UL(CG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),pF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("fadeInOut")(),pF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("funnel")({},o),pF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uF(null===(a=wR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pF("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[PG])/2:this._getSecondaryAxisLength(t[BG])/2,n=this._getSecondaryAxisLength(t[BG])/2):(s=this._getSecondaryAxisLength(t[BG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LG])/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[DG])}_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[eO]===t[eO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{HG(),dN(),AV(),wR.registerSeries(UG.type,UG),wR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},mD))),wR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),_D()},GG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},YG=t=>{const e=t.filter((t=>t.context.diffState===CI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},$G=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},XG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),KG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},qG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),ZG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},JG=(t,e={})=>{if(!t)return[];const i=[];return rW(t,i,e),i},QG=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LW(i).layout(t,{width:s,height:n})};class tY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var eY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(eY||(eY={}));const iY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===eY.DrillDown){return Y(PO(t,n,s,"children"))}if(i.type===eY.DrillUp){const e=LO(t,n,s,"children");if(e)return Y(e)}return t};class sY{_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;ZO(t,"drillFilter",iY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:eY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:eY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:eY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:eY.DrillUp},model:this}),r}}const nY=Object.assign(Object.assign({},nF),{sunburst:{name:"sunburst",type:"arc"}}),rY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ZD,operations:["max","min","values"]}),t.push({key:JD,operations:["values"]}),t),aY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class oY extends TN{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),ZO(this._dataSet,"sunburstLayout",QG),ZO(this._dataSet,"flatten",JG),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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(oY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(oY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new tY(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(uF(null===(e=wR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}oY.type=YL.sunburst,oY.mark=nY,oY.builtInTheme={sunburst:aY},G(oY,sY);const lY=()=>{wR.registerSeries(oY.type,oY),jN(),dN(),_D(),wR.registerAnimation("sunburst",((t,e)=>({appear:ZG(0,e),enter:XG(t),exit:qG(t),disappear:qG(t)})))},hY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new xW(i).layout(t,{width:s,height:n})};class cY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const dY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},uY=Object.assign(Object.assign({},nF),{circlePacking:{name:"circlePacking",type:"arc"}});class pY extends kF{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},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),ZO(this._dataSet,"circlePackingLayout",hY),ZO(this._dataSet,"flatten",JG),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)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return rY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new cY(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(uF(null===(i=wR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}pY.type=YL.circlePacking,pY.mark=uY,pY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(pY,sY);const gY=()=>{wR.registerSeries(pY.type,pY),jN(),dN(),vD(),wR.registerAnimation("circlePacking",((t,e)=>({appear:dY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},fY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&fY(t,e.children,i)}))},mY=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},vY=(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 EW(e),r=[];return r.push(n.layout(s,i)),r},_Y=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:[]},yY=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 bY extends YD{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 xY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),SY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:xY(t),AY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class kY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class MY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const TY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},wY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class CY extends $V{constructor(){super(...arguments),this.type=CY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?wY:TY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}CY.type="linkPath";const EY=Object.assign(Object.assign({},nF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class BY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const PY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class LY extends kF{constructor(){super(...arguments),this.type=YL.sankey,this.transformerConstructor=BY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=jO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=jO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=jO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),PY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=jO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=jO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=jO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=jO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=jO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(jO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=jO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=jO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){ZO(this._dataSet,"sankeyLayout",vY),ZO(this._dataSet,"sankeyFormat",mY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;ZO(o,"sankeyNodes",_Y),ZO(o,"flatten",JG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._nodesSeriesData=l,ZO(o,"sankeyLinks",yY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(LY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(LY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=DD(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(uF(null===(i=wR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),pF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),pF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:YO.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(jO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new bY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new rR;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 fY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}LY.type=YL.sankey,LY.transformerConstructor=BY,LY.mark=EY,LY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const RY=()=>{EH(),XV(),Hk(),wR.registerGraphicComponent("path",(t=>qg(t))),wR.registerMark(CY.type,CY),dN(),wR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:SY(t,e)},mD))),wR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:AY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lw.registerBuiltInAnimate("linkPathGrowOut",MY),lw.registerBuiltInAnimate("linkPathGrowIn",kY),_D(),wR.registerSeries(LY.type,LY)},OY=(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=JG(n);return i=XD([{latestData:r}],e),i};class IY extends YD{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 DY=Object.assign(Object.assign({},nF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class zY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const jY=(t,e)=>{if(e.getViewBox()){const i=new DW(e).layout(t,e.getViewBox()),s=[];return rW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[JD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class HY extends kF{constructor(){super(...arguments),this.type=YL.treemap,this.transformerConstructor=zY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:JD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:eO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),ZO(this._dataSet,"treemap",jY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=OY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){ZO(this._dataSet,"hierarchyDimensionStatistics",OY),ZO(this._dataSet,"flatten",JG);const i=new wa(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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(HY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(HY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pF(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 IY(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(NO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(NO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=YL.treemap,HY.mark=DY,HY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},HY.transformerConstructor=zY,G(HY,sY),G(HY,lV);const VY=()=>{wR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),wR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),EH(),dN(),wR.registerAnimation("treemap",((t,e)=>({appear:FY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),_D(),wR.registerSeries(HY.type,HY)},NY=Object.assign(Object.assign({},EU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),UY=Object.assign(Object.assign({},nF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),WY={type:"fadeIn"};function GY(t,e){return"fadeIn"===e?WY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class YY extends bF{constructor(){super(...arguments),this._supportStack=!1}}class $Y extends YD{enableByType(t){return"dimension"!==t}}const XY="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",KY={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:XY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:XY,fill:"#ddd"}}};class qY extends BU{constructor(){super(...arguments),this.type=YL.gaugePointer,this.transformerConstructor=YY,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(qY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},qY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(qY.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 $Y(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}qY.type=YL.gaugePointer,qY.mark=UY,qY.builtInTheme={gaugePointer:KY},qY.transformerConstructor=YY;const ZY=()=>{wR.registerSeries(qY.type,qY),eV(),EH(),wR.registerAnimation("gaugePointer",((t,e)=>{const i=GY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),lU(),aU()};class JY extends bF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class QY extends BU{constructor(){super(...arguments),this.type=YL.gauge,this.transformerConstructor=JY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();ZO(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[bO]=t[this._angleField[0]],t[yO]=e>0?i[e-1][bO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(QY.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(QY.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[yO])?this.angleAxisHelper.dataToPosition([t[yO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[bO]])}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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}QY.type=YL.gauge,QY.mark=NY,QY.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},QY.transformerConstructor=JY;class t$ extends rD{constructor(){super(...arguments),this.type=t$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Mg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}t$.type="cell";function e$(t){return!1===t?{}:{type:"fadeIn"}}class i$ extends YD{enableByType(t){return"dimension"!==t}}const s$=Object.assign(Object.assign({},nF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class n$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class r$ extends kF{constructor(){super(...arguments),this.type=YL.heatmap,this.transformerConstructor=n$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(r$.mark.cell,{isSeriesMark:!0},{morph:mF(this._spec,r$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(r$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=AF(this);this._cellMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pF("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 i$(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]}}r$.type=YL.heatmap,r$.mark=s$,r$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},r$.transformerConstructor=n$;const a$=()=>{dN(),wR.registerMark(t$.type,t$),wR.registerGraphicComponent("symbol",Mg),Xk(),qk(),yB(),wR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},mD),{appear:e$(e)}))),rj(),ej(),wR.registerSeries(r$.type,r$)},o$=Object.assign(Object.assign({},nF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),l$=`${qR}_CORRELATION_X`,h$=`${qR}_CORRELATION_Y`,c$=`${qR}_CORRELATION_SIZE`,d$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=u$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),p$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},p$=(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,[tO]:null==n?void 0:n[tO],[iO]:null==n?void 0:n[iO]}};class f$ extends $V{constructor(){super(...arguments),this.type=f$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}f$.type="ripple";const m$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class v$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class _$ extends TN{constructor(){super(...arguments),this.type=YL.correlation,this.transformerConstructor=v$,this._viewBox=new He}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;ZO(this._dataSet,"correlation",d$);const s=new Ta;JO(s,"dataview",Aa),ZO(s,"correlationCenter",g$);const n=new wa(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 tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(_$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:tO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(_$.mark.ripplePoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(_$.mark.centerPoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[l$],y:t=>t[h$],size:t=>t[c$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}_$.type=YL.correlation,_$.mark=o$,_$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},_$.transformerConstructor=v$;const y$=()=>{qF(),XV(),qk(),wR.registerMark(f$.type,f$),wR.registerGraphicComponent("symbol",(t=>Mg(t))),wR.registerSeries(_$.type,_$),wR.registerAnimation("correlation",((t,e)=>Object.assign({appear:m$(0,e)},fD)))},b$=Object.assign(Object.assign({},nF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class x$ extends $V{constructor(){super(...arguments),this.type=x$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}x$.type="liquid";const S$=(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 A$ extends YD{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 k$ extends xF{constructor(){super(...arguments),this.type=YL.liquid,this.transformerConstructor=ZF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Lg({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=Mg({x:s,y:n,size:r,symbolType:S$(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=mR(this._spec.outlineMargin),this._paddingSpec=mR(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=Gt(...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(k$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(k$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(k$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(k$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new A$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),pF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),pF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=bM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}k$.type=YL.liquid,k$.mark=b$,k$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},k$.transformerConstructor=ZF;const M$=t=>Y(t).join(",");class T$ extends YD{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const w$=Object.assign(Object.assign({},nF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class C$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const E$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?XW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class B$ extends xF{constructor(){super(...arguments),this.type=YL.venn,this.transformerConstructor=C$,this._viewBox=new He}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:eO)}initData(){var t;super.initData(),ZO(this._dataSet,"venn",E$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(B$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(B$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new T$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:M$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return M$(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[M$(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(M$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}}B$.type=YL.venn,B$.mark=w$,B$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},B$.transformerConstructor=C$;class P$ extends OH{constructor(){super(...arguments),this.type=YL.mosaic,this.transformerConstructor=RH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(mO),this.setFieldX2(fO)),this.setFieldY(_O),this.setFieldY2(vO)):(t&&(this.setFieldY(mO),this.setFieldY2(fO)),this.setFieldX(_O),this.setFieldX2(vO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}P$.type=YL.mosaic,P$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},P$.transformerConstructor=RH;class L$ extends Cj{_isValidSeries(t){return t===YL.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class R$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="map",this.seriesType=YL.map}}R$.type="map",R$.seriesType=YL.map,R$.transformerConstructor=L$;class O$ extends Cj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 I$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=hz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,TR({},s,l)),n&&Object.assign(o,TR({},n,o))}}class D$ extends O${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class F$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class z$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=F$}}z$.transformerConstructor=F$;class j$ extends z${constructor(){super(...arguments),this.transformerConstructor=F$,this.type="pie",this.seriesType=YL.pie}}j$.type="pie",j$.seriesType=YL.pie,j$.transformerConstructor=F$;class H$ extends D${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Mz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Mz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const V$=(t,e)=>{if(!t)return null;const i=zF(t,(t=>"angle"===t.getOrient()),e),s=zF(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&&zC(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=FL({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=zL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=DF(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&&zC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=zL(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 _=DF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class N$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="rose",this.seriesType=YL.rose}_setModelOption(){this._modelOption.getDimensionInfo=V$}}N$.type="rose",N$.seriesType=YL.rose,N$.transformerConstructor=H$,G(N$,Rj);class U$ extends D${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=TR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class W$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="radar",this.seriesType=YL.radar}_setModelOption(){this._modelOption.getDimensionInfo=V$}}W$.type="radar",W$.seriesType=YL.radar,W$.transformerConstructor=U$,G(W$,Rj);class G$ extends Cj{_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=>{L(e,"trimPadding")&&TR(e,kI(this.type,t))})),this._transformAxisSpec(t)}}class Y$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Uj(t,e,i))&&void 0!==s?s:[],...null!==(n=V$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}Y$.type="common",Y$.transformerConstructor=G$,G(Y$,Rj);class $$ extends Ej{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class X$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=$$}}X$.transformerConstructor=$$,G(X$,Rj);class K$ extends $${transformSpec(t){super.transformSpec(t),xI(t)}}class q$ extends X${constructor(){super(...arguments),this.transformerConstructor=K$,this.type="histogram",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}q$.type="histogram",q$.seriesType=YL.bar,q$.transformerConstructor=K$;class Z$ extends I${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class J$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="circularProgress",this.seriesType=YL.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=V$}}J$.type="circularProgress",J$.seriesType=YL.circularProgress,J$.transformerConstructor=Z$,G(J$,Rj);class Q$ extends I${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=YL.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===YL.gauge||t.type===YL.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===YL.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class tX extends Tj{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="gauge",this.seriesType=YL.gaugePointer}}tX.type="gauge",tX.seriesType=YL.gaugePointer,tX.transformerConstructor=Q$;class eX extends Cj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class iX extends Tj{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}iX.transformerConstructor=eX;class sX extends iX{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}sX.type="wordCloud",sX.seriesType=YL.wordCloud,sX.transformerConstructor=eX;class nX extends Cj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class rX extends Tj{constructor(){super(...arguments),this.transformerConstructor=nX,this.type="funnel",this.seriesType=YL.funnel}}rX.type="funnel",rX.seriesType=YL.funnel,rX.transformerConstructor=nX;class aX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=hz(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=hz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class oX extends Tj{constructor(){super(...arguments),this.transformerConstructor=aX,this.type="linearProgress",this.seriesType=YL.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}oX.type="linearProgress",oX.seriesType=YL.linearProgress,oX.transformerConstructor=aX,G(oX,Rj);class lX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),xI(t)}}class hX extends Tj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rangeColumn",this.seriesType=YL.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}hX.type="rangeColumn",hX.seriesType=YL.rangeColumn,hX.transformerConstructor=lX;class cX extends Cj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dX extends Tj{constructor(){super(...arguments),this.transformerConstructor=cX,this.type="sunburst",this.seriesType=YL.sunburst}}dX.type="sunburst",dX.seriesType=YL.sunburst,dX.transformerConstructor=cX;class uX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class pX extends Tj{constructor(){super(...arguments),this.transformerConstructor=uX,this.type="circlePacking",this.seriesType=YL.circlePacking}}pX.type="circlePacking",pX.seriesType=YL.circlePacking,pX.transformerConstructor=uX;class gX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fX extends Tj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="treemap",this.seriesType=YL.treemap}}fX.type="treemap",fX.seriesType=YL.treemap,fX.transformerConstructor=gX;class mX extends DH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),xI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class vX extends FH{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="waterfall",this.seriesType=YL.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}vX.type="waterfall",vX.seriesType=YL.waterfall,vX.transformerConstructor=mX;class _X extends Ej{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),xI(t)}}class yX extends Tj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="boxPlot",this.seriesType=YL.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}yX.type="boxPlot",yX.seriesType=YL.boxPlot,yX.transformerConstructor=_X;class bX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xX extends Tj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="sankey",this.seriesType=YL.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=jO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}xX.type="sankey",xX.seriesType=YL.sankey,xX.transformerConstructor=bX;class SX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),xI(t)}}class AX extends Tj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeArea",this.seriesType=YL.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}AX.type="rangeArea",AX.seriesType=YL.rangeArea,AX.transformerConstructor=SX;class kX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class MX extends Tj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="heatmap",this.seriesType=YL.heatmap}}MX.type="heatmap",MX.seriesType=YL.heatmap,MX.transformerConstructor=kX;class TX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Tj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="correlation",this.seriesType=YL.correlation}}wX.type="correlation",wX.seriesType=YL.correlation,wX.transformerConstructor=TX;function CX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=FO(t.style)),P(t.textStyle)||TR(s.textStyle,FO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&FO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&FO(s.background.style),s}const EX=(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},BX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:iO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class PX extends Pz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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=cR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new tD(this._option,e),this._initSelectedData(),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(HL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(TR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}PX.specKey="legends";class LX extends PX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZO(this._option.dataSet,"discreteLegendFilter",BX),ZO(this._option.dataSet,"discreteLegendDataMake",EX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HL(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(!Xy(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=kO(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:f,regionIndex:m,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=CX(s):b.title={visible:!1},P(n.focusIconStyle)||FO(n.focusIconStyle),n.shape&&(n.shape=OO(n.shape)),n.label&&(n.label=OO(n.label)),n.value&&(n.value=OO(n.value)),n.background&&(n.background=OO(n.background)),dR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),dR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),dR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||FO(r.railStyle),P(r.sliderStyle)||FO(r.sliderStyle)):(P(r.textStyle)||FO(r.textStyle),r.handler&&OO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(TR(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 XP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(VP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(VP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(VP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=DD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=DD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}LX.specKey="legends",LX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},LX.type=r.discreteLegend;const RX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},OX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?RO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const IX={color:QP,size:eL},DX={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}},FX=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({},DX),{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"}}}})},zX={horizontal:FX(!0),vertical:FX(!1)},jX=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({},DX),{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"}}}})},HX={horizontal:jX(!0),vertical:jX(!1)},VX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],NX=[2,10];class UX extends PX{static getSpecInfo(t){const e=FD(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(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){ZO(this._option.dataSet,"continuousLegendFilter",OX),ZO(this._option.dataSet,"continuousLegendDataMake",RX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>VL(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=kO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=kO(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()),P(a)&&(a="color"===this._legendType?VX:NX);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=TR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=CX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=FO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=FO(r.style)),P(a.style)||(w.trackStyle=FO(a.style)),w.startText=OO(o),w.endText=OO(l),w.handlerText=OO(h),P(c)||(w.sizeBackground=FO(c)),d.visible&&!P(d.style)&&(TR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return IX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}UX.specKey="legends",UX.builtInTheme={colorLegend:zX,sizeLegend:HX},UX.type=r.continuousLegend;const WX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,GX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),YX=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function $X(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=XX(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=>GX(i,s)(t)&&GX(n,r)(t)&&(u(a)||GX([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: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:GO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.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:GO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.hideTooltip(l.id),c}return"none"}const XX=(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=WX(c,t);let _=WX(d,t);const y=YX(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(GX(c,v));if(!y&&(_=WX(d,i),!YX(_)))return;const n=e.type===YL.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=zC(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(GX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=WX(d,o),!YX(_))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(GX(c,n));if(!y&&(_=WX(d,r),!YX(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===YL.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(GX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=WX(d,i),!YX(_))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},KX=t=>p(t)&&!y(t),qX=t=>p(t)&&y(t);class ZX extends Bz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=TR({},this._theme,r.style),r.offset=TR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Wy(this._option.mode)||!Ny(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=b_.getElementById(t.parentElement)):Ny(this._option.mode)&&(t.parentElement=null==Vy?void 0:Vy.body)}}const JX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class QX extends Pz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=ZX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Ny(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&KX(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&&PD.globalConfig.uniqueTooltip&&l&&PD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:GO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:GO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?eH.canvas:eH.dom,n=wR.getComponentPluginInType(t);n||zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=wR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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)||Wy(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=$X(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(qX(t)){if(KX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>OF(t,e[i])))}if(qX(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}}QX.type=r.tooltip,QX.transformerConstructor=ZX,QX.builtInTheme={tooltip:JX},QX.specKey="tooltip";var tK,eK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(tK||(tK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eK||(eK={}));const iK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class sK extends Pz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{zC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:YO.chart}:{source:GO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Uy(e)||Wy(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(t.ChartEvent.tooltipHide,{source:GO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:GO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:GO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{iK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}sK.specKey="crosshair";const nK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class rK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=MF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){MF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:TF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"cartesian");e&&(Yj(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=Kj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new nT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new rT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}rK.specKey="crosshair",rK.builtInTheme={crosshair:nK},rK.type=r.cartesianCrosshair;class aK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=lz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=DD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new nT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new oT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new aT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:nK},aK.type=r.polarCrosshair;const oK=(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},lK=(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)},hK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class cK extends Pz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=CF(t),this._isHorizontal="horizontal"===EF(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=>!DC(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(DC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};HL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,DC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;DC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else HL(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:n}=this._option;JO(n,"dataview",Aa),ZO(n,"dataFilterComputeDomain",hK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new tD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(DC(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&&DC(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,DC(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=DC(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 rE,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||(ZO(this._option.dataSet,"dataFilterWithNewDomain",lK),ZO(this._option.dataSet,"lockStatisticsFilter",oK),HL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(DC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&zC(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,zC(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]}clear(){this._throttledHide=null}}G(cK,lV);class dK extends Bz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=TR({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}}}const uK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),pK={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:uK(!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:uK(!0)};class gK extends cK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=dK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new TE;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(!DC(t.type)||e[0]!==$(e))&&(!zC(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 NB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:FO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:FO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:FO(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:FO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:FO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:FO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:FO(g.style)},selectedBackgroundStyle:FO(this._spec.selectedBackground.style),dragMaskStyle:FO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:TR(FO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:TR(FO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(d=m.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}=DD(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()}}gK.type=r.dataZoom,gK.transformerConstructor=dK,gK.builtInTheme={dataZoom:pK},gK.specKey="dataZoom";const fK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class mK extends cK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 hM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=PL(this._start,e)&&PL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=FO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=FO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}mK.type=r.scrollBar,mK.builtInTheme={scrollBar:fK},mK.specKey="scrollBar";const vK=(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},_K=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),yK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:_K("l1FontSize","primaryFontColor")},content:{visible:!0,style:_K("l2FontSize","tertiaryFontColor")}};class bK extends Pz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return FD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZO(this._option.dataSet,"indicatorFilter",vK);const t=new wa(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 tD(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=TR({},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({},DO(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?_R(l,this._computeLayoutRadius()):0,dy:h?_R(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({},DO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bK.type=r.indicator,bK.builtInTheme={indicator:yK},bK.specKey="indicator";const xK=["sum","average","min","max","variance","standardDeviation","median"];function SK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function AK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SK(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=dR(t.x)?wK(t.x,n)+r.x:CK(l.getXAxisHelper(),[t.x])+r.x,h}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SK(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=dR(t.y)?wK(t.y,n)+r.y:CK(l.getYAxisHelper(),[t.y])+r.y,h}function MK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SK(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)),CK(a.angleAxisHelper,[t.angle])}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SK(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)),CK(a.radiusAxisHelper,[t.radius])}function wK(t,e){return Number(t.substring(0,t.length-1))*e/100}function CK(t,e){const i=t.getScale(0);return DC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function EK(t){return xK.includes(t)}function BK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=AK(t,_,n,u,c,o),r=kK(t,y,n,u,d,o),PK(s,b,S,g.length),PK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=AK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);PK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=kK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);PK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function PK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MK(t,l,n,r),i=TK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function RK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=dR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=dR(i)?Number(i.substring(0,i.length-1))*f/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])&&SK(_,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])&&SK(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:CK(d.getXAxisHelper(),b)+p.x+m,y:CK(d.getYAxisHelper(),x)+p.y+v})})),n}function OK(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])&&SK(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])&&SK(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:CK(l.angleAxisHelper,d),radius:CK(l.radiusAxisHelper,u)})})),s}function IK(t,e,i){let{x:s,y:n}=t;return dR(s)&&(s=wK(s,e)),dR(n)&&(n=wK(n,i)),{x:s,y:n}}function DK(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}=IK(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=>IK(t,n,r)))}function FK(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 zK(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},FO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},HK(FO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=HK(FO(r),i,s)),t}return{visible:!1}}function jK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function HK(t,e,i){return d(t)?t(e,i):t}function VK(t,e){return d(t)?t(e):t}function NK(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 UK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function WK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=UK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=UK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function YK(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function $K(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])&&EK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&EK(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])&&EK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&EK(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=>KK(i,t,e))):i.x=KK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>KK(i,t,e))):i.y=KK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>KK(i,t,e))):i.angle=KK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>KK(i,t,e))):i.radius=KK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=KK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const XK={min:(t,e)=>LL(t[0].latestData,e.field),max:(t,e)=>RL(t[0].latestData,e.field),sum:function(t,e){return OL(t[0].latestData,e.field)},average:function(t,e){return IL(t[0].latestData,e.field)},variance:function(t,e){return DL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DL(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 KK(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(m(t)){const{aggrType:i,field:s}=t;return XK[i](e,{field:s})}return t}function qK(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 ZK extends Pz{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 FD(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)&&EK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=NL(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){u(this._spec.offsetX)||(this._layoutOffsetX=pR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=pR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerFilter",qK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function JK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=LL(t,e),r=RL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class QK extends ZK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=WK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:HK(FO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{line:jK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return jK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return jK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:HK(FO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:HK(FO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=FK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=WK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerRegression",JK),ZO(this._option.dataSet,"markerFilter",qK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}QK.specKey="markLine";const tq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),eq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},iq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:tq(!1),endSymbol:tq(!0),label:eq};class sq extends QK{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new wP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=WK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=BK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=RK(i,r,d,e.coordinatesOffset):c&&(y=DK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(dR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=WK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}sq.type=r.markLine,sq.coordinateType="cartesian",sq.builtInTheme={markLine:iq};class nq extends QK{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=WK(this._spec);return e||i?new BP(t):new wP(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}=WK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=LK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=OK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=WK(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}}}nq.type=r.polarMarkLine,nq.coordinateType="polar",nq.builtInTheme={polarMarkLine:iq};class rq extends Pz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=cR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return FD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=pR(this._spec.width,l.width,null,l.width),c=pR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iL(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}}rq.type=r.title,rq.specKey=r.title,rq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class aq extends ZK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:HK(FO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{area:jK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>jK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return jK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=FK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}aq.specKey="markArea";const oq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class lq extends aq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=GK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=RK(s,a,u,i.coordinatesOffset):d&&(f=DK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GK(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}}}lq.type=r.markArea,lq.coordinateType="cartesian",lq.builtInTheme={markArea:oq};class hq extends aq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GK(this._spec);return i||e||s?new PP(t):new EP(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}=GK(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=LK(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=OK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GK(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}}}hq.type=r.polarMarkArea,hq.coordinateType="polar",hq.builtInTheme={polarMarkArea:oq};const cq=t=>FO(Object.assign({},t)),dq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},FO(t.style))}),uq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=cq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=cq(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:{},FO(Object.assign({},y)));var y;const b=dq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=dq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=dq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=dq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},pq=t=>"left"===t||"right"===t,gq=t=>"top"===t||"bottom"===t,fq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class mq extends Pz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},uq(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({},uq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _L(t):this._playerComponent=new xL(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=pq(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=pq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(uL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=pq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=gq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):pq(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))):gq(this._orient)?this._maxSize():t.height}_computeDx(t){return pq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}mq.builtInTheme={player:fq},mq.specKey="player",mq.type=r.player;class vq extends Pz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=tR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==CI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}vq.type=r.label;class _q extends cN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}_q.type="text",_q.constructorType="label";const yq=()=>{dN(),wR.registerMark(_q.constructorType,_q)};class bq extends Bz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class xq extends vq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=bq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(NO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(NO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=TR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},BV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[gO])):t=>t.filter((t=>t.data[pO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?PV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}xq.type=r.label,xq.specKey="label",xq.transformerConstructor=bq;class Sq extends vq{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[dO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return TR({textStyle:{pickable:!0===this._spec.interactive},position:Aq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[gO]:t.data[pO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>PV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Aq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Sq.type=r.totalLabel,Sq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Sq.specKey="totalLabel";class kq extends ZK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=YK(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=zK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=HK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=FO(HK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=HK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=HK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:VK(R.offsetX,this._relativeSeries.getRegion()),offsetY:VK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:HK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:HK(I.style,this._markerData,this._markAttributeContext)},state:{line:jK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:jK(J,this._markerData,this._markAttributeContext),textBackground:jK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:jK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:FO(st.style)}):{visible:!1};return new RP(et)}_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}=FK([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:NK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NK(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}=YK(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}kq.specKey="markPoint";const Mq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Tq extends kq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=BK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=RK(n,r,h,s.coordinatesOffset)[0]:l&&(c=DK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=YK(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}}}Tq.type=r.markPoint,Tq.coordinateType="cartesian",Tq.builtInTheme={markPoint:Mq};class wq extends kq{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=LK(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:he({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}])]}}}wq.type=r.polarMarkPoint,wq.coordinateType="polar",wq.builtInTheme={polarMarkPoint:Mq};class Cq extends kq{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}])]}}}Cq.type=r.geoMarkPoint,Cq.coordinateType="geo",Cq.builtInTheme={geoMarkPoint:Mq};const Eq="inBrush",Bq="outOfBrush";class Pq extends Pz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Eq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Bq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new ML(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:FO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(yL.brushActive,(s=>{this._initMarkBrushState(i,Bq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(yL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(yL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(yL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},FO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Eq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Eq),i.addState(Bq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Eq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Eq),i.addState(Bq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Eq),s.removeState(Bq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Pq.type=r.brush,Pq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Pq.specKey="brush";class Lq extends Pz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${qR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=uF({},pF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Lq.type=r.customMark,Lq.specKey="customMark";class Rq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Oq(t))),a=n.filter((t=>!Oq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Oq(t))),h=o.filter((t=>!Oq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Oq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Rq.type="grid";const Iq="vchart-tooltip",Dq=`${Iq}-container`,Fq=`${Iq}-title`,zq=`${Iq}-content-box`,jq={offsetX:10,offsetY:10},Hq="99999999999999";function Vq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Nq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Uq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Vq(t):"",Wq=(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},Gq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Yq=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Gq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $q extends rz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=VD(null==T?void 0:T.position,b,e),C=null!==(r=VD(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:ZR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:JR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Ny(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Nq(e,F),V=Nq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(Yq(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Wq(t,_),W.top=Wq(i,_),W.right=Wq(e,_),W.bottom=Wq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Wq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=Yq(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Kq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Xq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Xq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},qq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?pR(e,t.fontSize):0},Zq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Xq(o)),{panelStyle:a,panelPadding:o}};function Jq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class Qq extends $q{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(Qq.type),this.type=eH.dom,this._tooltipContainer=null==Vy?void 0:Vy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Vy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Zq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Xq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Kq(h),x=Kq(d),S=Kq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Xq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Xq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Xq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(qq(p),qq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Fq))),l=a.find((t=>t.className.includes(zq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Fq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Jq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Iq}-column`),e.classList.add(`${Iq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(zq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Jq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Jq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Iq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Uq(e.key),e.keyStyle&&Kq(e.keyStyle,l)):"value"===i?(o.innerHTML=Uq(e.value),e.valueStyle&&Kq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Vq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Vq(c):m,y=p,b=t=>new kg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=ph.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Vq(u):"currentColor",`\n \n \n \n `;const w=T?ph.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Jq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(zq))),h=[...o.children].find((t=>t.className.includes(Fq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(Fq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=pR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Jq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},df||(df=hf.CreateGraphic("richtext",{})),df.setAttributes(a),df.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function iZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:tZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sZ=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 nZ extends $q{constructor(){super(nZ.type),this.type=eH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new BL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=mR(d.padding),x=iZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=iZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=iZ(m,i),k={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},M={panel:sZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=TR({},S,iZ(b,void 0,{})),{width:s,height:n,text:r}=eZ(h,i);T.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(m)){const t=TR({},A,iZ(x,void 0,{})),{width:e,height:s,text:n}=eZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=TR({},x,iZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=eZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}nZ.type=eH.canvas;const rZ=/\{([^}]+)\}/,aZ=/\{([^}]+)\}/g,oZ=/:/;class lZ extends rz{constructor(){super(lZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[lZ.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)),wR.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=rZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(aZ,((t,i)=>{if(!oZ.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(bi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}lZ.pluginType="chart",lZ.specKey="formatter",lZ.type="formatterPlugin";PD.useRegisters([()=>{aH(),lH(),cH(),Fj(),Dj(),xj(),uj(),XF(),qF(),bD(),vD(),rj(),ej(),wR.registerSeries(Sj.type,Sj),wR.registerChart(dH.type,dH)},()=>{aH(),lH(),cH(),Dj(),xj(),uj(),XF(),gH(),qF(),vH(),rj(),ej(),wR.registerSeries(yH.type,yH),Fj(),wR.registerChart(xH.type,xH)},()=>{aH(),lH(),cH(),Dj(),IH(),Fj(),wR.registerChart(FH.type,FH)},()=>{aH(),lH(),Fj(),Dj(),$H(),wR.registerChart(KH.type,KH)},()=>{lH(),GN(),wR.registerChart(j$.type,j$)},()=>{aH(),lH(),Fj(),Dj(),cU(),wR.registerChart(N$.type,N$)},()=>{aH(),lH(),cH(),Fj(),Dj(),yU(),wR.registerChart(W$.type,W$)},()=>{aH(),lH(),cH(),Fj(),Dj(),IH(),wR.registerChart(q$.type,q$)},()=>{lH(),dV(),eV(),wR.registerSeries(pV.type,pV),wR.registerImplement("registerMap",iI),wR.registerImplement("unregisterMap",sI),_D(),wR.registerChart(R$.type,R$)},()=>{lH(),ZY(),wR.registerSeries(QY.type,QY),jN(),OU(),aU(),FU(),wR.registerChart(tX.type,tX)},()=>{lH(),kG(),wR.registerChart(sX.type,sX)},()=>{lH(),WG(),wR.registerChart(rX.type,rX)},()=>{aH(),lH(),cH(),Fj(),Dj(),NV(),wR.registerChart(vX.type,vX)},()=>{aH(),lH(),Fj(),Dj(),hN(),wR.registerChart(yX.type,yX)},()=>{aH(),lH(),Fj(),Dj(),FU(),wR.registerChart(J$.type,J$)},()=>{aH(),lH(),Fj(),Dj(),GU(),wR.registerChart(oX.type,oX)},()=>{aH(),lH(),Fj(),Dj(),bN(),wR.registerChart(hX.type,hX)},()=>{aH(),lH(),cH(),Fj(),Dj(),gH(),rj(),ej(),wR.registerSeries(MN.type,MN),wR.registerChart(AX.type,AX)},()=>{lH(),lY(),wR.registerChart(dX.type,dX)},()=>{lH(),gY(),wR.registerChart(pX.type,pX)},()=>{lH(),VY(),wR.registerChart(fX.type,fX)},()=>{lH(),vo.load(pM),RY(),wR.registerChart(xX.type,xX)},()=>{lH(),a$(),wR.registerChart(MX.type,MX)},()=>{lH(),y$(),wR.registerChart(wX.type,wX)},()=>{aH(),lH(),cH(),Fj(),wR.registerChart(Y$.type,Y$),Dj()},ej,rj,()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(aj.type,aj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(oj.type,oj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(lj.type,lj)},lU,aU,()=>{wR.registerComponent(LX.type,LX)},()=>{wR.registerComponent(UX.type,UX)},()=>{wR.registerComponent(QX.type,QX)},()=>{wR.registerComponent(rK.type,rK)},()=>{wR.registerComponent(aK.type,aK)},()=>{wR.registerComponent(gK.type,gK)},()=>{wR.registerComponent(mK.type,mK)},()=>{wR.registerComponent(bK.type,bK)},dV,()=>{wR.registerComponent(sq.type,sq),TP()},()=>{wR.registerComponent(lq.type,lq),CP()},()=>{wR.registerComponent(Tq.type,Tq),LP()},()=>{wR.registerComponent(nq.type,nq),BP._animate=oP,TP()},()=>{wR.registerComponent(hq.type,hq),PP._animate=hP,CP()},()=>{wR.registerComponent(wq.type,wq),LP()},()=>{wR.registerComponent(Cq.type,Cq),LP()},()=>{wR.registerComponent(rq.type,rq)},()=>{wR.registerComponent(mq.type,mq)},()=>{wR.registerGraphicComponent(xq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(xq.type,xq,!0,1/0)},()=>{wR.registerGraphicComponent(Sq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(Sq.type,Sq,!0)},()=>{wR.registerComponent(Pq.type,Pq)},()=>{wR.registerComponent(Lq.type,Lq)},()=>{vo.load(iT)},()=>{wR.registerLayout(Rq.type,Rq)},()=>{var t;t=nZ,wR.registerComponentPlugin(t.type,t)},()=>{var t;t=lZ,wR.registerChartPlugin(t.type,t)},TD,ED]),PD.useRegisters([()=>{VS(vo)}]),t.DEFAULT_CHART_HEIGHT=JR,t.DEFAULT_CHART_WIDTH=ZR,t.DEFAULT_CLOSE_STROKE_JOIN=OD,t.DEFAULT_DATA_INDEX=tO,t.DEFAULT_DATA_KEY=eO,t.DEFAULT_DATA_SERIES_FIELD=iO,t.DEFAULT_KEY=xO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=RD,t.DEFAULT_MEASURE_CANVAS_ID=QR,t.DEFAULT_SERIES_STYLE_NAME=sO,t.DEFAULT_SMOOTH_INTERPOLATE=LD,t.Factory=wR,t.MOSAIC_CAT_END_PERCENT=_O,t.MOSAIC_CAT_START_PERCENT=vO,t.MOSAIC_VALUE_END_PERCENT=mO,t.MOSAIC_VALUE_START_PERCENT=fO,t.ManualTicker=class extends rw{constructor(t){super(t),this.lastFrameTime=0,this.status=Eo.RUNNING}setupTickHandler(){const t=new aw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,!0}},t.PREFIX=qR,t.SEGMENT_FIELD_END=bO,t.SEGMENT_FIELD_START=yO,t.STACK_FIELD_END=aO,t.STACK_FIELD_END_OffsetSilhouette=cO,t.STACK_FIELD_END_PERCENT=lO,t.STACK_FIELD_KEY=nO,t.STACK_FIELD_START=rO,t.STACK_FIELD_START_OffsetSilhouette=hO,t.STACK_FIELD_START_PERCENT=oO,t.STACK_FIELD_TOTAL=dO,t.STACK_FIELD_TOTAL_BOTTOM=gO,t.STACK_FIELD_TOTAL_PERCENT=uO,t.STACK_FIELD_TOTAL_TOP=pO,t.StreamLight=class extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=yo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Hl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=yo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=al(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=al(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;et;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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal");const vo=new class{};let _o=0;class yo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=vo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++_o,t),this.tryRunAnimationFrameNextFrame(),_o}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class bo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var xo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ao=function(t,e){return function(i,s){e(i,s,t)}},ko=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 Mo=class extends bo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new yo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return ko(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var To,wo,Co,Eo;Mo=xo([Ya(),Ao(0,Wa(lo)),Ao(0,$a(fo)),So("design:paramtypes",[Object])],Mo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(To||(To={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(wo||(wo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Eo||(Eo={}));const Bo=Ht-1e-8;class Po{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Bo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,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,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},Io={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Do,Fo,zo,jo,Ho,Vo;var No,Uo,Wo,Go,Yo,$o;function Xo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Ko(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Zo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=nl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function al(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ol(i,n),new ol(n,s)]}class ol extends Jo{constructor(t,e){super(),this.type=Yo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p1.x):t===Go.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ll{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ol(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Go.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===Go.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class hl extends ll{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 cl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function dl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?Go.ROW:Go.COLUMN;return"monotoneY"===t?new hl(t,s):new ll(t,s)}class ul{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 pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new ul(n,s),t),n}function gl(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 fl{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&&gl(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:gl(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 ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("basis",i,t);return function(t,e){cl(t,e,2)}(new fl(n,s),t),n}function vl(t){return t<0?-1:1}function _l(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(vl(r)+vl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function yl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function bl(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 xl{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:bl(this,this._t0,yl(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,bl(this,yl(this,e=_l(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:bl(this,this._t0,e=_l(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 Sl extends xl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneX",i,t);return function(t,e){cl(t,e,2)}(new xl(n,s),t),n}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return pl(t,e);const n=dl("monotoneY",i,t);return function(t,e){cl(t,e,2)}(new Sl(n,s),t),n}let Ml=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Tl extends Ml{lineEnd(){this.context.closePath()}}function wl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Ml(r,e,n),t),r}function Cl(t,e){return cl(t,e,1)}class El extends ul{lineEnd(){this.context.closePath()}}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=dl("linear",i,t);return function(t,e){cl(t,e,1)}(new El(n,s),t),n}function Pl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ll(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return pl(i,n);const o=dl(t,r,i);return cl(new e(o,s,a),i,2),o}}const Rl=Ll("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Pl(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=Ll("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Pl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Il extends Jo{constructor(t,e,i){super(),this.type=Yo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return sl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Qo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Go.ROW?Nt(this.p0.x-this.p2.x):t===Go.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=sl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Il(i,a,r),new Il(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Dl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ol(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Il(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new rl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Fl(t,e,i){var s,n;switch(e){case"linear":default:return pl(t,i);case"basis":return ml(t,i);case"monotoneX":return Al(t,i);case"monotoneY":return kl(t,i);case"step":return wl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ll("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?Go.ROW:Go.COLUMN);return Cl(new Tl(r,e,n),t),r}(t,.5,i);case"stepBefore":return wl(t,0,i);case"stepAfter":return wl(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 Ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Bl(t,i)}}class zl extends Lo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Po(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Io.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Io.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Io.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([Io.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([Io.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([Io.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([Io.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([Io.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Io.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Dl(this);Zo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Io.M]=t=>`M${t[1]} ${t[2]}`,t[Io.L]=t=>`L${t[1]} ${t[2]}`,t[Io.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Io.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Io.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Io.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;tVo){let t,e=zo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Zo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Go.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===Go.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),ih=Object.assign(Object.assign({},Xl),{points:[],cornerRadius:0,closePath:!0}),sh=Object.assign(Object.assign({},Xl),{width:100,height:100,spikes:5,thickness:.5}),nh=Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Xl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const rh=Object.assign(Object.assign({},Xl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ah=Object.assign(Object.assign(Object.assign({},Xl),Gl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),oh=Object.assign(Object.assign(Object.assign({},Xl),Gl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),lh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Xl),{fill:!0,cornerRadius:0,cornerType:"round"}),hh=Object.assign(Object.assign({},lh),{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}),ch=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&&_(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 dh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(dh.IsGradientStr(t))try{const e=ch(t)[0];if(e){if("linear"===e.type)return dh.ParseLinear(e);if("radial"===e.type)return dh.ParseRadial(e);if("conic"===e.type)return dh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:dh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:dh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const gh={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"}},fh=!0,mh=!1,vh=/\w|\(|\)|-/,_h=/[.?!,;:/,。?!、;:]/,yh=/\S/,bh=(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})};function xh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=vo.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=Sh(t,a)),a}function Sh(t,e,i=!1){let s=e;for(;vh.test(t[s-1])&&vh.test(t[s])||_h.test(t[s]);)if(s--,s<=0)return i?Ah(t,e):e;return s}function Ah(t,e){let i=e;for(;vh.test(t[i+1])&&vh.test(t[i])||_h.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function kh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=vo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Mh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Th=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ah.fontSize}){let i=0,s=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=Sh(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,a=!1){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=Sh(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}};Th=Mh([Ya()],Th);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};const Ch=Symbol.for("TextMeasureContribution");let Eh=class extends Th{};Eh=wh([Ya()],Eh);const Bh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},Ph=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Rh(t){return Bh.getNamed(Ph,vo.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Dh=1/3;function Fh(t){return t>-qh&&tqh||t<-qh}const jh=[0,0],Hh=[0,0],Vh=[0,0];function Nh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Gh(t){return(t%=Vt)<0&&(t+=Vt),t}function Yh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function Kh(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(Fh(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 Jh=[-1,-1,-1],Qh=[-1,-1];function tc(){const t=Qh[0];Qh[0]=Qh[1],Qh[1]=t}function ec(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(Fh(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,Dh):Math.pow(i,Dh),s=s<0?-Math.pow(-s,Dh):Math.pow(s,Dh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Jh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&tc(),p=Wh(e,s,r,o,Qh[0]),u>1&&(g=Wh(e,s,r,o,Qh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Fh(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,Jh);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=Uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Jh[0]=-l,Jh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Jh[0]+t&&a<=Jh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Jh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function nc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function rc(t,e){let i=nc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-nc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;ac[0]=S,ac[1]=A,rc(ac,Boolean(a[6])),S=ac[0],A=ac[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Io.M:u=m,p=v,c=u,d=p;break;case Io.L:if(i){if(Kh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Io.C:if(i){if($h(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Io.Q:if(i){if(Yh(c,d,m,v,_,y,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Io.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Xh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=sc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Io.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Kh(u,p,o,p,e,s,n)||Kh(o,p,o,l,e,s,n)||Kh(o,l,u,l,e,s,n)||Kh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Io.Z:if(i){if(Kh(c,d,u,p,e,s,n))return!0}else h+=Le(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},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dc=Symbol.for("VWindow"),uc=Symbol.for("WindowHandlerContribution");let pc=class extends bo{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Bh.getNamed(uc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=vo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};pc=hc([Ya(),cc("design:paramtypes",[])],pc);var gc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mc=function(t,e){return function(i,s){e(i,s,t)}};let vc=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=vo.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=lc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Gl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:Gl.fontFamily,fontSize:Gl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Bh.get(dc),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 _c;vc=gc([Ya(),mc(0,Wa(lo)),mc(0,$a(Ch)),fc("design:paramtypes",[Object])],vc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(_c||(_c={}));const yc=new Ue;let bc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=_c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=_c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}scale(t,e,i){return this.mode===_c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===_c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return yc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}translate(t,e){return this.mode===_c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===_c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bc=gc([Ya(),fc("design:paramtypes",[])],bc);const xc={arc:Kl,area:ql,circle:Zl,line:th,path:eh,symbol:rh,text:ah,rect:nh,polygon:ih,star:sh,richtext:oh,richtextIcon:hh,image:lh,group:Jl,glyph:Ql},Sc=Object.keys(xc);function Ac(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},xc.arc),area:Object.assign({},xc.area),circle:Object.assign({},xc.circle),line:Object.assign({},xc.line),path:Object.assign({},xc.path),symbol:Object.assign({},xc.symbol),text:Object.assign({},xc.text),rect:Object.assign({},xc.rect),polygon:Object.assign({},xc.polygon),star:Object.assign({},xc.star),richtext:Object.assign({},xc.richtext),richtextIcon:Object.assign({},xc.richtextIcon),image:Object.assign({},xc.image),group:Object.assign({},xc.group),glyph:Object.assign({},xc.glyph)};class Mc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Sc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Sc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Ac(n,t[s]),i[s]&&Ac(n,i[s]),e[s]&&Ac(n,e[s]),this.combinedTheme[s]=n})),e.common&&Sc.forEach((t=>{Ac(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 Tc=new Mc;function wc(t,e){return t.glyphHost?wc(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)):Tc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Tc.getTheme()}var Cc=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 Ec 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Cc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Dc(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(Dc(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,Dc(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 Lc))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"):Dc(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 Rc))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=Ic.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 Fc(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 Lc,this.rootWheelEvent=new Rc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Vc{static GetImage(t,e){var i;const s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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):Vc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Vc.cache.get(t);s?"fail"===s.loadState?vo.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"},Vc.cache.set(t,s),s.dataPromise=vo.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=Vc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Vc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=vo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=vo.global.loadBlob(t):"json"===e&&(i.dataPromise=vo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Vc.isLoading&&Vc.toLoadAueue.length){Vc.isLoading=!0;const t=Vc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Vc.cache.set(i,n),n.dataPromise=vo.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((()=>{Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()})).catch((t=>{console.error(t),Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()}))}}),0)}static loadImage(t,e){const i=Nc(t,Vc.toLoadAueue);if(-1!==i)return Vc.toLoadAueue[i].marks.push(e),void Vc.loading();Vc.toLoadAueue.push({url:t,marks:[e]}),Vc.loading()}static improveImageLoading(t){const e=Nc(t,Vc.toLoadAueue);if(-1!==e){const t=Vc.toLoadAueue.splice(e,1);Vc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Nc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Gc[0]=t[0],Gc[2]=t[0],Gc[1]=t[1],Gc[3]=t[1],Gc):t:t:0,$c=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function Kc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;$c[0].x=i,$c[1].y=i,$c[2].x=-i,$c[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Qc.TimeOut=1e3/60;const td=new Qc,ed=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class id{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 sd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var nd=new class extends id{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 sd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return sd(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 rd=new class extends id{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 ad(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 od=new class extends id{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 ad(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}};function ld(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var hd=new class extends id{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2+n,i,s)}};function cd(t,e,i,s,n=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 dd extends id{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 cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}}var ud=new dd;var pd=new class extends dd{constructor(){super(...arguments),this.type="triangle"}};const gd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),fd=Math.sin(Ht/10)*gd,md=-Math.cos(Ht/10)*gd;function vd(t,e,i,s){const n=fd*e,r=md*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 _d=new class extends id{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 vd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return vd(t,this.parseSize(e)/2+n,i,s)}};const yd=Xt(3);function bd(t,e,i,s){const n=e,r=n/yd,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 xd=new class extends id{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};function Sd(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 Ad=new class extends id{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Md=new class extends id{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Td=-.5,wd=Xt(3)/2,Cd=1/Xt(12);function Ed(t,e,i,s){const n=e/2,r=e*Cd,a=n,o=e*Cd+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(Td*n-wd*r+i,wd*n+Td*r+s),t.lineTo(Td*a-wd*o+i,wd*a+Td*o+s),t.lineTo(Td*l-wd*h+i,wd*l+Td*h+s),t.lineTo(Td*n+wd*r+i,Td*r-wd*n+s),t.lineTo(Td*a+wd*o+i,Td*o-wd*a+s),t.lineTo(Td*l+wd*h+i,Td*h-wd*l+s),t.closePath(),!1}var Bd=new class extends id{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ld=new class extends id{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends id{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Dd=new class extends id{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Fd=Xt(3);function zd(t,e,i,s){const n=e*Fd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var jd=new class extends id{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2/Fd,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2/Fd+n,i,s)}};function Hd(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 Vd=new class extends id{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Ud=new class extends id{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Gd=new class extends id{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 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 Yd(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 $d=new class extends id{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Kd=new class extends id{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Zd=new class extends id{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(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 Qd=new class extends id{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 Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(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 tu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function eu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var iu=new class extends id{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)?eu(t,e,i,s):tu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?eu(t,e+2*n,i,s):tu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const su=new Ve;class nu{constructor(t,e,i=!1){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(),Zo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Zo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{su.x1=i.bounds.x1*t,su.y1=i.bounds.y1*t,su.x2=i.bounds.x2*t,su.y2=i.bounds.y2*t,e.union(su)}))}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 ru={};[nd,rd,od,hd,jd,pd,_d,xd,Ad,Md,Bd,Ld,Od,ud,Dd,Vd,Ud,Gd,$d,iu,Kd,Zd,Qd].forEach((t=>{ru[t.type]=t}));const au={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ou{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 lu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function hu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=hu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=lu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=hu(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 ou(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 ou(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 uu(t,e){return pu(t)}function pu(t,e){const i={};for(let e=0;eSu.set(t,!0)));const Au=new Map;function ku(t){if(Su.has(t))return!0;if(Au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Au.set(t,!0)));const Mu=bu(),Tu=bu(),wu=bu(),Cu=bu(),Eu=bu(),Bu=bu(),Pu=bu(),Lu=bu(),Ru=bu(),Ou=bu();bu();const Iu=bu();bu();const Du=bu();bu();const Fu=bu(),zu=bu(),ju=Symbol.for("GraphicService"),Hu=Symbol.for("GraphicCreator"),Vu={"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"},Nu=Object.keys(Vu),Uu={duration:200,easing:"cubicOut"};function Wu(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 Gu(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 Yu(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 $u(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 Ku{constructor(){this.pools=[]}static identity(t){return Wu(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 Ku.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},Qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tp=new Ue(1,0,0,1,0,0),ep={x:0,y:0};let ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new zl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ep),function(t,e,i){return oc(t,0,!1,e,i)}(this.path.commandList,ep.x,ep.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ep);const i=uh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return oc(t,e,!0,i,s)}(this.path.commandList,i,ep.x,ep.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(t=!0,e=this.dpr){this.setTransformFromMatrix(tp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};ip=Ju([Ya(),Qu("design:paramtypes",[Object,Number])],ip);const sp={WIDTH:500,HEIGHT:500,DPR:1};class np{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}set nativeCanvas(t){this._nativeCanvas=t}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=sp.WIDTH,height:n=sp.HEIGHT,dpr:r=sp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var rp;np.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(rp||(rp={}));class ap{static Get(t,e=rp.Color1,i=[0,0,0,1]){if(e===rp.Color1){const e=ap.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ap.store1[t]=e,ap.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=ap.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(ap.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ap.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===rp.Color1){if(ap.store1[t])return;ap.store1[t]=i,ap.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ap.store255[t])return;ap.store255[t]=i,ap.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function op(t,e=!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 lp(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)=>{var a,o;return hp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):hp(t,e,i,s,n)}function hp(t,e,i,s,n){if(!t||!e)return t&&op(t)||e&&op(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ap.Get(t,rp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ap.Get(e,rp.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:op(a)})))});return o?lp(r,l,i,s,n):lp(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:pp(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:pp(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:pp(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),op(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)}function cp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}ap.store255={},ap.store1={};const dp=[0,0,0,0],up=[0,0,0,0];function pp(t,e,i){return ap.Get(t,rp.Color255,dp),ap.Get(e,rp.Color255,up),`rgba(${Math.round(dp[0]+(up[0]-dp[0])*i)},${Math.round(dp[1]+(up[1]-dp[1])*i)},${Math.round(dp[2]+(up[2]-dp[2])*i)},${dp[3]+(up[3]-dp[3])*i})`}class gp{static GetCanvas(){try{return gp.canvas||(gp.canvas=vo.global.createCanvas({})),gp.canvas}catch(t){return null}}static GetCtx(){if(!gp.ctx){const t=gp.GetCanvas();gp.ctx=t.getContext("2d")}return gp.ctx}}class fp extends We{static getInstance(){return fp._instance||(fp._instance=new fp),fp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=gp.GetCanvas(),s=gp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new fp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class mp{static GetSize(t){for(let e=0;e=t)return mp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=mp.GenKey(t,e,i,s,n),l=mp.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=mp.GenKey(t,e,i,s,n);mp.cache[l]?mp.cache[l].push({width:a,height:o,pattern:r}):mp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}mp.cache={},mp.ImageSize=[20,40,80,160,320,640,1280,2560];const vp=new Ve,_p=new Ue;new Ve;const yp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],bp=["x","y"],xp=["scaleX","scaleY"],Sp=["angle"],Ap=new ne,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends Ec{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ru[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===((i=t=au[t]||t).startsWith("{const e=(new zl).fromString(t.d),i={};Nu.forEach((e=>{t[e]&&(i[Vu[e]]=t[e])})),n.push({path:e,attribute:i}),vp.union(e.bounds)}));const r=vp.width(),a=vp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new nu(t,n,!0);return Mp.userSymbolMap[t]=l,l}var i;const s=(new zl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new nu(t,s);return Mp.userSymbolMap[t]=o,o}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=Yc(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 Po(t);return Zo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&No.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&No.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&No.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&No.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&No.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=No.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Uo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Uu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Wo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Wo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Wo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=No.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=No.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&No.UPDATE_SHAPE_AND_BOUNDS)===No.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=No.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=No.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=No.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=No.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=No.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=No.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&No.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,scaleX:i=Vl.scaleX,scaleY:s=Vl.scaleY,angle:n=Vl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),vo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Vl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=_p.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Wo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:vo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new zl).fromString(t):this.pathProxy=new zl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),vo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||vo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ip(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Tp;Mp.userSymbolMap={},Mp.mixin(zc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tp||(Tp={}));let wp=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=No.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 Mc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Mc)}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===Uo.GLOBAL){const i=new ne(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&No.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Vl.x,y:e=Vl.y,dx:i=Vl.dx,dy:s=Vl.dy,scaleX:n=Vl.scaleX,scaleY:r=Vl.scaleY,angle:a=Vl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return vo.graphicService.updateTempAABBBounds(i),vo.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&=No.CLEAR_BOUNDS,this._childUpdateTag&=No.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=No.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&No.UPDATE_BOUNDS||(this._childUpdateTag|=No.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&No.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=vo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Cp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Ep extends wp{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 Mc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{vo.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=>{vo.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Dp,Fp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 jp=Dp=class{static GenerateLayerId(){return`${Dp.idprefix}_${Dp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=vo.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?Bh.get(Rp):"dynamic"===t?Bh.get(Op):Bh.get(Ip),e}createLayer(t,e={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 Ep(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Dp.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)}};jp.idprefix="visactor_layer",jp.prefix_count=0,jp=Dp=Fp([Ya(),zp("design:paramtypes",[])],jp);var Hp=new Ra((t=>{t(mo).to(Mo).inSingletonScope(),t(dc).to(pc),t(Pp).to(vc).inSingletonScope(),t(Bp).to(bc).inSingletonScope(),t(Lp).to(jp).inSingletonScope()}));function Vp(t,e){return!(!t&&!e)}function Np(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Up(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Gp(t,e){return t*e>0}function Yp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function $p(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Kp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=$p(g,f,u,p,n,t,Number(c)),l=$p(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=$p(S,A,b,x,r,-n,Number(c)),l=$p(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const qp=Symbol.for("ArcRenderContribution"),Zp=Symbol.for("AreaRenderContribution"),Jp=Symbol.for("CircleRenderContribution"),Qp=Symbol.for("GroupRenderContribution"),tg=Symbol.for("ImageRenderContribution"),eg=Symbol.for("PathRenderContribution"),ig=Symbol.for("PolygonRenderContribution"),sg=Symbol.for("RectRenderContribution"),ng=Symbol.for("SymbolRenderContribution"),rg=Symbol.for("TextRenderContribution"),ag=Symbol.for("InteractiveSubRenderContribution");function og(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function lg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var hg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},dg=function(t,e){return function(i,s){e(i,s,t)}};function ug(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Gu(t,t,[n+o,r+l,a+h]),Gu(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),Gu(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]),f){const i=Zu.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]}Gu(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),Gu(i,i,[-s[0],-s[1],0]),$u(t,t,i)}}let pg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Po(t);return Zo(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=lg(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=og(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){_u(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;_u(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};pg=hg([Ya(),dg(0,Wa(Hu)),cg("design:paramtypes",[Object])],pg);const gg=(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},fg=["radius","startAngle","endAngle",...yp];class mg extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Cu}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 wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.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>Vt-Ft?i.set(-r,-r,r,r):Kc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,fg)}needUpdateTag(t){return super.needUpdateTag(t,fg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new zl,s.arc(0,0,r,a,o),s}clone(){return new mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mg.NOWORK_ANIMATE_ATTR}}function vg(t){return new mg(t)}mg.NOWORK_ANIMATE_ATTR=kp;class _g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=To.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=zu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new bg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=vo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){_u(n,o/Math.abs(r+a),!0,l),i.union(n)}return vo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=vo.graphicUtil.textMeasure,S=new _g(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:_=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),A=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const k=vo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:A},T=new _g(r,M,k),w=y(t)?t.map((t=>t.toString())):[t.toString()],C=[],E=[0,0];let B=1/0;if(_>0&&(B=Math.max(Math.floor(_/A),1)),b&&(B=Math.min(B,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const t=og(v,r),e=this.cache.verticalList.length*m,i=lg(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===xu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Gt(e,r)}));const b=og(v,r),x=this.cache.verticalList.length*m,S=lg(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ed(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=yg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=yg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return bg.baselineMapAlign}getAlignMapBaseline(){return bg.alignMapBaseline}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),bg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Sg=["symbolType","size",...yp];let Ag=class t extends Mp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Fu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=vo.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;_u(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return vo.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,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new zl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new zl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Mg=["segments","points","curveType","curveTension",...yp];let Tg=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=Zc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new zl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Cg=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}},Eg=["width","x1","y1","height","cornerRadius",...yp];class Bg extends Mp{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Cg(e);return t=new zl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Lg extends Mp{constructor(t){super(t),this.type="glyph",this.numberType=Eu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=kp;class Og{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=gh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Dg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ed(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=kh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=kh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=xh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=kh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=xh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=kh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Fg=["width","height","image",...yp];class zg extends Mp{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return lh[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}clone(){return new zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function jg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class Hg extends zg{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=Yc(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=Yc(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=lh.width,height:e=lh.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 Vg{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 Hg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=gh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Dg){const e=yh.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 Hg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=kh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)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||mh;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,bh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||fh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?ph(t,s,{AABBBounds:i}):s,bh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Hg)break;const{width:n}=kh(t,s.character,s.ascentDescentMode),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 Hg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ng{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=gh[this.direction]}store(t){if(t instanceof Hg){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 Vg(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,e=!1){t instanceof Hg?"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||this.newLine)&&("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=xh(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 Dg(i,t.newLine,t.character,t.ascentDescentMode),new Dg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ug=!1;try{Ug=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ug=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...yp];class Gg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Du,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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.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:oh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1)))}static splitText(t){if(Ug){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Gg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),vo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||vo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,vo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Gg.AllSingleCharacter(_)&&(_=Gg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Og(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ng(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Gg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Gg.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const $g=["path","customPath",...yp];class Xg extends Mp{constructor(t){super(t),this.type="path",this.numberType=Ru}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 zl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof zl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return vo.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 zl).fromString(t.path):t.customPath&&(this.cache=new zl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){return(new zl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const qg=["segments","points","curveType","curveTension",...yp];class Zg extends Mp{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),vo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new zl;const 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 Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...yp];class tf extends Mp{constructor(t){super(t),this.type="arc",this.numberType=Mu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 wc(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}=vo.graphicService.updateTempAABBBounds(i);gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return vo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(Kc(l,o,s,i),Kc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const sf=["points","cornerRadius",...yp];class nf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),vo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return vo.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new zl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=kp;class af extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function of(t){return new af(t)}const lf=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 hf,cf;function df(t){return hf||(hf=lf.CreateGraphic("text",{})),hf.initAttributes(t),hf.AABBBounds}var uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gf=function(t,e){return function(i,s){e(i,s,t)}};class ff{constructor(){this.time=$o.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=lc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),lc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const mf=new ff;let vf=class{constructor(t){this.subRenderContribitions=t,this.time=$o.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)}))}};vf=uf([Ya(),gf(0,Wa(lo)),gf(0,$a(ag)),pf("design:paramtypes",[Object])],vf);const _f=new class{constructor(){this.time=$o.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const yf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class bf{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=lc.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])),lc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=lc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:uh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Kp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Af=xf,kf=mf;const Mf=new class{constructor(){this.time=$o.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{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:uh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Tf=xf,wf=mf;const Cf=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Ef=zt/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ef,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ef,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Ef,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Ef,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lf{constructor(){this.time=$o.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,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:uh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Bf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Rf=class{constructor(){this.time=$o.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)}};Rf=Pf([Ya()],Rf);let Of=class{constructor(){this.time=$o.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,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Bf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ya()],Of);const If=new Lf,Df=xf,Ff=mf;const zf=new class extends Lf{constructor(){super(...arguments),this.time=$o.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)}},jf=mf;const Hf=new class{constructor(){this.time=$o.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:_=l.opacity,x:y=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:uh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Vf=new class{constructor(){this.time=$o.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Nf=xf,Uf=mf;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Gf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(_f),this.builtinContributions.push(yf),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===$o.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===$o.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Up(d,u,h),y=Gp(d,g),b=Vp(h),x=Np(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Zo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Up(o,l,n),p=Gp(o,c),g=Vp(n,r),f=Np(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Zu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Zu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[Sf,kf,Af],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=$p(v,_,f,m,n,t,Number(u)),o=$p(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=$p(M,T,A,k,r,-n,Number(u)),o=$p(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(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(),Kp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Kp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),lp(o.color,l.color,h,!1)}(0,0,h,n);a||Up&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Kf=Yf([Ya(),Xf(0,Wa(lo)),Xf(0,$a(qp)),$f("design:paramtypes",[Object])],Kf);var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jf=function(t,e){return function(i,s){e(i,s,t)}};let Qf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,wf,Tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function tm(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]=nl(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 em(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 im(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=em(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),tm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Go.ROW:"y"===s?u=Go.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 nm=class extends Gf{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();im(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Fl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function rm(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),tm(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),tm(t,l,1,s),o=!1):o=!0}t.closePath()}nm=sm([Ya()],nm);const am=new class extends bf{constructor(){super(...arguments),this.time=$o.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Jc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Jc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},om=mf;var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let dm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[am,om],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=Fl(B(t.points,x),E,{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=Fl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Fl(e,E,{curveTension:b}),n=Fl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Go.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?Go.ROW:null==_.y1?Go.COLUMN:Number.isFinite(S+A)?S>A?Go.ROW:Go.COLUMN:Go.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Go.ROW:Go.COLUMN,Number.isFinite(c)||(o=Go.COLUMN),Number.isFinite(d)||(o=Go.ROW);const u=i*(o===Go.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),im(t,i[0]?e.top:e.bottom,l,x===Go.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};dm=lm([Ya(),cm(0,Wa(lo)),cm(0,$a(Zp)),hm("design:paramtypes",[Object])],dm);const um=xf,pm=mf;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},fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mm=function(t,e){return function(i,s){e(i,s,t)}};let vm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[pm,um],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Zo(t.pathShape.commandList,e,i,s,1,1,f);else{Zo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};vm=gm([Ya(),mm(0,Wa(lo)),mm(0,$a(eg)),fm("design:paramtypes",[Object])],vm);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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Wp(g,f,T,w,h),E=Yp(g,v,T,w,M),B=Vp(h,c),P=Np(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Bf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};xm=_m([Ya(),bm(0,Wa(lo)),bm(0,$a(sg)),ym("design:paramtypes",[Object])],xm);var Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Mm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Hf,Uf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Mm=Sm([Ya(),km(0,Wa(lo)),km(0,$a(ng)),Am("design:paramtypes",[Object])],Mm);const Tm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends ff{constructor(){super(...arguments),this.time=$o.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Tm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=df(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Bf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Tm.free(E),C()}};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},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ed(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),qu.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:og(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jm=function(t,e){return function(i,s){e(i,s,t)}};let Hm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),A=Om(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Rm(k,M),w=Om(h,Rm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Hm=Fm([Ya(),jm(0,Wa(lo)),jm(0,$a(ig)),zm("design:paramtypes",[Object])],Hm);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},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Wp(p,m,g,f,c),C=Yp(p,v,g,f),E=Vp(c,u),B=Np(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===$o.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===$o.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=vo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(i,p||i,n),a.modelMatrix=i,Zu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Zu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Vm([Ya(),Um(0,Wa(lo)),Um(0,$a(Qp)),Nm("design:paramtypes",[Object])],Wm);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)},$m=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let Km=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[zf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Bf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Vc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};Km=Gm([Ya(),$m(0,Wa(lo)),$m(0,$a(tg)),Ym("design:paramtypes",[Object])],Km);const qm=Symbol.for("IncrementalDrawContribution"),Zm=Symbol.for("ArcRender"),Jm=Symbol.for("AreaRender"),Qm=Symbol.for("CircleRender"),tv=Symbol.for("GraphicRender"),ev=Symbol.for("GroupRender"),iv=Symbol.for("LineRender"),sv=Symbol.for("PathRender"),nv=Symbol.for("PolygonRender"),rv=Symbol.for("RectRender"),av=Symbol.for("SymbolRender"),ov=Symbol.for("TextRender"),lv=Symbol.for("RichTextRender"),hv=Symbol.for("GlyphRender"),cv=Symbol.for("ImageRender"),dv=Symbol.for("DrawContribution"),uv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Tu,!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+=Vt;for(;o<0;)o+=Vt;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 pv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fv=Symbol.for("DrawItemInterceptor"),mv=new Ve,vv=new Ve;class _v{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){mv.copy(s.dirtyBounds),vv.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,qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(mv),s.backupDirtyBounds.copy(vv)),!0}}class yv{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 bv=class{constructor(){this.order=1,this.interceptors=[new _v,new Sv,new xv,new yv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Zu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,s){e(i,s,t)}};const Tv=Symbol.for("RenderService");let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=Av([Ya(),Mv(0,Wa(dv)),kv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(Tv).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=qu.allocateByObj(a),u=new ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=uv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(ju).to(pg),t(Hu).toConstantValue(lf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&Bh.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Ch).to(Eh).inSingletonScope(),co(t,Ch)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=vo.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=Rh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Rp).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,Xl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=vo.global,this.layerService=vo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,Xl.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Tm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Tm.free(n),qu.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||Bh.get(qm);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 h_=class extends nm{constructor(){super(...arguments),this.numberType=Lu}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=wc(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=Up(u,p,c),_=Gp(u,g),y=Vp(c),b=Np(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends dm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Up(u,d,c),f=Vp(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:Xl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Xl.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,Xl.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,Xl.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(tv)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(fv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(ff).toSelf().inSingletonScope(),t(bf).toSelf().inSingletonScope(),t(dv).to(o_),t(qm).to(v_),t(ev).to(Wm).inSingletonScope(),t(tv).toService(ev),co(t,Qp),t(vf).toSelf().inSingletonScope(),co(t,ag),co(t,tv),t(bv).toSelf().inSingletonScope(),t(fv).toService(bv),co(t,fv)}));function y_(){y_.__loaded||(y_.__loaded=!0,Bh.load(Hp),Bh.load(jv),Bh.load(Cv),Bh.load(zv),Bh.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(Bh),function(t){t.load(__)}(Bh))}y_.__loaded=!1,y_();const b_=Bh.get(mo);vo.global=b_;const x_=Bh.get(Pp);vo.graphicUtil=x_;const S_=Bh.get(Bp);vo.transformUtil=S_;const A_=Bh.get(ju);vo.graphicService=A_;const k_=Bh.get(Tv);vo.renderService=k_;const M_=Bh.get(Lp);vo.layerService=M_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class w_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=vo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=vo.global.getRequestAnimationFrame();this.rafId=t((()=>{vo.global.devicePixelRatio!==this.dpr&&(this.dpr=vo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=vo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class C_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,vo.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 E_=new Ve;class B_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let P_;function L_(){!function(){if(null==P_)try{const t=document.createElement("canvas"),e=t.getContext("2d");P_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),P_&&(P_=!!document.createElement)}catch(t){P_=!1}}();const t=vo.global&&vo.global.env;return t?"browser"===t:P_}let R_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};R_._pluginClasses={};const O_="white";class I_ extends wp{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:O_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Mc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=vo.global,!this.global.env&&L_()&&this.global.setEnv("browser"),this.window=Bh.get(dc),this.renderService=Bh.get(Tv),this.pluginService=Bh.get(Vv),this.layerService=Bh.get(Lp),this.graphicService=Bh.get(ju),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:O_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Hc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=R_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=R_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=R_.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 T_))}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 w_))}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 C_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new B_,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=R_.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=R_.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=R_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Bh.get(dc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Bh.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var D_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},F_=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 z_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return F_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};z_=D_([Ya()],z_);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},H_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let V_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};V_=j_([Ya(),H_("design:paramtypes",[])],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},W_=function(t,e){return function(i,s){e(i,s,t)}};let G_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=vo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=wc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&Zu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function Y_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Q_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ny=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ry=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ny(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ny(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ry(n[0],s,i),ry(n[1],e-s,i)}};let ay=!1;const oy=new Ra((t=>{ay||(ay=!0,t(Kf).toSelf().inSingletonScope(),t(Zm).to(Kf).inSingletonScope(),t(tv).toService(Zm),t(qp).toService(vf),co(t,qp))}));let ly=!1;const hy=new Ra((t=>{ly||(ly=!0,t(xm).toSelf().inSingletonScope(),t(rv).to(xm).inSingletonScope(),t(tv).toService(rv),t(Of).toSelf(),t(Rf).toSelf(),t(sg).toService(Of),t(sg).toService(Rf),t(sg).toService(vf),co(t,sg))}));let cy=!1;const dy=new Ra((t=>{cy||(cy=!0,t(nm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(iv).to(nm).inSingletonScope(),t(tv).toService(iv))}));let uy=!1;const py=new Ra((t=>{uy||(uy=!0,t(dm).toSelf().inSingletonScope(),t(Jm).to(dm).inSingletonScope(),t(tv).toService(Jm),t(Zp).toService(vf),co(t,Zp),t(d_).toSelf().inSingletonScope())}));let gy=!1;const fy=new Ra((t=>{gy||(gy=!0,t(Mm).toSelf().inSingletonScope(),t(av).to(Mm).inSingletonScope(),t(tv).toService(av),t(ng).toService(vf),co(t,ng))}));let my=!1;const vy=new Ra((t=>{my||(my=!0,t(Qf).toSelf().inSingletonScope(),t(Qm).to(Qf).inSingletonScope(),t(tv).toService(Qm),t(Jp).toService(vf),co(t,Jp))}));let _y=!1;const yy=new Ra((t=>{_y||(_y=!0,t(ov).to(Pm).inSingletonScope(),t(tv).toService(ov),t(rg).toService(vf),co(t,rg))}));let by=!1;const xy=new Ra((t=>{by||(by=!0,t(vm).toSelf().inSingletonScope(),t(sv).to(vm).inSingletonScope(),t(tv).toService(sv),t(eg).toService(vf),co(t,eg))}));let Sy=!1;const Ay=new Ra((t=>{Sy||(Sy=!0,t(nv).to(Hm).inSingletonScope(),t(tv).toService(nv),t(ig).toService(vf),co(t,ig))}));var ky=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 My=class{constructor(){this.numberType=Eu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};My=ky([Ya()],My);let Ty=!1;const wy=new Ra((t=>{Ty||(Ty=!0,t(hv).to(My).inSingletonScope(),t(tv).toService(hv))}));var Cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ey=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let By=class extends Gf{constructor(){super(),this.numberType=Du,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Up(o,l,!0),d=Up(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};By=Cy([Ya(),Ey("design:paramtypes",[])],By);let Py=!1;const Ly=new Ra((t=>{Py||(Py=!0,t(lv).to(By).inSingletonScope(),t(tv).toService(lv))}));let Ry=!1;const Oy=new Ra((t=>{Ry||(Ry=!0,t(cv).to(Km).inSingletonScope(),t(tv).toService(cv),t(tg).toService(vf),co(t,tg))}));function Iy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),zy=(t,e)=>(d(Hy.warnHandler)&&Hy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),jy=(t,e,i)=>{if(!d(Hy.errorHandler))throw new Error(t);Hy.errorHandler.call(null,t,e)},Hy={silent:!1,warnHandler:!1,errorHandler:!1},Vy=L_(),Ny=Vy&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Vy}function Wy(t){return Gy(t)||"mobile-browser"===t}function Gy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Yy=0;function $y(){return Yy>=9999999&&(Yy=0),Yy++}function Xy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Ky(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Zy extends wp{constructor(t,e){super(t),this._skipRenderAttributes=qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},Mb=(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 Tb extends l{constructor(t,e={}){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.startTime=Ic.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=Ic.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||kb(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=Mb(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=Ic.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=Mb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=kb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Mb(s[0],t){vo.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){if(!this.element)return;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},Cb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Bb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Nl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Wl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Gl),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 qu.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&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&mp.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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Xu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=vo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=vo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Gl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Gl.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&&(Xu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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=ph(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:uh(this,a,this.dpr),r.strokeStyle=ph(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};Bb.env="browser",Bb=wb([Ya(),Cb("design:paramtypes",[Object,Number])],Bb);var Pb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rb=class extends np{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=vo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Bb(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 Ob(t,e){return new Ra((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Rb.env="browser",Rb=Pb([Ya(),Lb("design:paramtypes",[Object])],Rb);const Ib=Ob(Rb,Bb);var Db=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},zb=function(t,e){return function(i,s){e(i,s,t)}};let jb=class extends G_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=lc.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 Vb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};Vb=Hb([Ya()],Vb);const Nb=new Ra(((t,e,i,s)=>{Nb.__vloaded||(Nb.__vloaded=!0,t(Sb).to(Vb).inSingletonScope(),t(Ab).toService(Sb),co(t,Ab))}));Nb.__vloaded=!1;var Ub=Nb;const Wb=new Ra(((t,e,i,s)=>{i(jb)||t(jb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(jb):t(Ev).toService(jb)}));var Gb,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},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xb=Gb=class extends V_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Gb.idprefix}_${Gb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=vo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Gb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Rb(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 Rb({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)}};Xb.env="browser",Xb.idprefix="visactor_window",Xb.prefix_count=0,Xb=Gb=Yb([Ya(),$b("design:paramtypes",[])],Xb);const Kb=new Ra((t=>{t(Xb).toSelf(),t(uc).toDynamicValue((t=>t.container.get(Xb))).whenTargetNamed(Xb.env)}));var qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Jb=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 Qb{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 tx(t,e=!1){const i=document.createElement("img");if(vo.global.isImageAnonymous&&(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 ex=class extends z_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Qb(t)}return new Ve}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 tx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return tx(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:La.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(...t){}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}}loadFont(t,e,i){return Jb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ex=qb([Ya(),Zb("design:paramtypes",[])],ex);const ix=new Ra((t=>{ix.isBrowserBound||(ix.isBrowserBound=!0,t(ex).toSelf().inSingletonScope(),t(fo).toService(ex))}));function sx(t,e=!0){sx.__loaded||(sx.__loaded=!0,t.load(ix),t.load(Ib),t.load(Kb),e&&function(t){t.load(Ub),t.load(Wb)}(t))}ix.isBrowserBound=!1,sx.__loaded=!1;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};let rx=class extends Bb{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}};rx.env="feishu",rx=nx([Ya()],rx);var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let lx=class extends np{constructor(t){super(t)}init(){this._context=new rx(this,this._dpr)}release(...t){}};lx.env="feishu",lx=ax([Ya(),ox("design:paramtypes",[Object])],lx);const hx=Ob(lx,rx);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)}};class px{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 gx=class extends V_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new px}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lx(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 lx({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()}};gx.env="feishu",gx=cx([Ya(),ux(0,Wa(mo)),dx("design:paramtypes",[Object])],gx);const fx=new Ra((t=>{t(gx).toSelf(),t(uc).toDynamicValue((t=>t.container.get(gx))).whenTargetNamed(gx.env)}));var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends G_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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}};yx=mx([Ya(),_x(0,Wa(lo)),_x(0,$a(Jy)),_x(1,Wa(lo)),_x(1,$a(Pv)),_x(2,Wa(lo)),_x(2,$a(Lv)),vx("design:paramtypes",[Object,Object,Object])],yx);const bx=new Ra((t=>{bx.__vloaded||(bx.__vloaded=!0,co(t,Jy))}));bx.__vloaded=!1;var xx=bx;class Sx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:uh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};Tx=Ax([Ya(),Mx(0,Wa(Zm)),kx("design:paramtypes",[Object])],Tx);let wx=!1;const Cx=new Ra(((t,e,i,s)=>{wx||(wx=!0,t(Qy).to(Tx).inSingletonScope(),t(Jy).toService(Qy))}));var Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Lx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};Lx=Ex([Ya(),Px(0,Wa(Jm)),Bx("design:paramtypes",[Object])],Lx);let Rx=!1;const Ox=new Ra(((t,e,i,s)=>{Rx||(Rx=!0,t(tb).to(Lx).inSingletonScope(),t(Jy).toService(tb))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fx=function(t,e){return function(i,s){e(i,s,t)}};let zx=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};zx=Ix([Ya(),Fx(0,Wa(Qm)),Dx("design:paramtypes",[Object])],zx);let jx=!1;const Hx=new Ra(((t,e,i,s)=>{jx||(jx=!0,t(eb).to(zx).inSingletonScope(),t(Jy).toService(eb))}));class Vx{constructor(){this.type="glyph",this.numberType=Eu}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 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},Ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};Gx=Nx([Ya(),Wx(0,Wa(hv)),Ux("design:paramtypes",[Object])],Gx);let Yx=!1;const $x=new Ra(((t,e,i,s)=>{Yx||(Yx=!0,t(hb).to(Gx).inSingletonScope(),t(Gx).toService(hb))}));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};let Kx=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Kx=Xx([Ya()],Kx);let qx=!1;const Zx=new Ra(((t,e,i,s)=>{qx||(qx=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};eS=Jx([Ya(),tS(0,Wa(iv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new Ra(((t,e,i,s)=>{iS||(iS=!0,t(sb).to(eS).inSingletonScope(),t(Jy).toService(sb))}));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},rS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aS=function(t,e){return function(i,s){e(i,s,t)}};let oS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};oS=nS([Ya(),aS(0,Wa(nv)),rS("design:paramtypes",[Object])],oS);let lS=!1;const hS=new Ra(((t,e,i,s)=>{lS||(lS=!0,t(lb).to(oS).inSingletonScope(),t(Jy).toService(lb))}));var cS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uS=function(t,e){return function(i,s){e(i,s,t)}};let pS=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};pS=cS([Ya(),uS(0,Wa(sv)),dS("design:paramtypes",[Object])],pS);let gS=!1;const fS=new Ra(((t,e,i,s)=>{gS||(gS=!0,t(nb).to(pS).inSingletonScope(),t(Jy).toService(nb))})),mS=new Ve;class vS{constructor(){this.type="rect",this.numberType=Iu}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:uh(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;mS.setValue(i.x1,i.y1,i.x2,i.y2),mS.expand(-r/2),h=!mS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},yS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bS=function(t,e){return function(i,s){e(i,s,t)}};let xS=class extends vS{constructor(t){super(),this.canvasRenderer=t}};xS=_S([Ya(),bS(0,Wa(rv)),yS("design:paramtypes",[Object])],xS);let SS=!1;const AS=new Ra(((t,e,i,s)=>{SS||(SS=!0,t(rb).to(xS).inSingletonScope(),t(Jy).toService(rb))}));let kS=!1;const MS=new Ra(((t,e,i,s)=>{kS||(kS=!0,t(ib).to(Kx).inSingletonScope(),t(Kx).toService(ib))}));var TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CS=function(t,e){return function(i,s){e(i,s,t)}};let ES=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}};ES=TS([Ya(),CS(0,Wa(av)),wS("design:paramtypes",[Object])],ES);let BS=!1;const PS=new Ra(((t,e,i,s)=>{BS||(BS=!0,t(ab).to(ES).inSingletonScope(),t(Jy).toService(ab))}));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 RS=class{constructor(){this.type="text",this.numberType=zu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RS=LS([Ya()],RS);let OS=!1;const IS=new Ra(((t,e,i,s)=>{OS||(OS=!0,t(ob).to(RS).inSingletonScope(),t(Jy).toService(ob))})),DS=new Ra(((t,e,i,s)=>{i(yx)||t(yx).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(yx):t(Ev).toService(yx)}));class FS{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 zS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let HS=class extends z_{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 FS(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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};HS=zS([Ya(),jS("design:paramtypes",[])],HS);const VS=new Ra((t=>{VS.isFeishuBound||(VS.isFeishuBound=!0,t(HS).toSelf().inSingletonScope(),t(fo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(hx),t.load(fx),e&&function(t){t.load(xx),t.load(DS),t.load(Cx),t.load(Ox),t.load(Hx),t.load($x),t.load(Zx),t.load(sS),t.load(hS),t.load(fS),t.load(AS),t.load(MS),t.load(PS),t.load(IS)}(t))}VS.isFeishuBound=!1,NS.__loaded=!1;var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GS=class extends Bb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};GS.env="node",GS=US([Ya(),WS("design:paramtypes",[Object,Number])],GS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends np{constructor(t){super(t)}init(){this._context=new GS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};XS.env="node",XS=YS([Ya(),$S("design:paramtypes",[Object])],XS);const KS=Ob(XS,GS);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},ZS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},JS=function(t,e){return function(i,s){e(i,s,t)}};let QS=class extends V_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new XS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new XS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};QS.env="node",QS=qS([Ya(),JS(0,Wa(mo)),ZS("design:paramtypes",[Object])],QS);const tA=new Ra((t=>{t(QS).toSelf(),t(uc).toDynamicValue((t=>t.container.get(QS))).whenTargetNamed(QS.env)}));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};let iA=class extends z_{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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};iA=eA([Ya()],iA);const sA=new Ra((t=>{sA.isNodeBound||(sA.isNodeBound=!0,t(iA).toSelf().inSingletonScope(),t(fo).toService(iA))}));function nA(t,e=!0){nA.__loaded||(nA.__loaded=!0,t.load(sA),t.load(KS),t.load(tA))}sA.isNodeBound=!1,nA.__loaded=!1;var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};lA=rA([Ya(),oA(0,Wa(Zm)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new Ra(((t,e,i,s)=>{hA||(hA=!0,t(cb).to(lA).inSingletonScope(),t(Ab).toService(cb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class extends vS{constructor(t){super(),this.canvasRenderer=t}};gA=dA([Ya(),pA(0,Wa(rv)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new Ra(((t,e,i,s)=>{fA||(fA=!0,t(mb).to(gA).inSingletonScope(),t(Ab).toService(mb))}));class vA extends Gf{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:uh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};xA=_A([Ya(),bA(0,Wa(iv)),yA("design:paramtypes",[Object])],xA);let SA=!1;const AA=new Ra(((t,e,i,s)=>{SA||(SA=!0,t(gb).to(xA).inSingletonScope(),t(Ab).toService(gb))}));var kA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let wA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};wA=kA([Ya(),TA(0,Wa(Jm)),MA("design:paramtypes",[Object])],wA);let CA=!1;const EA=new Ra(((t,e,i,s)=>{CA||(CA=!0,t(db).to(wA).inSingletonScope(),t(Ab).toService(db))}));class BA extends Gf{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&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}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:uh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Zu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};OA=PA([Ya(),RA(0,Wa(av)),LA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new Ra(((t,e,i,s)=>{IA||(IA=!0,t(vb).to(OA).inSingletonScope(),t(Ab).toService(vb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jA=function(t,e){return function(i,s){e(i,s,t)}};let HA=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};HA=FA([Ya(),jA(0,Wa(Qm)),zA("design:paramtypes",[Object])],HA);let VA=!1;const NA=new Ra(((t,e,i,s)=>{VA||(VA=!0,t(ub).to(HA).inSingletonScope(),t(Ab).toService(ub))}));var UA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,s){e(i,s,t)}};let YA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=zu}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=lg(a,u,n),v=og(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&&Zu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};YA=UA([Ya(),GA(0,Wa(ov)),WA("design:paramtypes",[Object])],YA);let $A=!1;const XA=new Ra(((t,e,i,s)=>{$A||($A=!0,t(_b).to(YA).inSingletonScope(),t(Ab).toService(_b))}));var KA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ZA=function(t,e){return function(i,s){e(i,s,t)}};let JA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};JA=KA([Ya(),ZA(0,Wa(sv)),qA("design:paramtypes",[Object])],JA);let QA=!1;const tk=new Ra(((t,e,i,s)=>{QA||(QA=!0,t(fb).to(JA).inSingletonScope(),t(Ab).toService(fb))}));var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sk=function(t,e){return function(i,s){e(i,s,t)}};let nk=class extends Sx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};nk=ek([Ya(),sk(0,Wa(nv)),ik("design:paramtypes",[Object])],nk);let rk=!1;const ak=new Ra(((t,e,i,s)=>{rk||(rk=!0,t(yb).to(nk).inSingletonScope(),t(Ab).toService(yb))}));var ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hk=function(t,e){return function(i,s){e(i,s,t)}};let ck=class extends Vx{constructor(t){super(),this.canvasRenderer=t}};ck=ok([Ya(),hk(0,Wa(hv)),lk("design:paramtypes",[Object])],ck);let dk=!1;const uk=new Ra(((t,e,i,s)=>{dk||(dk=!0,t(xb).to(ck).inSingletonScope(),t(Ab).toService(xb))}));var pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mk=pk([Ya(),fk(0,Wa(lv)),gk("design:paramtypes",[Object])],mk);let vk=!1;const _k=new Ra(((t,e,i,s)=>{vk||(vk=!0,t(bb).to(mk).inSingletonScope(),t(Ab).toService(bb))}));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 Sx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};Sk=yk([Ya(),xk(0,Wa(cv)),bk("design:paramtypes",[Object])],Sk);let Ak=!1;const kk=new Ra(((t,e,i,s)=>{Ak||(Ak=!0,t(pb).to(Sk).inSingletonScope(),t(Ab).toService(pb))})),Mk=L_();function Tk(){Tk.__loaded||(Tk.__loaded=!0,lf.RegisterGraphicCreator("arc",ef),Bh.load(oy),Bh.load(Mk?cA:Cx))}Tk.__loaded=!1;const wk=Tk;function Ck(){Ck.__loaded||(Ck.__loaded=!0,lf.RegisterGraphicCreator("area",Jg),Bh.load(py),Bh.load(Mk?EA:Ox))}Ck.__loaded=!1;const Ek=Ck;function Bk(){Bk.__loaded||(Bk.__loaded=!0,lf.RegisterGraphicCreator("circle",vg),Bh.load(vy),Bh.load(Mk?NA:Hx))}Bk.__loaded=!1;const Pk=Bk;function Lk(){Lk.__loaded||(Lk.__loaded=!0,lf.RegisterGraphicCreator("glyph",Rg),Bh.load(wy),Bh.load(Mk?uk:$x))}Lk.__loaded=!1;const Rk=Lk;function Ok(){Ok.__loaded||(Ok.__loaded=!0,lf.RegisterGraphicCreator("group",Cp))}Ok.__loaded=!1;const Ik=Ok;function Dk(){Dk.__loaded||(Dk.__loaded=!0,lf.RegisterGraphicCreator("image",jg),Bh.load(Oy),Bh.load(Mk?kk:Zx))}Dk.__loaded=!1;const Fk=Dk;function zk(){zk.__loaded||(zk.__loaded=!0,lf.RegisterGraphicCreator("line",wg),Bh.load(dy),Bh.load(Mk?AA:sS))}zk.__loaded=!1;const jk=zk;function Hk(){Hk.__loaded||(Hk.__loaded=!0,lf.RegisterGraphicCreator("path",Kg),Bh.load(xy),Bh.load(Mk?tk:fS))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,lf.RegisterGraphicCreator("polygon",rf),Bh.load(Ay),Bh.load(Mk?ak:hS))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,lf.RegisterGraphicCreator("rect",Pg),Bh.load(hy),Bh.load(Mk?mA:AS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,lf.RegisterGraphicCreator("richtext",Yg),Bh.load(Ly),Bh.load(Mk?_k:MS))}Yk.__loaded=!1;const $k=Yk;function Xk(){Xk.__loaded||(Xk.__loaded=!0,lf.RegisterGraphicCreator("shadowRoot",of))}Xk.__loaded=!1;const Kk=Xk;function qk(){qk.__loaded||(qk.__loaded=!0,lf.RegisterGraphicCreator("symbol",kg),Bh.load(fy),Bh.load(Mk?DA:PS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,lf.RegisterGraphicCreator("text",xg),Bh.load(yy),Bh.load(Mk?XA:IS))}Jk.__loaded=!1;const Qk=Jk;function tM(){Ik(),Gk()}const eM=-.5*Math.PI,iM=1.5*Math.PI,sM="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 nM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nM||(nM={}));const rM={[nM.selectedReverse]:{},[nM.selected]:{},[nM.hover]:{},[nM.hoverReverse]:{}},aM={container:"",width:30,height:30,style:{}},oM="scrollDrag";function lM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const hM={debounce:xt,throttle:St};tM();let cM=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=lM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:hM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(oM,{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",hM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};cM.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};var dM,uM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 pM=dM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=dM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(oM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new cM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(pM)||(t(pM).toSelf(),t(Hv).toService(pM))}));function fM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&fM(t,e)}))}const mM=t=>!u(t)&&!1!==t.visible;function vM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function _M(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 bM=["#ffffff","#000000"];function xM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return SM(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(...bM);for(const n of a)if(t!==n&&SM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function SM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=kM(t),s=kM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function kM(t){const e=si(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 MM(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 TM(t,e){return[t[0]*e,t[1]*e]}function wM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function CM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:sM,fontSize:14},s),getTextBounds:i?void 0:df,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function BM(t,e,i={}){if(!t)return{width:0,height:0};const s=df({text:t,fontFamily:e.fontFamily||i.fontFamily||sM,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 PM(t,e="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 LM(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 RM(t,e="type"){const i=PM(t,e);return"rich"===i?lf.richtext(LM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),lf.text(t))}function OM(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 IM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function DM(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 FM(t,e){const{dx:i,dy:s}=DM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function zM(){Ik(),Gk(),Zk(),$k(),Qk()}var jM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=jM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new zl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},HM.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))}}HM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const VM={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}},NM={poptip:j({},VM)};var UM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}qM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{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={};j(s,qM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new qM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,NM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};JM=ZM([Ya()],JM);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};class tT{constructor(){this.activeEvent="onRegister",this._uid=La.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 eT=class extends tT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};eT=QM([Ya()],eT);let iT=class extends tT{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)}};iT=QM([Ya()],iT);const sT=new Ra(((t,e,i,s)=>{i(JM)||(t(JM).toSelf().inSingletonScope(),t(ag).toService(JM)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT)),i(iT)||(t(iT).toSelf(),t(Hv).toService(iT))}));class nT extends Zy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ik(),jk();class rT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ik(),Gk();class aT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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})}}aT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ik(),wk();class oT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}oT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ik(),wk();class lT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=eM,endAngle:s=iM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}lT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ik(),Vk();class hT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function cT(){Ik(),jk(),Uk(),Zk()}function dT(){Ik(),jk(),wk(),Zk()}hT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cT();class uT extends Zy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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(k(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=lf.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),P(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=lf.line;Y(i)[0].cornerRadius&&(t=lf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=lf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}uT.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}}},dT();class pT extends uT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=lf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var gT,fT;!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"}(gT||(gT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fT||(fT={}));const mT={[fT.selectedReverse]:{},[fT.selected]:{},[fT.hover]:{},[fT.hoverReverse]:{}},vT={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}}},_T={size:8,stroke:"#000",lineWidth:1,zIndex:1};const yT=Math.sin(Math.PI/10);function bT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function xT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function ST(t){const e={};return fM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function AT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function kT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/wM(r))}function MT(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 wT(t,e,i){var s;if(xT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function CT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(nM.hover,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.hoverReverse,!0)})),s):i},BT=(t,e,i)=>i?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),null):i,PT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(nM.selected)?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.selectedReverse),t.removeState(nM.selected))})),null):s.name&&!P(s.states)?(s.addState(nM.selected,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.selectedReverse,!0)})),s):i};class LT extends Zy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const RT={type:"default",duration:300,easing:"linear"};class OT extends LT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=ET(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=lf.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._prepare(),this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(RT)}_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=lf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=gT.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=lf.group({x:0,y:0,pickable:!1});t.name=gT.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=lf.group({x:0,y:0,pickable:!1});i.name=gT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=lf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=gT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=rM;else{const t=this.data[s],e=j({},rM,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=lf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=gT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=rM;else{const i=j({},rM,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=lf.group({x:0,y:0,pickable:!1});return r.name=`${gT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=RM(this._getLabelAttribute(t,e,n,i));if(a.name=gT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=rM;else{const s=j({},rM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new HM(Object.assign({},e));i.name=gT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return AT(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},vT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},fM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const IT={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&&wT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function DT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function FT(t,e,i,s,n=!1){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:IT[n]||IT.parity;if(s.length>=3&&CT(s,r)){do{s=a(s,r)}while(s.length>=3&&CT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);wT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),FT(l,s,n,(t=>wT(t,l,r))),FT(h,s,o,(t=>wT(t,h,r)||!(!n||t===l)&&wT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function jT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},NT(t,e.attribute.angle)),{angle:VT(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({},UT(t,e.attribute.angle)),{angle:VT(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 VT(t=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 NT(t,e=0){let 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=VT(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 UT(t,e=0){let 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=VT(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 WT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=xT(h),m=bT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 GT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class YT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=wM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $T{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-$T.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$T.bounceIn(2*t):.5*$T.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){$T[t]=e}}function XT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$T.quadIn=$T.getPowIn(2),$T.quadOut=$T.getPowOut(2),$T.quadInOut=$T.getPowInOut(2),$T.cubicIn=$T.getPowIn(3),$T.cubicOut=$T.getPowOut(3),$T.cubicInOut=$T.getPowInOut(3),$T.quartIn=$T.getPowIn(4),$T.quartOut=$T.getPowOut(4),$T.quartInOut=$T.getPowInOut(4),$T.quintIn=$T.getPowIn(5),$T.quintOut=$T.getPowOut(5),$T.quintInOut=$T.getPowInOut(5),$T.backIn=$T.getBackIn(1.7),$T.backOut=$T.getBackOut(1.7),$T.backInOut=$T.getBackInOut(1.7),$T.elasticIn=$T.getElasticIn(1,.3),$T.elasticOut=$T.getElasticOut(1,.3),$T.elasticInOut=$T.getElasticInOut(1,.3*1.5),$T.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$T.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$T.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$T[`flicker${t}`]=e=>XT(e,t);for(let t=2;t<10;t++)$T[`aIn${t}`]=e=>t*e*e+(1-t)*e;function KT(t,e,i){return t+(e-t)*i}const qT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=KT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=KT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=KT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=KT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=KT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=KT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=KT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=KT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=KT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=lp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?cp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=lp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?cp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=KT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=KT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=KT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=KT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=KT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=KT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=KT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Zc(e,i,s),r.addUpdateBoundTag()}}};function ZT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$T[s])&&void 0!==n?n:$T.linear:$T.linear,"wait"===t&&(this.onUpdate=JT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=JT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=ap.Get(i,rp.Color255),r=ap.Get(s,rp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(qT["fill"===e?"fillPure":"strokePure"])}else qT[e]?t.push(qT[e]):t.push(ZT)}else qT[e]?t.push(qT[e]):t.push(ZT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tw extends QT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class ew extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Eo.END?this.removeAnimate(t,!0):t.status!==Eo.RUNNING&&t.status!==Eo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const iw=new ew;iw.isGlobal=!0;class sw{constructor(t=La.GenAutoIncrementId(),e=iw,i){this.id=t,this.status=Eo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new QT(Co.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tw(Co.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new QT(Co.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Eo.RUNNING&&(this.status=Eo.PAUSED)}resume(){this.status===Eo.PAUSED&&(this.status=Eo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Eo.END&&this.onEnd(),this.status=Eo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Eo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Eo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Eo.END);this.status=Eo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const nw=new yo;class rw{constructor(){this.released=!1}tick(t,e){nw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class aw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===wo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=wo.INITIAL,vo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),vo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new rw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==wo.INITIAL&&(this.status=wo.PAUSE,!0)}resume(){return this.status!==wo.INITIAL&&(this.status=wo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=wo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===wo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===wo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}lw.getInstance();class hw{static registerBuiltInAnimate(t,e){hw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:hw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:hw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:hw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}hw.builtInAnimateMap={};const cw="appear",dw="disappear",uw="update",pw="highlight",gw="unhighlight";class fw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class mw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=lw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyDisappearState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyUpdateState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyHighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class vw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new mw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new fw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new vw)._getAnimationStateManager(t),t}}class _w{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new sw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:iw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new ew}createTicker(t){return new aw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new hw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function yw(){G(Mp,vw),G(Mp,_w)}class bw extends QT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class xw extends bw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Sw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new hw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Aw(t){return new Sw(t)}class kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Mw=1e3,Tw="quadInOut",ww=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Cw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=lp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ew=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?J_(t):[],n=J_(e);i&&s&&(i.fromTransform&&Q_(s,i.fromTransform.clone().getInverse()),Q_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Pw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Lw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Pw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?ap.Get(t,rp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Rw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ew(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Cw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Ow=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Bw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Lw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Rw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tw);return c.play(d),c};class Iw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ew(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Cw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Dw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ww.includes(t))(i)||(e[i]=t[i])})),e},Fw=(t,e,i)=>{const s=Dw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=vo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},zw=(t,e,i)=>{const s=[],n=i?null:Dw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Dw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Cg(t.attribute),n=ey(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(vo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ey(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ey(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(vo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return iy(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return iy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(vo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:sy(i)}];const s=[];return ry(i,e,s),s})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ry(l,e,h),h})(t,e).forEach((t=>{s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=J_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(vo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(vo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Fw(t,s,e),s};class Hw extends bw{constructor(t,e,i,s,n){super(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(){super.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:Wo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Wo.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:Wo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vw extends Hw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=vo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Nw extends Hw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=vo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Uw extends bw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class $w extends Gw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Xw=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qw extends Kw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Xw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class Zw extends Kw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Jw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Qw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends xw{onBind(){var t;const e=Aw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class xC extends xw{onBind(){const t=Aw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function SC(){Ik(),jk(),$k(),Qk(),hw.registerBuiltInAnimate("axisEnter",bC),hw.registerBuiltInAnimate("axisUpdate",xC)}var AC=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=lf.group({zIndex:999});e.name=gT.axisBreak,e.id=this._getNodeId(`${gT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},_T,s),a=null!==(e=r.size)&&void 0!==e?e:_T.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=lf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=gT.axisBreakSymbol;const h=lf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=gT.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=lf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=gT.background,n.id=this._getNodeId("background"),n.states=j({},mT,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=AC(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];P(l)||(c.state={line:j({},mT,l),symbol:j({},mT,l)});const d=new uT(c);d.name=gT.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=AC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=CM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},mT,c.text),shape:j({},mT,c.shape),panel:j({},mT,c.background)}});return E.angle=w,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 NT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return UT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),HT(i,t),!jT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=xT(a),l=bT(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=GT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=GT(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);k(i)&&(c=Yt(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&&k(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);WT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&zT(t,{orient:o,method:m,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(k(c)&&(!k(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=lf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=gT.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=BM(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=ri(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}}kC.defaultAttributes=vT,G(kC,YT);class MC{isInValidValue(t){const{startAngle:e=eM,endAngle:i=iM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=eM,endAngle:i=iM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return kT(t,i,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 TC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=TC(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 EC=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),k(l)&&l>=3){const t=MT(n,l,c,e,i);h=lf.path(Object.assign(Object.assign({},a.style),{path:TT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=lf.circle(t)}h.name=gT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},mT,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=EC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},mT,d.text),shape:j({},mT,d.shape),panel:j({},mT,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}=TC(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&&wC(e,c,i)}else e.AABBBounds.width()>r&&wC(e,r,i)}else o>a.x&&h.x2>n.x2?(wC(e,n.x2-o,i),r&&CC(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}}BC.defaultAttributes=vT,G(BC,MC);const PC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},RC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{DC[t]=!0}));const VC=t=>-Math.log(-t),NC=t=>-Math.exp(-t),UC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,WC=t=>10===t?UC:t===Math.E?Math.exp:e=>Math.pow(t,e),GC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$C=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function XC(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function KC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function qC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function ZC(t,e,i,s){return 1===i&&(i=0),qC(t,i,s)*(e/(1-i))}function JC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function QC(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]{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 eE{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=JC(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 iE=Symbol("implicit");class sE extends eE{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=IC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iE}clone(){const t=(new sE).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!==iE)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 nE(t,e,r,n)}class aE extends sE{constructor(t){super(),this.type=IC.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=ZC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rE(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 aE(!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:oE}=ni;function lE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=oE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?oE(t,e):e instanceof ei?oE(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):At(Number(t),Number(e))}class hE extends eE{constructor(t=HC,e=HC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=HC,this._piecewise=KC,this._interpolate=lE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?QC:KC,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:HC),this.rescale(i)):this._clamp!==HC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 cE=Math.sqrt(50),dE=Math.sqrt(10),uE=Math.sqrt(2),pE=[1,2,5,10],gE=(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=_E(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?mE(0,-(e-1)/s,s):mE((e-1)/s,0,s)},fE=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 gE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gE(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=mE(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=mE(t,e,l);return n&&r.reverse(),r})),_E=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=pE[0];return i>=cE?s=pE[3]:i>=dE?s=pE[2]:i>=uE&&(s=pE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function yE(t,e,i){const s=(e-t)/Math.max(0,i);return _E(s)}function bE(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;e0;){if(s=yE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function SE(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 AE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),kE=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})),ME=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=vE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?AE(t,e,n):AE(t,e,tE(n)),h=AE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),TE=mt(((t,e,i,s,n)=>bE(s(t),s(e),i).map((t=>tE(n(t))))));class wE extends hE{constructor(){super(...arguments),this.type=IC.Linear}clone(){var t;const e=new wE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=vE(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(t=10){const e=this.calculateVisibleDomain(this._range);return bE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 EE(t){return e=>-t(-e)}function BE(t=Number.EPSILON){return e=>Math.max(e,t)}class PE extends hE{constructor(){super(GC(10),WC(10)),this.type=IC.Log,this._limit=BE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PE).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=GC(this._base),s=WC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=EE(i),this._pows=EE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=VC,this.untransformer=NC):(this._logs=i,this._pows=s,this._limit=BE(),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 HC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return kE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(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))))}}}G(PE,CE);class LE extends wE{constructor(){super(YC(1),$C(1)),this.type=IC.Symlog,this._const=1}clone(){return(new LE).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=YC(t),this.untransformer=$C(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return kE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(LE,CE);class RE{constructor(){this.type=IC.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)&&k(+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 RE).domain(this._domain).range(this._range).unknown(this._unknown)}}function OE(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 IE(t,e,i,s,n=!1){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,n,r;if(!FC(t.type))return PC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return PC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=OE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=OE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=OE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=OC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=OC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?FE.greedy:FE.parity;for(;l.length>=3&&CT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;wT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),IE(t,l,a,(e=>wT(e,t,i))),IE(n,l,o,(e=>wT(e,n,i)||!(!a||e===t)&&wT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return PC(m)},FE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&wT(i,t,e)||(i=t,0))))}},zE=(t,e,i,s)=>{const n=OC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},jE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,HE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?PC([s[s.length-1]]):PC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=zE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=NE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=zE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!jE(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?HE(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=EM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=AT(r,kT(s,r,e,n));return o=a,l=kT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 PC(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=UE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GE(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 PC(c)},GE=(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},YE=new Uint32Array(33),$E=new Uint32Array(33);$E[0]=0,YE[0]=~$E[0];for(let t=1;t<=32;++t)$E[t]=$E[t-1]<<1|1,YE[t]=~$E[t];function XE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&YE[31&o]&$E[1+(31&l)])return!0}else{if(i[h]&YE[31&o])return!0;if(i[c]&$E[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,YE[31&o]&$E[1+(31&l)]);else for(s(h,YE[31&o]),s(c,$E[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,$E[31&a]|YE[1+(31&o)]);else for(n(l,$E[31&a]),n(h,YE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 KE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function qE(t,e,i=!1){return i?KE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function ZE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=qE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=KE(t,r)),e.getRange(r)))}function JE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return JE(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 JE(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 JE(t,e,n,s,h,c)}return!1}const tB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],eB=["top","inside-top","inside"];function iB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const sB={mode:"same-time",duration:300,easing:"linear"};function nB(t){return 3===t||4===t}function rB(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 aB=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 oB(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)}}var lB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const dB=(t,e)=>Math.ceil(t)>Math.floor(e),uB=([t,e],[i,s])=>s>t&&e>i;function pB(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 gB=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||P(e.states)||(e.addState(nM.hover,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(fM(this,(t=>{P(t.states)||(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void fM(this,(t=>{P(t.states)||(t.removeState(nM.selectedReverse),t.removeState(nM.selected))}));P(e.states)||(e.addState(nM.selected,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.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)===Wo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Wo.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(Se(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[oB(g,f,c,d,a,o),oB(-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=lf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new zl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return RM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&dB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&dB(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(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(pB([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])&&!uB([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 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},h),{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(qE(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(qE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(qE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mB[t]=e};var _B=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{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,i,s)}}yB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const bB=()=>{vB("symbol",yB),vB("line-data",yB)};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);n{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}}}SB.tag="rect-label",SB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var AB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};kB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const MB=()=>{vB("line",kB),vB("area",kB)};var TB=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new wB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):nB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=nB(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=nB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=nB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?nB(t.quadrant)?"left":"right":nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 PB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 LB(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=TT(t,!!n),o=TT(r,!!n);const h=re.distancePP(s,l),c=re.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=PB(e,t,!1,!!n),o=PB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=TT(t,!!n),o=TT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}BB.defaultAttributes={pickable:!1};class RB extends Zy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=lf.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 AT(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?`${gT.grid}-sub`:`${gT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=TT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=PB(t,o,!1,!!a)}const u=lf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RB.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=TT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=lf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:RB.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}}RB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ik(),Vk();class OB extends RB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RB.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=eM,endAngle:r=iM}=this.attribute;i=MT(t,s,re.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=j({},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})}}G(OB,YT);var IB=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"})}}G(DB,MC);const FB="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",zB={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:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},jB={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 HB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HB||(HB={}));var VB=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=HB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=lM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===HB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HB.endHandler):h+=l:this._activeTag===HB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=lM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===HB.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===HB.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=VB(c,["formatMethod"]),{formatMethod:g}=d,f=VB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},jB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},jB.horizontal),V),{pickable:!U&&(null===(b=V.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},jB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},jB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},jB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},jB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},jB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},jB.vertical),{pickable:!U}),"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 HM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var WB,GB,YB,$B;function XB(){Ik(),zM(),yw()}UB.defaultAttributes=zB,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"}(WB||(WB={})),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"}(GB||(GB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YB||(YB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($B||($B={}));class KB extends Zy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ET(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=lf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=lf.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=lf.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 qB(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 ZB(t,e,i,s){t&&(qB(t.startSymbol,e,i,s),t.lines.forEach((t=>qB(t,e,i,s))),qB(t.line,e,i,s),qB(t.endSymbol,e,i,s))}function JB(t,e,i,s){t&&(qB(t.getTextShape(),e,i,s),qB(t.getBgRect(),e,i,s))}function QB(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 tP(t,e,i,s){t&&(QB(t.startSymbol,e,i,s),t.lines.forEach((t=>QB(t,e,i,s))),QB(t.line,e,i,s),QB(t.endSymbol,e,i,s))}function eP(t,e,i,s){t&&(QB(t.getTextShape(),e,i,s),QB(t.getBgRect(),e,i,s))}function iP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qB(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)})),qB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;qB(t.getTextShape(),e,l,n),qB(t.getBgRect(),e,l,n)}))}function sP(t,e,i,s,n){ZB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function nP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function rP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function aP(t,e,i,s,n,r){var a;ZB(t,n,s,r),qB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JB(i,n,s,r):qB(i,n,s,r)}function oP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qB(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)})),qB(e,n+o+l,h,r),qB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qB(i.getTextShape(),n+o+l+h+c,d,r),qB(i.getBgRect(),n+o+l+c,d,r)):qB(i,n+o+l+c,d,r)}function lP(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?iP(t,e,s,r,a):"fadeIn"===i&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iP(t,e,s,n,a):"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tP(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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&&rP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function dP(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?aP(n,r,e,i,s,o):"callIn"===t&&oP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aP(n,r,e,i,s,a):"callIn"===t&&oP(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;tP(t,n,s,r),QB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eP(i,n,s,r):QB(i,n,s,r)}(n,r,e,t,i,s)}}const uP={type:"clipIn",duration:500,easing:"linear",delay:0},pP={type:"fadeIn",duration:500,easing:"linear",delay:0},gP={type:"callIn",duration:500,easing:"linear",delay:0},fP={type:"fadeOut",duration:500,easing:"linear",delay:0};class mP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new HM(Object.assign(Object.assign({},h),{state:{panel:j({},rM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},rM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},rM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},rM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class vP extends KB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=fP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;FM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(vP,mP);const _P=.001,yP={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:WB.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]}},bP={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"}}},xP={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:{autoRotate:!0,position:YB.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]}},SP={interactive:!0,label:{position:GB.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}},AP={interactive:!0,label:{autoRotate:!0,position:YB.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}},kP={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"}},MP={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"}},TP={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 wP(){CP._animate=lP}XB(),cT(),yw();class CP extends vP{markerAnimate(t){CP._animate&&this._animationConfig&&CP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(vM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return _M(Math.abs(e),Math.PI/2,_P)||_M(Math.abs(e),3*Math.PI/2,_P)?yM(i,e,t):vM(e)?bP.postiveXAxis[t]:bP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new uT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",CP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(CP.defaultAttributes.label)}}function EP(){BP._animate=hP}CP.defaultAttributes=yP,XB(),Uk(),yw();class BP extends KB{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},MP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=lf.polygon(Object.assign({points:e},i));n.states=j({},rM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",BP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},rM,null==i?void 0:i.area)),this._updateMarkLabels(BP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}BP.defaultAttributes=SP,G(BP,mP),XB(),dT(),yw();class PP extends vP{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case YB.arcInnerStart:l=n;case YB.arcOuterStart:l=n;break;case YB.arcInnerEnd:l=r;case YB.arcOuterEnd:l=r;break;case YB.center:case YB.arcInnerMiddle:case YB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new pT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",PP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(PP.defaultAttributes.label)}}PP.defaultAttributes=xP,XB(),wk(),yw();class LP extends KB{markerAnimate(t){LP._animate&&this._animationConfig&&LP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case YB.center:h=(s+n)/2,c=(r+a)/2;break;case YB.arcInnerStart:h=s,c=r;break;case YB.arcOuterStart:h=n,c=r;break;case YB.arcInnerEnd:h=s,c=a;break;case YB.arcOuterEnd:h=n,c=a;break;case YB.arcInnerMiddle:h=s,c=(r+a)/2;break;case YB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=lf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},rM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",LP.defaultAttributes.label)}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=j({},rM,null==o?void 0:o.area)),this._updateMarkLabels(LP.defaultAttributes.label)}isValidPoints(){return!0}}function RP(){OP._animate=dP}LP.defaultAttributes=AP,G(LP,mP),XB(),cT(),dT(),Zk(),Fk(),jk(),yw();class OP extends KB{markerAnimate(t){OP._animate&&this._animationConfig&&OP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gP,this.defaultExitAnimation=fP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return _M(Math.abs(s),Math.PI/2,_P)||_M(Math.abs(s),3*Math.PI/2,_P)?yM(t,s,n):vM(s)?TP.postiveXAxis[n]:TP.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,style:d,position:u=$B.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},rM,null==p?void 0:p.textBackground),text:j({},rM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},rM,null==p?void 0:p.itemContent));const v=vM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=lf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"text"===n?o=new HM(Object.assign(Object.assign({},i),{state:{panel:j({},rM,null==s?void 0:s.textBackground),text:j({},rM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=lf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"image"===n?(o=lf.image(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},rM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=_M(c,0,_P)||_M(d,0,_P),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=IM(e-u,t-d),o=IM(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(UP.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(UP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===UP.focus||"focus"===o){const s=a.hasState(VP.focus);a.toggleState(VP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover,VP.focus],t),this._setLegendItemState(e,VP.selected,t)})):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover,VP.focus],t),this._setLegendItemState(e,VP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(VP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VP.selected,VP.selectedHover],t),this._setLegendItemState(a,VP.unSelected,t)):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t))}else this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover],t),this._setLegendItemState(e,VP.unSelected,t))}))}this._dispatchLegendEvent(NP.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,VP.selected),this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover])):(this._removeLegendItemState(e,[VP.selected,VP.selectedHover]),this._setLegendItemState(e,VP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=zP,spaceRow:l=jP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=lf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=lf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,UP.item,t,w)):(w=lf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,UP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?VP.selected:VP.unSelected);const C=lf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=lf.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,UP.itemShape,t,w,S.state),s.addState(e?VP.selected:VP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=lf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,UP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=RM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,UP.itemLabel,t,w,A.state),D.addState(e?VP.selected:VP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=RM(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,UP.itemValue,t,w,k.state),r.addState(e?VP.selected:VP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 FP(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 FP(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 cM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new cM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=zP,spaceRow:o=jP}=n,l=this._itemsContainer,{space:h=HP,defaultCurrent:c=1}=r,d=$P(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=lf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=zP,spaceRow:a=jP}=s,o=this._itemsContainer,{space:l=HP,defaultCurrent:h=1}=n,c=$P(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 _=lf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=lf.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(VP.selected)?this._setLegendItemState(t,VP.selectedHover,e):this._setLegendItemState(t,VP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===UP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VP.unSelectedHover)||t.hasState(VP.selectedHover))&&(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VP.unSelectedHover)&&!t.hasState(VP.selectedHover)||(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===UP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NP.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!==UP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NP.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!==UP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},XP,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(VP.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 qP;function ZP(t){return y(t)?t:[t,t]}function JP(t){return t?"ew-resize":"ns-resize"}KP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:zP,spaceRow:jP,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:HP,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"}(qP||(qP={})),GP();class QP 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:j({},QP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:ZP(d)[0],endValue:ZP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=lf.group({x:0,y:0});f.name=qP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=lf.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)),m.name=qP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=lf.group({x:g?v:0,y:g?0:v});f.add(_);const y=lf.group({x:0,y:0});let b;if(y.name=qP.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=lf.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=qP.endText,f.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=lf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=qP.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,f]=ZP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(v.name=qP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=qP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(i.name=qP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=qP.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 f=lf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=qP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":JP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=lf.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=qP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return lf.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":JP(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),lf.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=lf.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=lf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=lM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===qP.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===qP.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===qP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===qP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}QP.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}}},YP(),GP();class tL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function eL(t="bottom"){let 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`}tL.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"}}},YP(),GP(),Vk();class iL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=lf.group({x:0,y:0});this._innerView.add(x);const S=new QP({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:eL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=lf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}iL.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)"}},Ik(),Qk(),$k();let sL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},aM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},aM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};sL.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 nL={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"}}};Ik(),Qk(),$k();let rL=class extends Zy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(nL,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=RM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=BM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 aL extends Ag{constructor(t){super(t)}}var oL,lL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oL||(oL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lL||(lL={}));class hL extends Zy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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"},hL.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"},hL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.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 aL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new aL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new aL(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(oL.OnPlay)},this.pause=()=>{this._dispatchEvent(oL.OnPause)},this.forward=()=>{this._dispatchEvent(oL.OnForward)},this.backward=()=>{this._dispatchEvent(oL.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()}}hL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hL.defaultAttributes={[lL.Start]:{},[lL.Pause]:{},[lL.Backward]:{},[lL.Forward]:{}};const cL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dL=[200,10];var uL,pL;!function(t){t.Default="default",t.Reverse="reverse"}(uL||(uL={})),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"}(pL||(pL={}));const gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),fL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),mL=t=>"top"===t||"bottom"===t;class vL 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:j({},vL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(mL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:dL[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:dL[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 QP(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=mL(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 hL(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=mL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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:mL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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 _L(){GP(),Ik(),Zk()}vL.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({},cL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cL),{key:"backward",position:"start"})}},_L();class yL extends vL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:uL.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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(pL.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(pL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.change),this.dispatchCustomEvent(pL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var bL,xL=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())}))};_L();class SL extends vL{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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change))},this.play=()=>xL(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(pL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.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(pL.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.brushActive="brushActive",t.brushClear="brushClear"}(bL||(bL={}));const AL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},kL=5;const ML={debounce:xt,throttle:St};Ik(),Uk();let TL=class t extends Zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=AL.updateTrigger,endTrigger:i=AL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:ML[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=AL.trigger,resetTrigger:e=AL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(bL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(bL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=kL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(bL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(bL.brushActive,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._dispatchBrushEvent(bL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=kL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=AL.updateTrigger,endTrigger:e=AL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=lf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};TL.defaultAttributes=AL;const wL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},CL=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}},EL={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:sM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},BL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ik(),Gk(),Zk(),Qk(),$k();let PL=class t extends Zy{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=ri(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:mM(u)&&mM(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:mM(u)&&mM(u.value)},CL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:mM(u)&&mM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:mM(u)&&mM(u.value)},CL(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},aM),u.value),visible:mM(u)&&mM(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=mM(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 _=mM(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(!mM(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)+(mM(n.key)?r+n.key.spacing:0)+(mM(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&&(OM(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:mM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),OM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(mM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ed(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(mM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},CL(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},CL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},aM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(mM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},CL(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},CL(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=>BL.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)&&mM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=mM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(mM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(mM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&ru[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 wL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PL.defaultAttributes=EL;const LL=pt;function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function OL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function IL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function DL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function FL(t,e){const i=DL(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 zL(t,e){const i=jL(t),s=jL(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 jL(t,e={x:0,y:0}){return re.distancePP(t,e)}function HL(t){return k(t.x)&&k(t.y)}function VL(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 NL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const UL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function GL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&GL(t[i],e)}}var YL,$L,XL;function KL(t){var e,i;const{type:s}=t;return s===$L.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(YL||(YL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}($L||($L={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(XL||(XL={}));const qL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},ZL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function JL(t,e){var i;if(!t)return[];const s=rR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?sR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>iR(i)?tR(t,i,e):i)).filter(p)}))):i.map((i=>iR(i)?tR(t,i,e):i)).filter(p):[]}return[]}function QL(t,e){var i,s;return sR(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 tR(t,e,i){var s;const n=rR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=qL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=ZL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 eR=(t,e)=>{if(e&&iR(t)){const i=tR(e,t);if(i)return i}return t};function iR(t){return t&&"palette"===t.type&&!!t.key}function sR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function nR(t){return y(t)?{dataScheme:t}:t}function rR(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=KL(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 aR extends sE{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(!sR(this._range))return void super.range(this._range);const t=QL(this._range,this._domain);super.range(t)}}const oR={linear:wE,band:aE,point:class extends aE{constructor(t){super(!1),this.type=IC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sE,threshold:RE,colorOrdinal:aR};function lR(t){const e=oR[t];return e?new e:null}function hR(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 cR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function dR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function uR(t){return!!_(t)&&(!!t.endsWith("%")&&Xy(t.substring(0,t.length-1)))}function pR(t){return!!g(t)&&("percent"in t||"offset"in t)}function gR(t,e,i,s=0){var n,r;return S(t)?t:uR(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 fR(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]=gR(t[s],e.size,i)}))})),o}function mR(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}}function vR(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)||uR(t)||d(t)||pR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function _R(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const yR=(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},bR=[{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"]}];function xR(t,e){return t&&e.key in t?t[e.key]:e.default}function SR(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%"},kR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:bR,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"}}},token:AR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},MR={name:"dark",colorScheme:{default:{dataScheme:bR,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}}}}}},TR=(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]={}),TR(t[s],e.slice(1),i))};function wR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=nR(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)})}CR._charts={},CR._series={},CR._components={},CR._graphicComponents={},CR._marks={},CR._regions={},CR._animations={},CR._implements={},CR._chartPlugin={},CR._vChartPlugin={},CR._componentPlugin={},CR.transforms={fields:Yr,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}},CR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},CR._layout={},CR._grammarTransforms={},CR._stageEventPlugins={},CR.registerStageEventPlugin=(t,e)=>{CR._stageEventPlugins[t]=e},CR.getStageEventPlugin=t=>CR._stageEventPlugins[t],CR._interactionTriggers={},CR.registerInteractionTrigger=(t,e)=>{CR._interactionTriggers[t]=e},CR._composedEventMap={},CR.registerComposedEvent=(t,e)=>{CR._composedEventMap[t]=e},CR._tooltipProcessors={},CR.registerTooltipProcessor=(t,e)=>{CR._tooltipProcessors[t]=e},CR.createTooltipProcessor=(t,e)=>{const i=CR._tooltipProcessors[t];return i?new i(e):null};const PR=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},LR=PR(),RR={[kR.name]:kR},OR=kR.name,IR=new Map(Object.keys(RR).map((t=>[t,RR[t]]))),DR=new Map,FR=new Map(Object.keys(RR).map((t=>[t,t===OR]))),zR=(t,e)=>{if(!t)return;const i=NR(e);IR.set(t,i),FR.set(t,!0)},jR=(t=OR)=>(FR.has(t)&&!FR.get(t)&&zR(t,IR.get(t)),IR.get(t)),HR=t=>IR.delete(t)&&DR.delete(t)&&FR.delete(t),VR=t=>!!_(t)&&IR.has(t),NR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:OR;return ER({},jR(i),t)};class UR{static registerInstance(t){UR.instances.set(t.id,t)}static unregisterInstance(t){UR.instances.delete(t.id)}static getInstance(t){return UR.instances.get(t)}static instanceExist(t){return UR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return UR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}UR.instances=new Map;class WR{static registerTheme(t,e){zR(t,e)}static getTheme(t,e=!1){return jR(t)}static removeTheme(t){return HR(t)}static themeExist(t){return VR(t)}static getDefaultTheme(){return WR.themes.get(OR)}static setCurrentTheme(t){WR.themeExist(t)&&(WR._currentThemeName=t,UR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return WR.getTheme(WR._currentThemeName,t)}static getCurrentThemeName(){return WR._currentThemeName}}function GR(t){return _(t)?WR.themeExist(t)?WR.getTheme(t):{}:g(t)?t:{}}WR.themes=IR,WR._currentThemeName=OR;const YR=["animationThreshold","colorScheme","name","padding"];function $R(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];YR.includes(n)?s[n]=r:m(r)?iR(r)?s[n]=eR(r,e):SR(r)?s[n]=xR(i,r):s[n]=$R(r,e,i):s[n]=r})),s}function XR(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}function KR(t,e){if(!t)return t;if(m(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]=KR(t[s],e)}return i}return y(t)?t.map((t=>KR(t,e))):t}const qR=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:AR.fontFamily,fontSize:AR.fontSize}))(e,i,s).measure(t),ZR="__VCHART",JR=500,QR=500,tO=`${ZR}_MEASURE_CANVAS_ID`,eO=`${ZR}_DEFAULT_DATA_INDEX`,iO=`${ZR}_DEFAULT_DATA_KEY`,sO=`${ZR}_DEFAULT_DATA_SERIES_FIELD`,nO=`${ZR}_DEFAULT_SERIES_STYLE_NAME`,rO=`${ZR}_STACK_KEY`,aO=`${ZR}_STACK_START`,oO=`${ZR}_STACK_END`,lO=`${ZR}_STACK_START_PERCENT`,hO=`${ZR}_STACK_END_PERCENT`,cO=`${ZR}_STACK_START_OffsetSilhouette`,dO=`${ZR}_STACK_END_OffsetSilhouette`,uO=`${ZR}_STACK_TOTAL`,pO=`${ZR}_STACK_TOTAL_PERCENT`,gO=`${ZR}_STACK_TOTAL_TOP`,fO=`${ZR}_STACK_TOTAL_BOTTOM`,mO=`${ZR}_MOSAIC_VALUE_START_PERCENT`,vO=`${ZR}_MOSAIC_VALUE_END_PERCENT`,_O=`${ZR}_MOSAIC_CAT_START_PERCENT`,yO=`${ZR}_MOSAIC_CAT_END_PERCENT`,bO=`${ZR}_SEGMENT_START`,xO=`${ZR}_SEGMENT_END`,SO=`${ZR}_KEY`;function AO(t,e){for(let i=0;it.key===e))}function MO(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 TO(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:{}},PO(t,a,n[o],l,e,r))})),s?wO(n):n}function wO(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))):wO(t[e].nodes);return t}function CO(t,e){if("values"in t&&t.values.length){const i=IL(t.values,e),s=OL(t.values,hO);t.values.forEach((t=>{t[uO]=i,t[pO]=s}))}else for(const i in t.nodes)CO(t.nodes[i],e)}function EO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][oO]/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)BO(t.nodes[r],e,i,s,n)}function PO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[oO]=function(t){if(k(t))return t;const e=+t;return k(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)),PO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const LO=(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]=OO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function IO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>zO(t.style(e,i,s,n)):P(t.style)||(e.style=zO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>zO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=zO(t.state[e]))})),e.state=i}return e}function DO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e,s,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}function FO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),zO(i)}function zO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const jO=t=>"line"===t||"area"===t,HO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return jO(i)?e:null==e?void 0:e[0]},VO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let NO=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},n=CR.getComposedEvent(t);if(n){const e=new n(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(CR.getComposedEvent(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()}};var UO;!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"}(UO||(UO={}));const WO=["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 GO,YO,$O;t.ChartEvent=void 0,(GO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",GO.rendered="rendered",GO.renderFinished="renderFinished",GO.animationFinished="animationFinished",GO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",GO.afterInitData="afterInitData",GO.afterInitEvent="afterInitEvent",GO.afterInitMark="afterInitMark",GO.rawDataUpdate="rawDataUpdate",GO.viewDataFilterOver="viewDataFilterOver",GO.viewDataUpdate="viewDataUpdate",GO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",GO.markDeltaYUpdate="markDeltaYUpdate",GO.viewDataLabelUpdate="viewDataLabelUpdate",GO.scaleDomainUpdate="scaleDomainUpdate",GO.scaleUpdate="scaleUpdate",GO.dataZoomChange="dataZoomChange",GO.drill="drill",GO.layoutStart="layoutStart",GO.layoutEnd="layoutEnd",GO.layoutRectUpdate="layoutRectUpdate",GO.playerPlay="playerPlay",GO.playerPause="playerPause",GO.playerEnd="playerEnd",GO.playerChange="playerChange",GO.playerForward="playerForward",GO.playerBackward="playerBackward",GO.scrollBarChange="scrollBarChange",GO.brushStart="brushStart",GO.brushChange="brushChange",GO.brushEnd="brushEnd",GO.brushClear="brushClear",GO.brushActive="brushActive",GO.legendSelectedDataChange="legendSelectedDataChange",GO.legendFilter="legendFilter",GO.legendItemClick="legendItemClick",GO.legendItemHover="legendItemHover",GO.legendItemUnHover="legendItemUnHover",GO.tooltipShow="tooltipShow",GO.tooltipHide="tooltipHide",GO.tooltipRelease="tooltipRelease",GO.afterResize="afterResize",GO.afterRender="afterRender",GO.afterLayout="afterLayout",GO.afterMarkLayoutEnd="afterMarkLayoutEnd",GO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(YO||(YO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}($O||($O={}));const XO=[$O.mark,$O.model,$O.chart,$O.vchart];class KO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set($O.vchart,[]),this._levelNodes.set($O.chart,[]),this._levelNodes.set($O.model,[]),this._levelNodes.set($O.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 qO={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 ZO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>HO(t)))};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)||YO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||YO.chart);o.get(t)||o.set(t,new KO);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)||YO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||YO.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)||YO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||YO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?XO.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[YO.chart,YO.window,YO.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&&L(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 qO[a]&&(a=qO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?$O.model:$O.vchart:$O.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=YO.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!==$O.model&&s!==$O.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=$O.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 YO.chart:return this._viewBubbles;case YO.window:return this._windowBubbles;case YO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case YO.chart:return this._viewListeners;case YO.window:return this._windowListeners;case YO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return WO.includes(t)||Object.values(UO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&CR.hasInteractionTrigger(e)}}function JO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function QO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const tI=new Map;let eI;function iI(){eI||(eI=new Ta,QO(eI,"geojson",ba),QO(eI,"topojson",Sa),JO(eI,"simplify",Wr))}function sI(t,e,i={type:"geojson",centroid:!0}){tI.has(t)&&zy(`map type of '${t}' already exists, will be overwritten.`),iI();const s=new wa(eI),n=j({},{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}),tI.set(t,s)}function nI(t){tI.has(t)?tI.delete(t):zy(`map type of '${t}' does not exists.`)}function rI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const aI=(t,e)=>0===t.length?[]:1===t.length?rI(t[0],null==e?void 0:e.deep):t.map((t=>rI(t,null==e?void 0:e.deep)));function oI(e,i,s){JO(i=i instanceof Ta?i:e.dataSet,"copyDataView",aI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function lI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return zy(`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 zy(`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([]),zy("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 hI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var cI,dI,uI,pI;t.TransformLevel=void 0,(cI=t.TransformLevel||(t.TransformLevel={}))[cI.copyDataView=-10]="copyDataView",cI[cI.treemapFilter=-8]="treemapFilter",cI[cI.treemapFlatten=-7]="treemapFlatten",cI[cI.dotObjFlat=-7]="dotObjFlat",cI[cI.linkDotInfo=-7]="linkDotInfo",cI[cI.sankeyLayout=-7]="sankeyLayout",cI[cI.dataZoomFilter=-6]="dataZoomFilter",cI[cI.legendFilter=-5]="legendFilter",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"}(dI||(dI={})),function(t){t.data="data",t.mark="mark"}(uI||(uI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(pI||(pI={}));const gI=["line","area","trail"];function fI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(SO,i?t.slice().sort(i):t.slice()),{keys:[SO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const mI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function vI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{vI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function yI(t,e,i,s){const n=fI(t,(t=>i(t))),r=fI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 bI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new I_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Cp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Wy(o))&&!1!==c&&CR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=pI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>vI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>vI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{vI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Fy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===pI.before&&(this._layoutState=pI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=pI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Fy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=_I(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=yI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=yI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=fI(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=fI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===YO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:HO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===YO.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===YO.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===YO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===YO.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===YO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{vI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=_I(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return vu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{vo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{vI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function xI(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:jy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function SI(t){t.crosshair=Y(t.crosshair||{}).map((e=>wR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function AI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Gy(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 kI(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 MI(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}}var TI,wI,CI,EI,BI,PI;t.LayoutZIndex=void 0,(TI=t.LayoutZIndex||(t.LayoutZIndex={}))[TI.SeriesGroup=0]="SeriesGroup",TI[TI.Axis_Grid=50]="Axis_Grid",TI[TI.CrossHair_Grid=100]="CrossHair_Grid",TI[TI.Region=450]="Region",TI[TI.Mark=300]="Mark",TI[TI.Node=400]="Node",TI[TI.Axis=100]="Axis",TI[TI.MarkLine=500]="MarkLine",TI[TI.MarkArea=100]="MarkArea",TI[TI.MarkPoint=500]="MarkPoint",TI[TI.DataZoom=500]="DataZoom",TI[TI.ScrollBar=500]="ScrollBar",TI[TI.Player=500]="Player",TI[TI.Legend=500]="Legend",TI[TI.CrossHair=500]="CrossHair",TI[TI.Indicator=500]="Indicator",TI[TI.Title=500]="Title",TI[TI.Label=500]="Label",TI[TI.Brush=500]="Brush",TI[TI.CustomMark=500]="CustomMark",TI[TI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(wI=t.LayoutLevel||(t.LayoutLevel={}))[wI.Indicator=10]="Indicator",wI[wI.Region=20]="Region",wI[wI.Axis=30]="Axis",wI[wI.DataZoom=40]="DataZoom",wI[wI.Player=40]="Player",wI[wI.ScrollBar=40]="ScrollBar",wI[wI.Legend=50]="Legend",wI[wI.Title=70]="Title",wI[wI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(CI=t.AttributeLevel||(t.AttributeLevel={}))[CI.Default=0]="Default",CI[CI.Theme=1]="Theme",CI[CI.Chart=2]="Chart",CI[CI.Base_Series=3]="Base_Series",CI[CI.Series=4]="Series",CI[CI.Mark=5]="Mark",CI[CI.User_Chart=6]="User_Chart",CI[CI.User_Series=7]="User_Series",CI[CI.User_Mark=8]="User_Mark",CI[CI.User_SeriesStyle=9]="User_SeriesStyle",CI[CI.Built_In=99]="Built_In";class LI{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({},LI.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]))))}}LI.defaultMarkInfo={};class RI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class OI{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=>wR({},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 II extends RI{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=OI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new LI,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new NO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${ZR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=CR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class DI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=fR(vR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:gR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:gR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:gR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:gR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:gR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:gR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=gR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=gR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=gR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(mR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class FI extends II{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,this._transformLayoutPadding=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 DI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 zI extends OI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class jI extends FI{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(e,i){var s;super(e,i),this.transformerConstructor=zI,this.modelType="region",this.specKey="region",this.type=jI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function HI(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 VI(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 NI(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 UI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),NI(d,!0,p,l),s&&VI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function WI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=$I(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=$I(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),NI(d,!1,p,o),s&&VI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function YI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=$I(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=$I(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"left",s),r.length&&UI(r,e,i,!0,"left",s),a.length&&WI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"top",s),r.length&&GI(r,e,i,!0,"top",s),a.length&&YI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&UI(n,e,i,!1,"right",s),r.length&&UI(r,e,i,!0,"right",s),a.length&&WI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=HI(t);n.length&&GI(n,e,i,!1,"bottom",s),r.length&&GI(r,e,i,!0,"bottom",s),a.length&&YI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=$I(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=$I(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:jy)("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}}}XI.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(EI||(EI={})),t.STATE_VALUE_ENUM=void 0,(BI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",BI.STATE_HOVER="hover",BI.STATE_HOVER_REVERSE="hover_reverse",BI.STATE_DIMENSION_HOVER="dimension_hover",BI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",BI.STATE_SELECTED="selected",BI.STATE_SELECTED_REVERSE="selected_reverse",BI.STATE_SANKEY_EMPHASIS="selected",BI.STATE_SANKEY_EMPHASIS_REVERSE="blur",BI.STATE_HIGHLIGHT="highlight",BI.STATE_BLUR="blur",BI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(PI||(PI={}));const KI=["linear","radial","conical"],qI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const ZI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{ZI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class JI extends RI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class QI extends JI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,gI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!ZI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(ZR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(ZR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(FC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class tD extends RI{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=CR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class eD extends tD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const iD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,sD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=iD(l.delay,n,a,o),d=iD(l.duration,n,a,o),u=iD(l.oneByOne,n,a,o),p=iD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Ow(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Bw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Lw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Wo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Rw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mw,null!==(l=i.easing)&&void 0!==l?l:Tw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Wo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Iw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Ow(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},nD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},rD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class aD extends tD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new eD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Cp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new zl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new QI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&wR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zC(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=lR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):KI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):zC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=QL(JL(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({},qI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)KI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=QL(JL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return fI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return CR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[iO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=fI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{rD(t),s.push(...t.getGraphics())})),e.forEach((t=>{rD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);sD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=nD(e,n),r=nD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===dI.exit?dI.exit:i===dI.update?dI.update:dI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===EI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===EI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=EI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=EI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=EI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=dI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=dI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return mI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=mI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=VO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=CR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=CR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===pI.before||(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===EI.exit&&!e.isExiting)if(e.context.animationState===EI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Cp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var oD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(oD||(oD={}));class lD extends aD{constructor(){super(...arguments),this.type=lD.type,this._marks=[],this._diffState=EI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(zy("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?(zy("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))}getMarkInUserId(t){let e;return vI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===EI.update){const t=this.hasAnimation(),e=VO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=EI.update}render(){this._isCommited&&(Fy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}lD.type="group";const hD={measureText:qR};class cD{static instance(){return cD.instance_||(cD.instance_=new cD),cD.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 dD{constructor(){this.id=$y(),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))?zy("不要重复添加相同的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 uD extends dD{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}}const pD={type:"fadeIn"};function gD(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 pD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const fD={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"}},mD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},vD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},_D=()=>{CR.registerAnimation("scaleInOut",(()=>mD))},yD=()=>{CR.registerAnimation("fadeInOut",(()=>vD))},bD=(t,e)=>({appear:gD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Uw,duration:fD.update.duration,easing:fD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),xD=()=>{CR.registerAnimation("line",bD)},SD=()=>{hw.registerBuiltInAnimate("growPointsIn",rC),hw.registerBuiltInAnimate("growPointsOut",aC),hw.registerBuiltInAnimate("growPointsXIn",lC),hw.registerBuiltInAnimate("growPointsXOut",hC),hw.registerBuiltInAnimate("growPointsYIn",dC),hw.registerBuiltInAnimate("growPointsYOut",uC),hw.registerBuiltInAnimate("clipIn",Yw),hw.registerBuiltInAnimate("clipOut",$w)},AD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class kD{constructor(t){this._markSet=new LI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 MD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class TD extends kD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},MD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}TD.type="element-highlight",TD.defaultOptions=MD;const wD=()=>{CR.registerInteractionTrigger(TD.type,TD)},CD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ED extends kD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},CD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}ED.type="element-select",ED.defaultOptions=CD;const BD=()=>{CR.registerInteractionTrigger(ED.type,ED)};class PD extends dD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class LD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>CR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>CR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>CR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return CR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>CR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){CR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}static getFunction(t){return t?cD.instance().getFunction(t):null}static getFunctionList(){return cD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=CR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=CR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,tI.get(e);var e}static registerSVG(t,e,i){const s=CR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=CR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){UR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=$y(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=kI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?CR.getSeriesBuiltInTheme(e):CR.getComponentBuiltInTheme(e);i=i?wR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=$R({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},GL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(v);if(S?sx(Bh):"node"===v&&nA(Bh),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=WR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new bI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new ZO(this,this._compiler),this._event=new NO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),UR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=wR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=XR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;LD.getFunctionList()&&LD.getFunctionList().length&&(t=KR(t,LD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=CR.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=CR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=CR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 AI(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:JR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:QR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,QO(this._dataSet,"dataview",Aa),QO(this._dataSet,"array",s),JO(this._dataSet,"copyDataView",aI);for(const t in CR.transforms)JO(this._dataSet,t,CR.transforms[t]);for(const t in CR.dataParser)QO(this._dataSet,t,CR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?dI.none:dI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,UR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=lI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?wR({},t[n][e.index],i):i):t[n]=s?wR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?wR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?wR({},t[n],i):i)}))}(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=wR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=ER({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=GR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}else{const t=ER({},GR(this._currentThemeName),GR(n),GR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(NM.poptip,VM,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=!!Uy(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.getTheme("background")||this._option.background}getCurrentTheme(){return GR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!WR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 xI(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(!Uy(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?_R(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 zy("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?_R(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(zy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return cD.instance().getFunction(t)}registerFunction(t,e){t&&e&&cD.instance().registerFunction(t,e)}unregisterFunction(t){t&&cD.instance().unregisterFunction(t)}getFunctionList(){return cD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=CR.getChartPlugins();t.length>0&&(this._chartPlugin=new uD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=CR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new PD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}LD.InstanceManager=UR,LD.ThemeManager=WR,LD.globalConfig={uniqueTooltip:!0},LD.Utils=hD,LD.vglobal=b_;CR.registerRegion("region",jI),CR.registerLayout("base",XI),Kk(),Ik(),CR.registerMark(lD.type,lD),CR.registerStageEventPlugin("gesture",Tb),wD(),BD(),zR(MR.name,MR);const RD="monotone",OD="linear",ID="bevel";function DD(t,e){return e("component",t)}function FD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=CR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const zD=(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},jD=(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)))},HD=(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},VD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=FD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ND=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const UD=(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 WD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=YD(VD(h,r,a,c),d,g),o.value=YD(VD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=VD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function GD(t,e,i,s,n,r,a){if(d(e)){WD(t,e(n,a),i,s,r,a)}else e&&WD(t,e,i,s,r,a)}const YD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class $D{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 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=>{y(t)?t.forEach((t=>{GD(a,t,e,i,s,n,r)})):d(t)?GD(a,t,e,i,s,n,r):t&&WD(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:VD(r.visible,t,n),value:YD(VD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:VD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=VD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&UD(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 XD={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}},KD=(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=AO([],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 qD(a,n,o)},qD=(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)=>{Xy(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=>{Xy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=XD[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},ZD=(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=>{Xy(t[e])||(t[e]=0)}))})),t},JD=`${ZR}_HIERARCHY_DEPTH`,QD=`${ZR}_HIERARCHY_ROOT`,tF=`${ZR}_HIERARCHY_ROOT_INDEX`;function eF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function iF(t,e,i){t&&(i.needDefaultSeriesField&&(t[sO]=i.defaultSeriesField),t[eO]=e,t[iO]=i.getKey(t,e,i))}function sF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function nF(t,e,i,s=0,n,r){void 0===r&&(r=e),iF(t,e,i),t[JD]=s,t[QD]=n||t[i.categoryField],t[tF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>nF(e,s,i,t[JD]+1,t[QD],r)))}const rF={label:{name:"label",type:"text"}},aF=`${ZR}_rect_x`,oF=`${ZR}_rect_x1`,lF=`${ZR}_rect_y`,hF=`${ZR}_rect_y1`,cF={data:!0},dF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},uF=[...Object.keys(fD),"normal"];function pF(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 _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=wR({},o[e],a);return _F(n)&&delete n.type,n.oneByOne&&(n=fF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:mF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function gF(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;const i=["custom","customParameters"];return t=I(t,null,i),yF(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}),i),t}(h,i)}function fF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function mF(t,e){var i;return null!==(i=null==t?void 0:t[eO])&&void 0!==i?i:e.context.graphicIndex}function vF(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 _F(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function yF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),yF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),yF(t[s],e,i))}function bF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class xF extends OI{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=KL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=CR.getSeriesMarkMap(o)?function(t,e,i){const s=CR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=wR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return wR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=wR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>wR({},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 SF extends II{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:`${ZR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=xF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=bF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(JO(this._rawData.dataSet,"invalidTravel",ZD),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=lI(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=oI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=oI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new eD(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=qD(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(){JO(this._dataSet,"dimensionStatistics",KD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&AO(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){JO(this._dataSet,"dimensionStatistics",KD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=AO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=pF({},gF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Wy(s)||Gy(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=wR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=wR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=AD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=AD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=AD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:sO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:nO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,nO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new $D(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},cF),dF),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=>dF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||hI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();bF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:sO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new aR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return JL(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:sO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,wR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:iO}_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!==oO&&t!==hO&&t!==aO&&t!==lO||(t=this.getStackValueField()),null!==(e=MO(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=>Xy(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:sO]}}function AF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();FC(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 kF(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}}}SF.mark=rF,SF.transformerConstructor=xF;class MF extends SF{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);FC(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:`${ZR}_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(oO),this.setFieldX2(aO)):(this.setFieldY(oO),this.setFieldY2(aO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(hO),this.setFieldX2(lO)):(this.setFieldY(hO),this.setFieldY2(lO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(dO),this.setFieldX2(cO)):(this.setFieldY(dO),this.setFieldY2(cO))}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(t.ChartEvent.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)&&(AF("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)}}function TF(t){return"bottom"===t||"top"===t}function wF(t){return"left"===t||"right"===t}function CF(t){return"z"===t}function EF(t,e){return dR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function BF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function PF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?TF(t)?"linear":"band":TF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const LF=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):["linear","log","symlog"].includes(e)?DD("axisLinear",i):{})&&void 0!==s?s:{},r=TF(t)?DD("axisX",i):wF(t)?DD("axisY",i):DD("axisZ",i);return wR({},DD("axis",i),n,r)};class RF{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:jy)("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:jy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>jC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return TF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class OF extends RF{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:YO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const IF=(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))},DF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},FF=(t,e,i,s)=>{var n;const r=e.getScale(),a=jC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:zF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,jF=(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};class HF extends RF{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)=>!IF(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:YO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:YO.canvas}),callback:this.onMouseOut}),Wy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:YO.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Wy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var VF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(VF||(VF={}));const NF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class UF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(NF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:ID,curveType:OD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===RD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(NF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:vF(this._spec,NF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${ZR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[NF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(VF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,wR({},this._spec[NF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const WF=Object.assign(Object.assign({},rF),NF),GF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>GF(t,e[i])));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]))},YF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class $F extends aD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return YF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(zC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?GF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:EI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[iO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class XF extends $F{constructor(){super(...arguments),this.type=XF.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)===$L.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}XF.type="line";const KF=()=>{CR.registerMark(XF.type,XF),Kk(),jk(),MB(),bB(),SD(),CR.registerGraphicComponent("line",wg)};class qF extends aD{constructor(){super(...arguments),this.type=qF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}qF.type="symbol";const ZF=()=>{CR.registerMark(qF.type,qF),Kk(),Zk(),bB(),CR.registerGraphicComponent("symbol",kg)};class JF extends xF{_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 QF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function tz(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:!k(o.min),extendable_max:!k(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 ez(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 iz(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 sz(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 nz(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 rz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return PC(v)};class az{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class oz extends az{constructor(){super(oz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&QF(c)&&QF(d)))return;const u=tz(t,c),p=tz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!iz(u,p))return}else if(0===y&&0===b){if(!iz(p,u))return}else if(_||A)if(_&&!A){if(!ez(u,p))return}else if(A&&!_){if(!ez(p,u))return}else{if(f===b)return;if(f>b){if(!sz(u,p))return}else if(!sz(p,u))return}else{if(0===f&&0===y){if(!nz(u,p))return}else if(0===b&&0===g&&!nz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){JO(e.getOption().dataSet,"tickAlign",rz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}oz.pluginType="component",oz.type="AxisSyncPlugin";const lz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function hz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function cz(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 dz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const uz=t=>"band"===t||"ordinal"===t||"point"===t;function pz(t,e){return{id:t,label:t,value:e,rawValue:t}}function gz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class fz extends dD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const mz=`${ZR}_ARC_TRANSFORM_VALUE`,vz=`${ZR}_ARC_RATIO`,_z=`${ZR}_ARC_START_ANGLE`,yz=`${ZR}_ARC_END_ANGLE`,bz=`${ZR}_ARC_K`,xz=`${ZR}_ARC_MIDDLE_ANGLE`,Sz=`${ZR}_ARC_QUADRANT`,Az=`${ZR}_ARC_RADIAN`,kz=-Math.PI/2,Mz=3*Math.PI/2,Tz=.6,wz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Cz=(t,e,i)=>{var s;const n=null!==(s="band"===e?DD("axisBand",i):"linear"===e?DD("axisLinear",i):{})&&void 0!==s?s:{},r=DD("angle"===t?"axisAngle":"axisRadius",i);return wR({},DD("axis",i),n,r)};function Ez(t,e,i,s){switch(t){case r.cartesianBandAxis:return LF(EF(i,["z"]),"band",e);case r.cartesianLinearAxis:return LF(EF(i,["z"]),"linear",e);case r.cartesianLogAxis:return LF(EF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LF(EF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LF(EF(i),void 0,e);case r.polarBandAxis:return Cz(i.orient,"band",e);case r.polarLinearAxis:return Cz(i.orient,"linear",e);case r.polarAxis:return Cz(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>TF(t.orient)));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>wF(t.orient)));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=DD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?wR({},uz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?wR({},jC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Bz(i,DD(t,e));default:return DD(t,e)}}const Bz=(t,e)=>{var i;const s=wR({},e,e[BF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Pz extends OI{getTheme(t,e){return Ez(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({},vR(e)),{[s]:0}))}}class Lz extends FI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Pz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:YO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Rz,Oz;Lz.transformerConstructor=Pz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Rz||(Rz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Oz||(Oz={}));class Iz extends aD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=CR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(UO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Iz.type="component";const Dz=()=>{CR.registerMark(Iz.type,Iz)},Fz=t=>t;class zz extends Lz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Rz.circleAxis:Rz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Oz.circleAxisGrid:Oz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=pF(null===(h=CR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new eD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return VL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?FC(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 VL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=NL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(VL(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=IO(s=t.domainLine)).startSymbol=IO(s.startSymbol),s.endSymbol=IO(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 zO(wR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:zO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>zO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=zO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 zO(wR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:zO(t.tick.style)),t.tick.state&&(i.tick.state=DO(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 zO(wR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:zO(t.subTick.style)),t.subTick.state&&(i.subTick.state=DO(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=lz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:wR({},d,zO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:zO(h.style)}),h.state&&(i.title.state.shape=DO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:zO(o.style)}),o.state&&(i.title.state.background=DO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=DO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=zO(t.background.style)),t.background.state&&(i.panel.state=DO(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 zO(wR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:zO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:zO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=FD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){QO(this._option.dataSet,"scale",Fz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===gT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}zz.specKey="axes";const jz=()=>{Dz(),CR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Hz=[oz];class Vz extends zz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),VL(this._regions,(t=>{const e=this.getOrient();TF(e)?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wF(e)?gz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):CF(e)&&gz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=wR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(wR({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=TF(this.getOrient()),n=t=>{var e;return(s?!TF(t.getOrient()):TF(t.getOrient()))&&FC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=EF(i,["z"]),CF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!dz(e))return null;const{axisType:t,componentName:s}=PF(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=>wF(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(!dz(t))return;const{axisType:s,componentName:n}=PF(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=CR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return TF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):CF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(Hz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){TF(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&&!TF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!CF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;wF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=TF(this.getOrient())?t.fieldX:CF(this.getOrient())?t.fieldZ:t.fieldY,FC(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:FC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(UO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(TF(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=TF(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)}))}collectScale(){const t=[];return VL(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]:TF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:CF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();VL(this._regions,(e=>{TF(t)?gz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):wF(t)?gz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):CF(t)&&gz(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=TF(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=TF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=wR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=TF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return pz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Vz.type=r.cartesianAxis,Vz.specKey="axes";const Nz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Uz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Gz=(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 Yz(t,e,i="count"){const s=Gz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $z=Math.sqrt(50),Xz=Math.sqrt(10),Kz=Math.sqrt(2);class qz{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=cz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=TF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Wz),e.sort(Wz),{domain:Uz(t,e),scope:Yz(t,e,i)}}(r,Iy(t),this._spec.breaks[0].scopeType);e=Iy(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}=cz(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>=$z?10:n>=Xz?5:n>=Kz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const Zz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Jz={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}}},Qz={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}}},tj={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}}};class ej extends Vz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!CF(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=TF(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=uR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Iy(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 JO(this._option.dataSet,t,DE),t}}ej.type=r.cartesianLinearAxis,ej.specKey="axes",ej.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(ej,qz);const ij=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(ej.type,ej)};class sj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new eD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=pz(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=>pz(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 nj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class rj extends Vz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,VE),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=ZC(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{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(rj.type,rj,!1)};class oj extends ej{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{TF(this.getOrient())?gz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):gz(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=wR({},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 wa(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 eD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>pz(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=>pz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}oj.type=r.cartesianTimeAxis,oj.specKey="axes",oj.builtInTheme={axis:tj,axisX:Jz,axisY:Qz};class lj extends ej{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}lj.type=r.cartesianLogAxis,lj.specKey="axes",lj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(lj,qz);class hj extends ej{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LE}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 JO(this._option.dataSet,t,DE),t}transformScaleDomain(){}}hj.type=r.cartesianSymlogAxis,hj.specKey="axes",hj.builtInTheme={axis:tj,axisLinear:Zz,axisX:Jz,axisY:Qz},G(hj,qz);const cj=`${ZR}_hide_`;function dj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const uj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[cj]&&(dj(t,!0),t[cj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[cj]=!0,dj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},pj=()=>{CR.registerGrammarTransform("symbolOverlap",{transform:uj,runType:"afterEncode"})},gj={min:K,max:X,average:DL,sum:IL};function fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function mj(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 vj(t,e,i,s){return mj(t,e,i,"min",s)}function _j(t,e,i,s){return mj(t,e,i,"max",s)}function yj(t,e,i,s){return mj(t,e,i,"average",s)}function bj(t,e,i,s){return mj(t,e,i,"sum",s)}const xj=(t,e)=>{let i=d(t.size)?t.size():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=fj;if("min"===n?l=vj:"max"===n?l=_j:"average"===n?l=yj:"sum"===n&&(l=bj),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[]},Sj=()=>{CR.registerGrammarTransform("dataSampling",{transform:xj})};class Aj extends MF{constructor(){super(...arguments),this.type=$L.line,this.transformerConstructor=JF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(pF(null===(i=CR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),gF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Aj.type=$L.line,Aj.mark=WF,Aj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Aj.transformerConstructor=JF,G(Aj,UF);class kj{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)=>{hI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];zy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];zy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Mj{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)=>{Ky(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{AO(e,[{key:t,operations:FC(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&&AO(e,[{key:i.field,operations:FC(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?lR("colorOrdinal"):lR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Ky(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Ky(s.domain)?e.reRender=!0:U(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(!Ky(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=FC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=FC(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;FC(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(FC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=FC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));FC(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 Tj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class wj extends RI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:JR,height:QR},this._viewRect={width:JR,height:QR},this._viewBox={x1:0,y1:0,x2:JR,y2:QR},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=vR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new NO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new kj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Tj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=CR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=CR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=CR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof II)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 aD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof aD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&hI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=AI(this._spec,this._option,{width:JR,height:QR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=JL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Mj(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){kI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=JL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{kI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,kI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):kI(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()];kI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=fR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(UO.AFTER_MARK_RENDER_END,e)};this._event.on(UO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:HO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(jO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===VF.dimensionHover||s===VF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>jC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Cj=(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 Ej{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):TR(t,a,c.spec),TR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Cj(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=Cj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(CR.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(CR.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=CR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=CR.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=CR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):zD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=zD(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"];return 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}))}_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 Bj extends Ej{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&wR(i,MI(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 Pj extends Bj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),SI(t)}}const Lj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=TO(t,!0);for(const e in o)for(const i in o[e].nodes)BO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)EO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&CO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Oj{_beforeInit(){this._dataSet&&JO(this._dataSet,"stackSplit",Lj)}_initStack(){this._stack=new Rj(this),this._stack.init()}}const Ij={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:VF.dimensionHover};class Dj extends kD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Ij,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=HO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Dj.type="dimension-hover",Dj.defaultOptions=Ij;const Fj=()=>{CR.registerInteractionTrigger(Dj.type,Dj)},zj=()=>{CR.registerComposedEvent(VF.dimensionHover,HF),CR.registerComposedEvent(VF.dimensionClick,OF)},jj=t=>t.fieldX[0],Hj=t=>t.fieldY[0],Vj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Nj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Uj=(t,e)=>t?e?jj:Vj:e?Hj:Nj,Wj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=jF(t,(t=>TF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=jF(t,(t=>wF(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=>{jC(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=Gj(t,i,Uj(e,jC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Gj(t,i,Uj(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},Gj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Yj(t,s,i)},Yj=(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=FF(e,t,"cartesian",null!=i?i:TF(t.getOrient())?jj:Hj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},$j=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(jC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(FC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=hz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Kj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&Xj(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),Xj=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=FD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Kj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},qj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=Zj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},Zj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Jj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return $j(c,r,e),c.xField.cacheInfo?qj(c.xField):c.yField.cacheInfo?qj(c.yField):void 0},Qj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],tH=(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])&&Qj.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(eH(s).every((t=>{var e;return!UD("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},eH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},iH={dom:`${ZR}_TOOLTIP_HANDLER_DOM`,canvas:`${ZR}_TOOLTIP_HANDLER_CANVAS`},sH={key:"其他",value:"..."};var nH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(nH||(nH={}));class rH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=tH(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({},sH),t):sH;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)&&UD(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 aH extends rH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!jC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const oH=()=>{CR.registerTooltipProcessor("dimension",aH)};class lH extends rH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Uo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(HO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const hH=()=>{CR.registerTooltipProcessor("mark",lH)};class cH extends rH{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 dH=()=>{CR.registerTooltipProcessor("group",cH)};class uH extends wj{constructor(){super(...arguments),this.transformerConstructor=Pj,this.type="line",this.seriesType=$L.line}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}uH.type="line",uH.seriesType=$L.line,uH.transformerConstructor=Pj,G(uH,Oj);const pH=[...YF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class gH extends $F{constructor(){super(...arguments),this.type=gH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return pH}_getIgnoreAttributes(){return[]}}gH.type="area";const fH=()=>{CR.registerMark(gH.type,gH),Kk(),Ek(),MB(),bB(),SD(),CR.registerGraphicComponent("area",Jg)};class mH extends $D{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 vH=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}}),_H=()=>{CR.registerAnimation("area",bD),xD(),_D()};class yH extends JF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=wR({},f.style,g.style),l.state=wR({},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 bH extends MF{constructor(){super(...arguments),this.type=$L.area,this.transformerConstructor=yH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(bH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===RD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return hR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[oO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(pF(null===(e=CR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),gF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),gF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=kF(this);this._symbolMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),gF("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 mH(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(){super.onLayoutEnd(),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}}}bH.type=$L.area,bH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},bH.mark=vH,bH.transformerConstructor=yH,G(bH,UF);class xH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(t)}}class SH extends wj{constructor(){super(...arguments),this.transformerConstructor=xH,this.type="area",this.seriesType=$L.area}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}SH.type="area",SH.seriesType=$L.area,SH.transformerConstructor=xH,G(SH,Oj);function AH(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 kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:AH(t,e)}),MH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:AH(t,e)}),TH={type:"fadeIn"},wH={type:"growCenterIn"};function CH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return TH;case"scaleIn":return wH;default:return kH(t)}}class EH extends aD{constructor(){super(...arguments),this.type=EH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}EH.type="rect";const BH=()=>{Kk(),Gk(),vB("rect",SB),CR.registerMark(EH.type,EH),hw.registerBuiltInAnimate("growHeightIn",eC),hw.registerBuiltInAnimate("growHeightOut",iC),hw.registerBuiltInAnimate("growWidthIn",_C),hw.registerBuiltInAnimate("growWidthOut",yC),hw.registerBuiltInAnimate("growCenterIn",Jw),hw.registerBuiltInAnimate("growCenterOut",Qw),CR.registerGraphicComponent("rect",Pg)},PH=Object.assign(Object.assign({},rF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function LH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=yR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):hR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[oF]):hR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=hR(this._dataToPosX(t),e,i),n=hR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):hR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[hF]):hR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=hR(this._dataToPosY(t),e,i),n=hR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:vF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(JO(this._option.dataSet,"addVChartProperty",HD),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};JO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new eD(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=hF,s=lF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=oF,s=aF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=TO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)LH(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=hR(this[r](t),l,i),u=hR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[aO],n=t[oO],r=t[lO],h=t[hO];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]),{[aO]:i,[oO]:s}),a?{[lO]:o,[hO]: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(Pg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>hR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>hR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=kF(this);this._barMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),gF(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=yR(this._spec.barWidth,a)),l&&(c=Math.max(c,yR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,yR(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=yR(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=FC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}IH.type=$L.bar,IH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},IH.mark=PH,IH.transformerConstructor=OH;const DH=()=>{Sj(),BH(),CR.registerAnimation("bar",((t,e)=>({appear:CH(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t)}))),aj(),ij(),CR.registerSeries(IH.type,IH)};class FH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),SI(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 zH extends wj{constructor(){super(...arguments),this.transformerConstructor=FH,this.type="bar",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}zH.type="bar",zH.seriesType=$L.bar,zH.transformerConstructor=FH,G(zH,Oj);const jH=[10,20],HH=IC.Linear,VH="circle",NH=IC.Ordinal,UH=["circle","square","triangle","diamond","star"],WH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},GH=Object.assign(Object.assign({},rF),{point:{name:"point",type:"symbol"}});class YH extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class $H extends MF{constructor(){super(...arguments),this.type=$L.scatter,this.transformerConstructor=YH,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=`${ZR}_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=`${ZR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:HH,defaultRange:jH},"size")}getShapeAttribute(t,e){return u(e)?VH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:NH,defaultRange:UH},"shape")}initMark(){this._symbolMark=this._createMark($H.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,$H.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=kF(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(pF(null===(i=CR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),gF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:VH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}$H.type=$L.scatter,$H.mark=GH,$H.builtInTheme={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"}}}}},$H.transformerConstructor=YH;const XH=()=>{ZF(),CR.registerAnimation("scatter",((t,e)=>Object.assign({appear:WH(0,e)},mD))),aj(),ij(),CR.registerSeries($H.type,$H)};class KH extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class qH extends wj{constructor(){super(...arguments),this.transformerConstructor=KH,this.type="scatter",this.seriesType=$L.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}qH.type="scatter",qH.seriesType=$L.scatter,qH.transformerConstructor=KH,G(qH,Oj);class ZH extends SF{constructor(){super(...arguments),this.type=$L.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=`${ZR}_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 JH=`${ZR}_MAP_LOOK_UP_KEY`,QH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[eO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[JH]=e.nameMap[n]:t[JH]=n})),t.features);class tV extends $D{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 eV extends aD{constructor(){super(...arguments),this.type=eV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}eV.type="path";const iV=()=>{CR.registerMark(eV.type,eV),Kk(),Vk(),CR.registerGraphicComponent("path",Kg)},sV=Object.assign(Object.assign({},rF),{area:{name:"area",type:"path"}});class nV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 rV{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(){}}class aV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 oV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:rV}:Wy(e)||Gy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:aV}:null}const lV={debounce:xt,throttle:St};class hV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Wy(this._renderMode)||Gy(this._renderMode),oV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return oV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,lV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:$O.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:$O.chart,consume:!1}];l.on(...c,lV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,lV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){oV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||oV(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:$O.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:$O.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||oV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:$O.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||oV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:$O.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=lV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=lV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:$O.chart})}));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:$O.chart,source:YO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:$O.chart,source:YO.chart},this._handleDragMouseUp)}))}}function cV(t,e){return`${ZR}_${e}_${t}`}class dV extends Lz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:cV(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=wR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 nV(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===$L.map||e.type===$L.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),VL(this._regions,(t=>{var e;if(t.type===$L.map||t.type===$L.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==$L.map&&e.type!==$L.pictogram||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[JH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}dV.type=r.geoCoordinate,G(dV,hV);const uV=()=>{CR.registerComponent(dV.type,dV)};class pV extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class gV extends ZH{constructor(){super(...arguments),this.type=$L.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 !`),tI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),JO(this._dataSet,"copyDataView",aI),JO(this._dataSet,"map",QH),JO(this._dataSet,"lookup",jD);const s=tI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:JH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(gV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:vF(this._spec,gV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:sO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:sO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(pF(null===(t=CR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),gF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[eO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[eO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 eO}getActiveMarks(){return[this._pathMark]}}gV.type=$L.map,gV.mark=sV,gV.builtInTheme={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"}}}}},gV.transformerConstructor=pV;const fV=`${ZR}_waterfall_default_seriesField`,mV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[gO]=!0:delete t[gO]})),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=vV([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 f=g[0];let{start:m,end:v}=_V(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(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=vV(a,t,n,r,h,l,i,e),r.push(n)})),r};function vV(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}=_V(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===fV)&&(t[fV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function _V(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?zy("total.collectCountField error"):n=e[a].start;o<0?zy("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=ie(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 yV=(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)=>ie(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},bV={type:"fadeIn"},xV={type:"growCenterIn"};function SV(t,e){switch(e){case"fadeIn":return bV;case"scaleIn":return xV;default:return kH(t,!1)}}class AV extends aD{constructor(){super(...arguments),this.type=AV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}AV.type="rule";const kV=()=>{CR.registerMark(AV.type,AV),Kk(),jk(),CR.registerGraphicComponent("line",wg)},MV=Object.assign(Object.assign({},PH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),TV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:wV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function wV(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)=>wV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class CV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),JO(e,"dimensionTree",TV),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 EV extends OH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const BV={rect:DV,symbol:OV,arc:zV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=OV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:jV,line:HV,area:HV,rect3d:DV,arc3d:zV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function PV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=BV[t])&&void 0!==i?i:BV.point;return e.series.type===$L.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=RV(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:VV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function LV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==$L.sankey){const{formatFunc:t,args:n}=FD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function RV(t){return d(t)?e=>t(e.data):t}function OV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=RV(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:IV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function IV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function DV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=RV(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:FV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function FV(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 zV(t){var e;const{labelSpec:i}=t,s=null!==(e=RV(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 jV(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=LV(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),xg(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 HV(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}))):[{index:0,[sO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function VV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class NV extends IH{constructor(){super(...arguments),this.type=$L.waterfall,this.transformerConstructor=EV,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 CV(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=fV)}getSeriesKeys(){return this._seriesField===fV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),JO(this._dataSet,"waterfallFillTotal",yV),JO(this._dataSet,"waterfall",mV),(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=oI(this.getViewData(),this._dataSet,{name:`${ZR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new eD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:aO,endAs:oO,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=kF(this);this._barMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),gF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("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(){super.initMark();const t=this._createMark(NV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return jV(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?hR(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):hR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}NV.type=$L.waterfall,NV.mark=MV,NV.builtInTheme={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}}}},NV.transformerConstructor=EV;const UV=()=>{kV(),BH(),CR.registerAnimation("waterfall",((t,e)=>({appear:SV(t,e),enter:kH(t,!1),exit:MH(t,!1),disappear:MH(t,!1)}))),yD(),aj(),ij(),CR.registerSeries(NV.type,NV)},WV=`${ZR}_BOX_PLOT_OUTLIER_VALUE`;var GV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(GV||(GV={}));const YV=(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={[WV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class $V extends $D{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return this.series.getOutliersField();if(t===GV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case GV.MIN:return this.series.getMinField();case GV.MAX:return this.series.getMaxField();case GV.MEDIAN:return this.series.getMedianField();case GV.Q1:return this.series.getQ1Field();case GV.Q3:return this.series.getQ3Field();case GV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===GV.OUTLIER)return e[WV];if(t===GV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case GV.MIN:return e[this.series.getMinField()];case GV.MAX:return e[this.series.getMaxField()];case GV.MEDIAN:return e[this.series.getMedianField()];case GV.Q1:return e[this.series.getQ1Field()];case GV.Q3:return e[this.series.getQ3Field()];case GV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[WV])}getDefaultContentList(t){return[{key:this.getContentKey(GV.OUTLIER),value:this.getContentValue(GV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(GV.MAX),value:this.getContentValue(GV.MAX)},{key:this.getContentKey(GV.Q3),value:this.getContentValue(GV.Q3)},{key:this.getContentKey(GV.MEDIAN),value:this.getContentValue(GV.MEDIAN)},{key:this.getContentKey(GV.Q1),value:this.getContentValue(GV.Q1)},{key:this.getContentKey(GV.MIN),value:this.getContentValue(GV.MIN)},{key:this.getContentKey(GV.SERIES_FIELD),value:this.getContentValue(GV.SERIES_FIELD)}]}}class XV extends aD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==EI.enter&&t.context.diffState!==EI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=CR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const KV=()=>{CR.registerGraphicComponent("glyph",Rg),Kk(),Rk()},qV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],ZV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class JV extends XV{constructor(){super(...arguments),this.type=JV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=ZV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}JV.type="boxPlot";const QV=Object.assign(Object.assign({},rF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},eN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},iN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=iN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=iN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=iN(t,"box").attribute.width,i=iN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=iN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=iN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=iN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=iN(t,"box").attribute.height,i=iN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},nN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=iN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=iN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=iN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=iN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=iN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=iN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=iN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=iN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=iN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=iN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class rN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return eN(sN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class oN extends rN{computeAttribute(){return tN(nN)(this.target,this.params,this.params.options)}}class lN extends aN{computeAttribute(){return eN(nN)(this.target,this.params,this.params.options)}}class hN extends MF{constructor(){super(...arguments),this.type=$L.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(){this._boxPlotMark=this._createMark(hN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(hN.mark.outlier,{key:eO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>hR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>hR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>hR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>hR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>hR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>hR(e(this.getDatumPositionValues(t,WV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;JO(this._dataSet,"foldOutlierData",YV),JO(this._dataSet,"addVChartProperty",HD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${ZR}_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:eF.bind(this),call:iF}},!1),this._outlierDataView=new eD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=kF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=CR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(gF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(pF(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(pF(null===(a=CR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new $V(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]}}hN.type=$L.boxPlot,hN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},hN.mark=QV;const cN=()=>{KV(),jk(),Gk(),CR.registerGraphicComponent("line",(t=>wg(t))),CR.registerGraphicComponent("rect",(t=>Pg(t))),CR.registerMark(JV.type,JV),ZF(),_D(),aj(),ij(),hw.registerBuiltInAnimate("boxplotScaleIn",rN),hw.registerBuiltInAnimate("boxplotScaleOut",aN),hw.registerBuiltInAnimate("barBoxplotScaleIn",oN),hw.registerBuiltInAnimate("barBoxplotScaleOut",lN),CR.registerSeries(hN.type,hN)};class dN extends aD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=dN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Yg(t):xg(t)}}dN.type="text";const uN=()=>{CR.registerMark(dN.type,dN),Kk(),Qk(),$k(),CR.registerGraphicComponent("text",xg),CR.registerGraphicComponent("richtext",Yg)};class pN extends $D{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 gN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),fN={type:"fadeIn"},mN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function vN(t,e){return"fadeIn"===e?fN:gN(t)}const _N=Object.assign(Object.assign({},PH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class yN extends OH{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 bN extends IH{constructor(){super(...arguments),this.type=$L.rangeColumn,this._barMarkType="rect",this._barName=$L.bar,this.transformerConstructor=yN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(bN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,bN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(bN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(bN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=kF(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(pF(null===(i=CR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),gF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(pF(null===(n=CR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),gF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new pN(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)}}bN.type=$L.rangeColumn,bN.mark=_N,bN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},bN.transformerConstructor=yN;const xN=()=>{BH(),uN(),CR.registerAnimation("rangeColumn",((t,e)=>({appear:vN(t,e),enter:gN(t),exit:mN(t),disappear:mN(t)}))),yD(),aj(),ij(),CR.registerSeries(bN.type,bN)};var SN,AN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(SN||(SN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(AN||(AN={}));class kN extends $D{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 MN=Object.assign({},vH);class TN extends bH{constructor(){super(...arguments),this.type=$L.rangeArea}initMark(){this._areaMark=this._createMark(TN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new kN(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))}}TN.type=$L.rangeArea,TN.mark=MN;class wN extends SF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Tz,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:[]};FC(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:[]};FC(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(t.ChartEvent.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)&&AF(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 CN(t){return Xy(t)?Number.parseFloat(t):0}const EN=(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&&BN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[mz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[mz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},BN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===CN(t[e])))||!i&&0===t.reduce(((t,i)=>t+CN(i[e])),0)));function PN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:PN(t,!0,dI.appear)}),RN={type:"fadeIn"},ON=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:PN(t,!0,dI.enter)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:PN(t,!0,dI.exit)}),DN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:PN(t,!0,dI.exit)});function FN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return RN;case"growRadius":return LN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class zN extends aD{constructor(t,e){super(t,e),this.type=jN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[xz])[t]+s,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 jN extends zN{constructor(){super(...arguments),this.type=jN.type}}jN.type="arc";const HN=()=>{Kk(),wk(),vB("arc",CB),hw.registerBuiltInAnimate("growRadiusIn",fC),hw.registerBuiltInAnimate("growRadiusOut",mC),hw.registerBuiltInAnimate("growAngleIn",qw),hw.registerBuiltInAnimate("growAngleOut",Zw),CR.registerGraphicComponent("arc",ef),CR.registerMark(jN.type,jN)},VN=Object.assign(Object.assign({},rF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class NN extends xF{_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=wR({},this._theme,i,t);const n=(t,e)=>wR({},"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 UN=`${ZR}_LABEL_VISIBLE`;class WN extends wN{constructor(){super(...arguments),this.transformerConstructor=NN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:gR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:gR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kz,this._endAngle=Mz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[xz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;JO(this._dataSet,"pie",EN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:_z,asEndAngle:yz,asRatio:vz,asMiddleAngle:xz,asRadian:Az,asQuadrant:Sz,asK:bz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new eD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},WN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return WL(_z)(t)}endAngleScale(t){return WL(yz)(t)}_computeLayoutRadius(){return wz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:cR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:cR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:WL(UN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[xz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===dI.appear)return this._startAngle;if(i===dI.disappear)return this._endAngle;const r=[dI.disappear,dI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[eO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[eO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[xz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[xz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=pF(null===(i=CR.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]}}WN.transformerConstructor=NN,WN.mark=VN,WN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class GN extends WN{constructor(){super(...arguments),this.type=$L.pie}}GN.type=$L.pie;const YN=()=>{HN(),CR.registerAnimation("pie",((t,e)=>({appear:FN(t,e),enter:ON(t),exit:IN(t),disappear:DN(t)}))),CR.registerAnimation("emptyCircle",((t,e)=>({appear:FN(t,e)}))),CR.registerSeries(GN.type,GN)};function $N(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const XN=t=>({type:$N(t.growField),options:{overall:!0}}),KN={type:"fadeIn"},qN=t=>({type:$N(t.growField)}),ZN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},JN=ZN;function QN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return KN;case"growAngle":return XN(Object.assign(Object.assign({},t),{growField:"angle"}));default:return XN(Object.assign(Object.assign({},t),{growField:"radius"}))}}class tU extends wN{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(oO),this.setInnerRadiusField(aO)}setValueFieldToPercent(){this.setRadiusField(hO),this.setInnerRadiusField(lO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const eU=Object.assign(Object.assign({},rF),{rose:{name:"rose",type:"arc"}});class iU extends xF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class sU extends zz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=CR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=kz,this._endAngle=Mz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):gz(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:gR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:gR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:hz(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(){VL(this._regions,(t=>{"radius"===this.getOrient()?gz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):gz(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 FC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:FC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>pz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 wz((()=>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=Tz,e=0;const i=this.getChart().getSpec();return VL(this.getRegions(),(s=>{const n=s;if(r=n.type,[$L.rose,$L.radar,$L.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(wR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(wR({},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)}}sU.type=r.polarAxis,sU.specKey="axes";const nU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},rU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class aU extends sU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}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 JO(this._option.dataSet,t,DE),t}}aU.type=r.polarLinearAxis,aU.specKey="axes",aU.builtInTheme={axis:tj,axisLinear:Zz,axisAngle:rU,axisRadius:nU},G(aU,qz);const oU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(aU.type,aU)};class lU extends sU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new aE}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 JO(this._option.dataSet,t,WE),t}transformScaleDomain(){}}lU.type=r.polarBandAxis,lU.specKey="axes",lU.builtInTheme={axis:tj,axisBand:nj,axisAngle:rU,axisRadius:nU},G(lU,sj);const hU=()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),CR.registerGraphicComponent(Rz.circleAxis,((t,e)=>new BC(t,e))),CR.registerGraphicComponent(Oz.circleAxisGrid,((t,e)=>new DB(t,e))),jz(),CR.registerComponent(lU.type,lU)};class cU extends tU{constructor(){super(...arguments),this.type=$L.rose,this.transformerConstructor=iU,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(){this._roseMark=this._createMark(cU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:vF(this._spec,cU.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=>hR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=hR(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(pF(null===(i=CR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),gF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}cU.type=$L.rose,cU.mark=eU,cU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},cU.transformerConstructor=iU;const dU=()=>{CR.registerSeries(cU.type,cU),HN(),CR.registerAnimation("rose",((t,e)=>({appear:QN(t,e),enter:qN(t),exit:ZN(t),disappear:JN(t)}))),hU(),oU()};class uU extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,LL(this._fromAngle,this._toAngle)&&LL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class pU extends Uw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!HL(t)&&!HL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const gU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function fU(t,e,i){return"fadeIn"===e?gU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function mU(t,e,i){return"fadeIn"===e?gU(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 vU=(t,e)=>({custom:Vw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),_U=Object.assign(Object.assign(Object.assign({},rF),NF),{area:{name:"area",type:"area"}});class yU extends tU{constructor(){super(...arguments),this.type=$L.radar,this.transformerConstructor=JF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(yU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:OD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):kz},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(pF(null===(s=CR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),gF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=CR.getAnimationInKey(e);t.setAnimationConfig(pF(null==i?void 0:i(n,r),gF(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}}}yU.type=$L.radar,yU.mark=_U,yU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},yU.transformerConstructor=JF,G(yU,UF);const bU=()=>{CR.registerSeries(yU.type,yU),fH(),KF(),ZF(),CR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:fU(t,e,"in"),exit:fU(t,e,"out"),disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{channel:["points","center"],custom:pU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),CR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:mU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:mU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:uU,customParameters:t,duration:fD.update.duration,easing:fD.update.easing}]}))),CR.registerAnimation("radarGroup",((t,e)=>({appear:vU(t,"in"),disappear:vU(t,"out")}))),wk(),hU(),oU()};class xU extends $D{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=>fi.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 SU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(ZR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[eO]:r,[iO]:`${s}_${e}`})),r++}))})),n},AU={fill:"#bbb",fillOpacity:.2},kU=Object.assign(Object.assign({},rF),{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 MU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),JO(this._option.dataSet,"objFlat",SU),JO(this._option.dataSet,"copyDataView",aI),QO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(wR(AU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(MU.mark.group),this._containerMark=this._createMark(MU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(MU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(MU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(MU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(MU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(MU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(MU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:sO}}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 aR).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:sO}}initTooltip(){this._tooltipHelper=new xU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}MU.type=$L.dot,MU.mark=kU,MU.builtInTheme={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"}}}}};class TU extends $D{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=>fi.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 wU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),CU=(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 EU extends MF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),JO(this._option.dataSet,"linkDotInfo",CU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(EU.mark.group),this._containerMark=this._createMark(EU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(EU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(EU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:sO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new TU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}EU.type=$L.link,EU.mark=wU,EU.builtInTheme={link:{arrow:{style:{size:10}}}};const BU=Object.assign(Object.assign({},rF),{group:{name:"group",type:"group"}});class PU extends wN{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()?aO:bO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?oO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):kz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):Mz,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=hR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=hR(this.angleAxisHelper.dataToPosition([t[oO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?hR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(PU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return ef(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 IU=()=>{CR.registerAnimation("circularProgress",((t,e)=>({appear:OU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class DU extends xF{constructor(){super(...arguments),this._supportStack=!0}}class FU extends PU{constructor(){super(...arguments),this.type=$L.circularProgress,this.transformerConstructor=DU,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(k(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(k(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(){return this._progressMark=this._createMark(FU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:vF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(FU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?aO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?oO: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",t.AttributeLevel.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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}FU.type=$L.circularProgress,FU.mark=LU,FU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},FU.transformerConstructor=DU;const zU=()=>{CR.registerSeries(FU.type,FU),HN(),IU(),yD(),hU(),oU()};function jU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const HU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:jU(t)}),VU={type:"fadeIn"};function NU(t,e="grow"){return!1===e?{}:"fadeIn"===e?VU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:jU(t)}))(t)}class UU extends $D{enableByType(t){return"dimension"!==t}}const WU=Object.assign(Object.assign({},rF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class GU extends MF{constructor(){super(...arguments),this.type=$L.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;return this._progressMark=this._createMark(GU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return hR(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+n},y1:t=>{var e,i;return hR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return hR(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 e,s;return hR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(GU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return hR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(pF(null===(i=CR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),gF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),gF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new UU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}GU.type=$L.linearProgress,GU.mark=WU,GU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const YU=()=>{BH(),CR.registerAnimation("linearProgress",((t,e)=>({appear:NU(t,e),enter:NU(t),disappear:HU(t)}))),yD(),CR.registerSeries(GU.type,GU)},$U=[0],XU=[20,40],KU=[200,500],qU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},ZU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],JU=`${ZR}_WORD_CLOUD_TEXT`,QU=Object.assign(Object.assign({},rF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),tW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class eW extends SF{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=XU}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:KU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:$U,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)?JU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:qU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:$U,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!ZU.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 e;this._wordMark=this._createMark(eW.mark.word,{key:iO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(eW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(pF(CR.getAnimationInKey("wordCloud")(n,s),gF("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 aR).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:sO])}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 wE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new wE).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[eO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:iO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:df}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:jg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}eW.mark=QU,eW.builtInTheme={wordCloud:tW};function iW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||fD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=sW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},nW=(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=nW(t.children,e,t,n))})),s},rW=(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=rW(t.children,e,t,n)),n=e(t,s,i,n)})),n},aW=(t,e=[],i)=>{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):aW(t.children,e,i)))})),e};function oW(t,e){let i,s;if(cW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function cW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function gW(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 fW(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 mW(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 vW(t){return{_:t,next:null,prev:null}}function _W(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];gW(n,s,r);let a,o,l,h,c,d,u,p=vW(s),g=vW(n),f=vW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=sW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:SW.defaultOpionts.nodeSort;nW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)nW([o],yW(h)),rW([o],bW(this._getPadding,.5,a)),nW([o],xW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);nW([o],yW(SW.defaultOpionts.setRadius)),rW([o],bW(Lt,1,a)),c&&rW([o],bW(this._getPadding,o.radius/t,a)),nW([o],xW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}SW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const AW=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=AW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function kW(t){return t.depth}function MW(t,e){return e-1-t.endDepth}const TW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),wW=(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},CW={left:kW,right:MW,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:kW,end:MW},EW=yt(0,1);class BW{constructor(t){this._ascendingSourceBreadth=(t,e)=>TW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>TW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},BW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):CW[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)};"vertical"===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<=0)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))),"vertical"===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=[];AW(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:Mt(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+=Mt(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=[wW(s[t.source]),wW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*EW(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(TW),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(TW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];PW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),LW);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({},RW.defaultOpionts,t):Object.assign({},RW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=sW(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=he({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)}}}function OW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:PW,slice:OW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?OW:PW)(t,e,i,s,n)}};class FW{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({},FW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?IW(this.options.aspectRatio):null!==(e=DW[this.options.splitType])&&void 0!==e?e:DW.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=sW(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)}))}}function zW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=zW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=jW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function YW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*$W({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},KW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||VW,s=e.lossFunction||HW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:XW(l),arcs:l})}))},qW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:ZW,triangle:ZW,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 ZW(){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 JW(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 QW=t=>qW[t]?qW[t]():qW.circle(),tG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function eG(t){return d(t)?t:function(){return t}}class iG{constructor(t){var e,i;switch(this.options=j({},iG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=QW(this.options.shape),this.getText=null!==(e=eG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=eG(this.options.fontWeight),this.getTextFontSize=eG(this.options.fontSize),this.getTextFontStyle=eG(this.options.fontStyle),this.getTextFontFamily=eG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>tG(10,50);break;case"random-light":this.getTextColor=()=>tG(50,90);break;default:this.getTextColor=eG(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 ae(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():Tt(e);return ae(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 nG extends iG{constructor(t){var e;super(j({},nG.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<=nG.defaultOptions.minFontSize&&(this.options.minFontSize=nG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=sG[this.options.spiral])&&void 0!==e?e:sG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=eG(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}=JW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}lG(p,this._size)&&(p=hG(p,this._size))}else if(lG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||aG(p,i))&&(!i||!rG(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 rG(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 aG(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,lG=(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 hG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},dG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},uG=(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()},pG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=JW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=QW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)uG(n,dG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)uG(n,dG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)uG(n,dG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=dG({x:l,y:h},o,-Math.PI/2,5),e=dG({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]);uG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){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,i=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,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function It(t,e,i,s,n){let r=0,a=0;return Ot(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Ot(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:It(t,e,i,n,h)}}const Ft=1e-12,zt=Math.PI,jt=zt/2,Ht=2*zt,Vt=2*Math.PI,Nt=Math.abs,Ut=Math.atan2,Wt=Math.cos,Gt=Math.max,Yt=Math.min,$t=Math.sin,Xt=Math.sqrt,Kt=Math.pow;function qt(t){return t>=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(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 Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=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 de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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 ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(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 _e(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}=be(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 ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(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 xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(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 ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(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 Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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 Ie(t,e={},i){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 De{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=Ie(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(_(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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.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(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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 Ue;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(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 ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(t){if(k(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function oi(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 li(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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,group:y,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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(e))*Zi(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+Zr(e,6):Zr(e,4))+"-"+Zr(t.getUTCMonth()+1,2)+"-"+Zr(t.getUTCDate(),2)+(r?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"."+Zr(r,3)+"Z":n?"T"+Zr(i,2)+":"+Zr(s,2)+":"+Zr(n,2)+"Z":s||i?"T"+Zr(i,2)+":"+Zr(s,2)+"Z":"")}function Qr(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 Xr;if(h)return h=!1,$r;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(;a0}function ca(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=sa(t));var r=[];switch(t.type){case"GeometryCollection":return da(t,(function(t){pa(t,s)})),t;case"FeatureCollection":return ca(t,(function(t){ca(pa(t,s),(function(t){r.push(t)}))})),li(r)}return pa(t,s)}function pa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return da(t,(function(t){pa(t,e)})),t;case"LineString":return ga(la(t),e),t;case"Polygon":return fa(la(t),e),t;case"MultiLineString":return la(t).forEach((function(t){ga(t,e)})),t;case"MultiPolygon":return la(t).forEach((function(t){fa(t,e)})),t;case"Point":case"MultiPoint":return t}}function ga(t,e){ha(t)===e&&t.reverse()}function fa(t,e){ha(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ma(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ba=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(_a,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ya(t))})):e.push(ya(t))})),e})(t);let l=t.features;return o&&(l=ua(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=va.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=va.bounds(t);t.bbox=e}})),t.features=l,t},xa={},Sa=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(_a,xa,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 Rr(a,t)}))}:Rr(a,o));var a,o;return ba(r,s,i)},Aa=(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 ka=0;function Ma(t="dataset"){return ka>1e8&&(ka=0),t+"_"+ka++}class Ta{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:Ma("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()}}class wa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ma("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof wa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Ca={},Ea={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ba=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Pa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ba.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class La{static GenAutoIncrementId(){return La.auto_increment_id++}}La.auto_increment_id=0;class Ra{constructor(t){this.id=La.GenAutoIncrementId(),this.registry=t}}const Oa="named",Ia="inject",Da="multi_inject",Fa="inversify:tagged",za="inversify:paramtypes";class ja{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Oa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ha=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 Va(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ha.hasOwnMetadata(t,e)&&(r=Ha.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ha.defineMetadata(t,r,e)}(Fa,t,i.toString(),s)}function Na(t){return(e,i,s)=>{Va(e,0,s,t)}}function Ua(t){return e=>(i,s,n)=>Na(new ja(t,e))(i,s,n)}const Wa=Ua(Ia),Ga=Ua(Da);function Ya(){return function(t){return Ha.defineMetadata(za,null,t),t}}function $a(t){return Na(new ja(Oa,t))}const Xa="Singleton",Ka="Transient",qa="ConstantValue",Za="DynamicValue",Ja="Factory",Qa="Function",to="Instance",eo="Invalid";class io{constructor(t,e){this.id=La.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=eo,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new io(this.serviceIdentifier,this.scope);return t.activated=t.scope===Xa&&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 so{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ha.getMetadata(za,t),userGeneratedMetadata:Ha.getMetadata(Fa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const no=(ro=Oa,t=>{const e=e=>{if(null==e)return!1;if(e.key===ro&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const lo=Symbol("ContributionProvider");class ho{constructor(t,e){this.serviceIdentifier=t,this.container=e,uo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function co(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).inSingletonScope().whenTargetNamed(e)}class uo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}uo.store=new Map;class po{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 go extends po{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const fo=Symbol.for("EnvContribution"),mo=Symbol.for("VGlobal"),vo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ka,this.options=e,this.id=La.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new so}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,Oa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new io(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new oo(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[Ia],multiInject:s[Da]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case qa:case Qa:e=t.cache;break;case to: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===Xa&&(t.cache=e,t.activated=!0)}},_o=Symbol.for("RenderService");const yo=new class{get renderService(){return this._renderService||(this._renderService=vo.get(_o)),this._renderService}};let bo=0;class xo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=yo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++bo,t),this.tryRunAnimationFrameNextFrame(),bo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class So{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ao=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ko=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mo=function(t,e){return function(i,s){e(i,s,t)}},To=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 wo=class extends So{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=La.GenAutoIncrementId(),this.hooks={onSetEnv:new go(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new xo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return To(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Co,Eo,Bo,Po;wo=Ao([Ya(),Mo(0,Wa(lo)),Mo(0,$a(fo)),ko("design:paramtypes",[Object])],wo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Co||(Co={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Eo||(Eo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Bo||(Bo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Po||(Po={}));const Lo=Ht-1e-8;class Ro{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Lo)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Io=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Do={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},Fo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let zo,jo,Ho,Vo,No,Uo;var Wo,Go,Yo,$o,Xo,Ko;function qo(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Zo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.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 Qo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=al(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ll(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new hl(i,n),new hl(n,s)]}class hl extends tl{constructor(t,e){super(),this.type=Xo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p1.x):t===$o.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class cl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new hl(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===$o.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===$o.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class dl extends cl{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 ul(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function pl(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?$o.ROW:$o.COLUMN;return"monotoneY"===t?new dl(t,s):new cl(t,s)}class gl{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 fl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new gl(n,s),t),n}function ml(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 vl{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&&ml(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:ml(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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("basis",i,t);return function(t,e){ul(t,e,2)}(new vl(n,s),t),n}function yl(t){return t<0?-1:1}function bl(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(yl(r)+yl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function xl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Sl(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 Al{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:Sl(this,this._t0,xl(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,Sl(this,xl(this,e=bl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Sl(this,this._t0,e=bl(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 kl extends Al{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneX",i,t);return function(t,e){ul(t,e,2)}(new Al(n,s),t),n}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return fl(t,e);const n=pl("monotoneY",i,t);return function(t,e){ul(t,e,2)}(new kl(n,s),t),n}let wl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Cl extends wl{lineEnd(){this.context.closePath()}}function El(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new wl(r,e,n),t),r}function Bl(t,e){return ul(t,e,1)}class Pl extends gl{lineEnd(){this.context.closePath()}}function Ll(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=pl("linear",i,t);return function(t,e){ul(t,e,1)}(new Pl(n,s),t),n}function Rl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){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>Ft){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 Ol(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return fl(i,n);const o=pl(t,r,i);return ul(new e(o,s,a),i,2),o}}const Il=Ol("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Rl(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 Dl=Ol("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Rl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Fl extends tl{constructor(t,e,i){super(),this.type=Xo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return rl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,el([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===$o.ROW?Nt(this.p0.x-this.p2.x):t===$o.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=rl(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Fl(i,a,r),new Fl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class zl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new hl(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Fl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new ol(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function jl(t,e,i){var s,n;switch(e){case"linear":default:return fl(t,i);case"basis":return _l(t,i);case"monotoneX":return Ml(t,i);case"monotoneY":return Tl(t,i);case"step":return El(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new cl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?$o.ROW:$o.COLUMN);return Bl(new Cl(r,e,n),t),r}(t,.5,i);case"stepBefore":return El(t,0,i);case"stepAfter":return El(t,1,i);case"catmullRom":return Il(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Dl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Ll(t,i)}}class Hl extends Oo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Ro(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Fo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Fo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Fo.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([Fo.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([Fo.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([Fo.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([Fo.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([Fo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Fo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new zl(this);Qo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Fo.M]=t=>`M${t[1]} ${t[2]}`,t[Fo.L]=t=>`L${t[1]} ${t[2]}`,t[Fo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Fo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Fo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Fo.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;tUo){let t,e=Ho;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Qo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===$o.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===$o.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),nh=Object.assign(Object.assign({},ql),{points:[],cornerRadius:0,closePath:!0}),rh=Object.assign(Object.assign({},ql),{width:100,height:100,spikes:5,thickness:.5}),ah=Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const oh=Object.assign(Object.assign({},ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),lh=Object.assign(Object.assign(Object.assign({},ql),$l),{strokeBoundsBuffer:0,keepDirIn3d:!0}),hh=Object.assign(Object.assign(Object.assign({},ql),$l),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ch=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},ql),{fill:!0,cornerRadius:0,cornerType:"round"}),dh=Object.assign(Object.assign({},ch),{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}),uh=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&&_(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 ph{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ph.IsGradientStr(t))try{const e=uh(t)[0];if(e){if("linear"===e.type)return ph.ParseLinear(e);if("radial"===e.type)return ph.ParseRadial(e);if("conic"===e.type)return ph.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:ph.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:ph.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const mh={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"}},vh=!0,_h=!1,yh=/\w|\(|\)|-/,bh=/[.?!,;:/,。?!、;:]/,xh=/\S/,Sh=(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})};function Ah(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=yo.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=kh(t,a)),a}function kh(t,e,i=!1){let s=e;for(;yh.test(t[s-1])&&yh.test(t[s])||bh.test(t[s]);)if(s--,s<=0)return i?Mh(t,e):e;return s}function Mh(t,e){let i=e;for(;yh.test(t[i+1])&&yh.test(t[i])||bh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Th(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=yo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}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};let Ch=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=lh.fontSize}){let i=0,s=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=kh(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,a=!1){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=kh(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}};Ch=wh([Ya()],Ch);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};const Bh=Symbol.for("TextMeasureContribution");let Ph=class extends Ch{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ph=Eh([Ya()],Ph);const Lh=Symbol.for("CanvasFactory"),Rh=Symbol.for("Context2dFactory");function Oh(t){return vo.getNamed(Lh,yo.global.env)(t)}const Ih=1e-4,Dh=Math.sqrt(3),Fh=1/3;function zh(t){return t>-Zh&&tZh||t<-Zh}const Hh=[0,0],Vh=[0,0],Nh=[0,0];function Uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Wh(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 Yh(t){return(t%=Vt)<0&&(t+=Vt),t}function $h(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function qh(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(zh(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 Qh=[-1,-1,-1],tc=[-1,-1];function ec(){const t=tc[0];tc[0]=tc[1],tc[1]=t}function ic(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(zh(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,Fh):Math.pow(i,Fh),s=s<0?-Math.pow(-s,Fh):Math.pow(s,Fh);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+Dh*Math.sin(e)))/(3*a),h=(-o+i*(s-Dh*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,Qh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&ec(),p=Gh(e,s,r,o,tc[0]),u>1&&(g=Gh(e,s,r,o,tc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(zh(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,Qh);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=Wh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Qh[0]=-l,Qh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=Qh[0]+t&&a<=Qh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=Qh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function rc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function ac(t,e){let i=rc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-rc(i-n)):e&&i1&&(i||(h+=Le(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;oc[0]=S,oc[1]=A,ac(oc,Boolean(a[6])),S=oc[0],A=oc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Fo.M:u=m,p=v,c=u,d=p;break;case Fo.L:if(i){if(qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Fo.C:if(i){if(Xh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Fo.Q:if(i){if($h(c,d,m,v,_,y,e,s,n))return!0}else h+=sc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Fo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Kh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=nc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Fo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(qh(u,p,o,p,e,s,n)||qh(o,p,o,l,e,s,n)||qh(o,l,u,l,e,s,n)||qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Fo.Z:if(i){if(qh(c,d,u,p,e,s,n))return!0}else h+=Le(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},dc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const uc=Symbol.for("VWindow"),pc=Symbol.for("WindowHandlerContribution");let gc=class extends So{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(){super(),this.hooks={onChange:new go(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(vo.getNamed(pc,t.env).configure(this,t),this.actived=!0)},this._uid=La.GenAutoIncrementId(),this.global=yo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};gc=cc([Ya(),dc("design:paramtypes",[])],gc);var fc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vc=function(t,e){return function(i,s){e(i,s,t)}};let _c=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=yo.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=hc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:$l.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:$l.fontFamily,fontSize:$l.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=vo.get(uc),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 yc;_c=fc([Ya(),vc(0,Wa(lo)),vc(0,$a(Bh)),mc("design:paramtypes",[Object])],_c),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(yc||(yc={}));const bc=new Ue;let xc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=yc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=yc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(bc.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(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}scale(t,e,i){return this.mode===yc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===yc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return bc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(bc.a,bc.b,bc.c,bc.d,bc.e,bc.f),this}translate(t,e){return this.mode===yc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===yc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};xc=fc([Ya(),mc("design:paramtypes",[])],xc);const Sc={arc:Zl,area:Jl,circle:Ql,line:ih,path:sh,symbol:oh,text:lh,rect:ah,polygon:nh,star:rh,richtext:hh,richtextIcon:dh,image:ch,group:th,glyph:eh},Ac=Object.keys(Sc);function kc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Mc={arc:Object.assign({},Sc.arc),area:Object.assign({},Sc.area),circle:Object.assign({},Sc.circle),line:Object.assign({},Sc.line),path:Object.assign({},Sc.path),symbol:Object.assign({},Sc.symbol),text:Object.assign({},Sc.text),rect:Object.assign({},Sc.rect),polygon:Object.assign({},Sc.polygon),star:Object.assign({},Sc.star),richtext:Object.assign({},Sc.richtext),richtextIcon:Object.assign({},Sc.richtextIcon),image:Object.assign({},Sc.image),group:Object.assign({},Sc.group),glyph:Object.assign({},Sc.glyph)};class Tc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Ac.forEach((t=>{this._defaultTheme[t]=Object.create(Mc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Ac.forEach((s=>{const n=Object.create(Mc[s]);t&&t[s]&&kc(n,t[s]),i[s]&&kc(n,i[s]),e[s]&&kc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Ac.forEach((t=>{kc(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 wc=new Tc;function Cc(t,e){return t.glyphHost?Cc(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)):wc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Cc(t.attachedThemeGraphic)||wc.getTheme()}var Ec=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 Bc 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=La.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Ec(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Rc))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(Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))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=Fc(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 Rc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Dc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Fc(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(Fc(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,Fc(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 Rc))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"):Fc(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 Oc))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=Dc.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 zc(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 Rc,this.rootWheelEvent=new Oc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Nc{static GetImage(t,e){var i;const s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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):Nc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Nc.cache.get(t);s?"fail"===s.loadState?yo.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"},Nc.cache.set(t,s),s.dataPromise=yo.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=Nc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Nc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=yo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=yo.global.loadBlob(t):"json"===e&&(i.dataPromise=yo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Nc.isLoading&&Nc.toLoadAueue.length){Nc.isLoading=!0;const t=Nc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Nc.cache.set(i,n),n.dataPromise=yo.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((()=>{Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()})).catch((t=>{console.error(t),Nc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Nc.loading()}))}}),0)}static loadImage(t,e){const i=Uc(t,Nc.toLoadAueue);if(-1!==i)return Nc.toLoadAueue[i].marks.push(e),void Nc.loading();Nc.toLoadAueue.push({url:t,marks:[e]}),Nc.loading()}static improveImageLoading(t){const e=Uc(t,Nc.toLoadAueue);if(-1!==e){const t=Nc.toLoadAueue.splice(e,1);Nc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Uc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Yc[0]=t[0],Yc[2]=t[0],Yc[1]=t[1],Yc[3]=t[1],Yc):t:t:0,Xc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Kc=[1,2,3,0,1,2,3,0];function qc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Xc[0].x=i,Xc[1].y=i,Xc[2].x=-i,Xc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}td.TimeOut=1e3/60;const ed=new td,id=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class sd{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 nd(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var rd=new class extends sd{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 nd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return nd(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 ad=new class extends sd{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 od(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 ld=new class extends sd{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 od(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}};function hd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var cd=new class extends sd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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)}};function dd(t,e,i,s,n=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 ud extends sd{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 dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}}var pd=new ud;var gd=new class extends ud{constructor(){super(...arguments),this.type="triangle"}};const fd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),md=Math.sin(Ht/10)*fd,vd=-Math.cos(Ht/10)*fd;function _d(t,e,i,s){const n=md*e,r=vd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 yd=new class extends sd{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 _d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return _d(t,this.parseSize(e)/2+n,i,s)}};const bd=Xt(3);function xd(t,e,i,s){const n=e,r=n/bd,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 Sd=new class extends sd{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 xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function Ad(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 kd=new class extends sd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2+n,i,s)}};function Md(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Td=new class extends sd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};const wd=-.5,Cd=Xt(3)/2,Ed=1/Xt(12);function Bd(t,e,i,s){const n=e/2,r=e*Ed,a=n,o=e*Ed+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(wd*n-Cd*r+i,Cd*n+wd*r+s),t.lineTo(wd*a-Cd*o+i,Cd*a+wd*o+s),t.lineTo(wd*l-Cd*h+i,Cd*l+wd*h+s),t.lineTo(wd*n+Cd*r+i,wd*r-Cd*n+s),t.lineTo(wd*a+Cd*o+i,wd*o-Cd*a+s),t.lineTo(wd*l+Cd*h+i,wd*h-Cd*l+s),t.closePath(),!1}var Pd=new class extends sd{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 Bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2+n,i,s)}};function Ld(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 Rd=new class extends sd{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 Ld(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends sd{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=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 Fd=new class extends sd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};const zd=Xt(3);function jd(t,e,i,s){const n=e*zd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Hd=new class extends sd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return jd(t,this.parseSize(e)/2/zd,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2/zd+n,i,s)}};function Vd(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 Nd=new class extends sd{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Wd=new class extends sd{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends sd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends sd{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var qd=new class extends sd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Jd=new class extends sd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(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 tu=new class extends sd{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 Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(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 eu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function iu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var su=new class extends sd{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)?iu(t,e,i,s):eu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?iu(t,e+2*n,i,s):eu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const nu=new Ve;class ru{constructor(t,e,i=!1){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(),Qo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Qo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{nu.x1=i.bounds.x1*t,nu.y1=i.bounds.y1*t,nu.x2=i.bounds.x2*t,nu.y2=i.bounds.y2*t,e.union(nu)}))}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 au={};[rd,ad,ld,cd,Hd,gd,yd,Sd,kd,Td,Pd,Rd,Id,pd,Fd,Nd,Wd,Yd,Xd,su,qd,Jd,tu].forEach((t=>{au[t.type]=t}));const ou={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class lu{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 hu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function cu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=cu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=hu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=cu(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 lu(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 lu(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 pu(t,e){return gu(t)}function gu(t,e){const i={};for(let e=0;eAu.set(t,!0)));const ku=new Map;function Mu(t){if(Au.has(t))return!0;if(ku.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>ku.set(t,!0)));const Tu=xu(),wu=xu(),Cu=xu(),Eu=xu(),Bu=xu(),Pu=xu(),Lu=xu(),Ru=xu(),Ou=xu(),Iu=xu();xu();const Du=xu();xu();const Fu=xu();xu();const zu=xu(),ju=xu(),Hu=Symbol.for("GraphicService"),Vu=Symbol.for("GraphicCreator"),Nu={"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"},Uu=Object.keys(Nu),Wu={duration:200,easing:"cubicOut"};function Gu(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 Yu(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 $u(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 Xu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ku(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 qu{constructor(){this.pools=[]}static identity(t){return Gu(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 qu.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},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ep=new Ue(1,0,0,1,0,0),ip={x:0,y:0};let sp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Hl,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Zu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}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,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ip),function(t,e,i){return lc(t,0,!1,e,i)}(this.path.commandList,ip.x,ip.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ip);const i=gh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return lc(t,e,!0,i,s)}(this.path.commandList,i,ip.x,ip.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(t=!0,e=this.dpr){this.setTransformFromMatrix(ep,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};sp=Qu([Ya(),tp("design:paramtypes",[Object,Number])],sp);const np={WIDTH:500,HEIGHT:500,DPR:1};class rp{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}set nativeCanvas(t){this._nativeCanvas=t}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=np.WIDTH,height:n=np.HEIGHT,dpr:r=np.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var ap;rp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(ap||(ap={}));class op{static Get(t,e=ap.Color1,i=[0,0,0,1]){if(e===ap.Color1){const e=op.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];op.store1[t]=e,op.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=op.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(op.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],op.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===ap.Color1){if(op.store1[t])return;op.store1[t]=i,op.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(op.store255[t])return;op.store255[t]=i,op.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function lp(t,e=!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 hp(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)=>{var a,o;return cp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):cp(t,e,i,s,n)}function cp(t,e,i,s,n){if(!t||!e)return t&&lp(t)||e&&lp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=op.Get(t,ap.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=op.Get(e,ap.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:lp(a)})))});return o?hp(r,l,i,s,n):hp(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:gp(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:gp(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:gp(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),lp(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)}function dp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}op.store255={},op.store1={};const up=[0,0,0,0],pp=[0,0,0,0];function gp(t,e,i){return op.Get(t,ap.Color255,up),op.Get(e,ap.Color255,pp),`rgba(${Math.round(up[0]+(pp[0]-up[0])*i)},${Math.round(up[1]+(pp[1]-up[1])*i)},${Math.round(up[2]+(pp[2]-up[2])*i)},${up[3]+(pp[3]-up[3])*i})`}class fp{static GetCanvas(){try{return fp.canvas||(fp.canvas=yo.global.createCanvas({})),fp.canvas}catch(t){return null}}static GetCtx(){if(!fp.ctx){const t=fp.GetCanvas();fp.ctx=t.getContext("2d")}return fp.ctx}}class mp extends We{static getInstance(){return mp._instance||(mp._instance=new mp),mp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=fp.GetCanvas(),s=fp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new mp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class vp{static GetSize(t){for(let e=0;e=t)return vp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=vp.GenKey(t,e,i,s,n),l=vp.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=vp.GenKey(t,e,i,s,n);vp.cache[l]?vp.cache[l].push({width:a,height:o,pattern:r}):vp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}vp.cache={},vp.ImageSize=[20,40,80,160,320,640,1280,2560];const _p=new Ve,yp=new Ue;new Ve;const bp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],xp=["x","y"],Sp=["scaleX","scaleY"],Ap=["angle"],kp=new ne,Mp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Tp extends Bc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=au[t];if(e)return e;if(e=Tp.userSymbolMap[t],e)return e;if(!0===((i=t=ou[t]||t).startsWith("{const e=(new Hl).fromString(t.d),i={};Uu.forEach((e=>{t[e]&&(i[Nu[e]]=t[e])})),n.push({path:e,attribute:i}),_p.union(e.bounds)}));const r=_p.width(),a=_p.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ru(t,n,!0);return Tp.userSymbolMap[t]=l,l}var i;const s=(new Hl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new ru(t,s);return Tp.userSymbolMap[t]=o,o}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=$c(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 Ro(t);return Qo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Wo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Wo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Wo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Wo.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&Wo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Wo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Go.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Wu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Yo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Yo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Yo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Wo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Wo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Wo.UPDATE_SHAPE_AND_BOUNDS)===Wo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Wo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Wo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Wo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Wo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Wo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Wo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Wo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}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&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),yo.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=yp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Yo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:yo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Hl).fromString(t):this.pathProxy=new Hl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),yo.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Ic(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||yo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new sp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var wp;Tp.userSymbolMap={},Tp.mixin(jc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(wp||(wp={}));let Cp=class t extends Tp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Pu,this._childUpdateTag=Wo.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 Tc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Tc)}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===Go.GLOBAL){const i=new ne(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&Wo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=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 Cc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return yo.graphicService.updateTempAABBBounds(i),yo.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&=Wo.CLEAR_BOUNDS,this._childUpdateTag&=Wo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Wo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Wo.UPDATE_BOUNDS||(this._childUpdateTag|=Wo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Wo.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=yo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Ep(t){return new Cp(t)}Cp.NOWORK_ANIMATE_ATTR=Mp;class Bp extends Cp{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 Tc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{yo.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=>{yo.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 Pp=Symbol.for("TransformUtil"),Lp=Symbol.for("GraphicUtil"),Rp=Symbol.for("LayerService"),Op=Symbol.for("StaticLayerHandlerContribution"),Ip=Symbol.for("DynamicLayerHandlerContribution"),Dp=Symbol.for("VirtualLayerHandlerContribution");var Fp,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)};let Hp=Fp=class{static GenerateLayerId(){return`${Fp.idprefix}_${Fp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=yo.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?vo.get(Op):"dynamic"===t?vo.get(Ip):vo.get(Dp),e}createLayer(t,e={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 Bp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Fp.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)}};Hp.idprefix="visactor_layer",Hp.prefix_count=0,Hp=Fp=zp([Ya(),jp("design:paramtypes",[])],Hp);var Vp=new Ra((t=>{t(mo).to(wo).inSingletonScope(),t(uc).to(gc),t(Lp).to(_c).inSingletonScope(),t(Pp).to(xc).inSingletonScope(),t(Rp).to(Hp).inSingletonScope()}));function Np(t,e){return!(!t&&!e)}function Up(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Wp(t,e,i){return i&&t*e>0}function Gp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Yp(t,e){return t*e>0}function $p(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Xp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Kp(t,e,i,s,n){const r=Nt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Kp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Xp(g,f,u,p,n,t,Number(c)),l=Xp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Xp(S,A,b,x,r,-n,Number(c)),l=Xp(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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(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,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const Zp=Symbol.for("ArcRenderContribution"),Jp=Symbol.for("AreaRenderContribution"),Qp=Symbol.for("CircleRenderContribution"),tg=Symbol.for("GroupRenderContribution"),eg=Symbol.for("ImageRenderContribution"),ig=Symbol.for("PathRenderContribution"),sg=Symbol.for("PolygonRenderContribution"),ng=Symbol.for("RectRenderContribution"),rg=Symbol.for("SymbolRenderContribution"),ag=Symbol.for("TextRenderContribution"),og=Symbol.for("InteractiveSubRenderContribution");function lg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function hg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}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)}};function pg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Gu(t),Yu(t,t,[n+o,r+l,a+h]),Yu(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),Yu(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]),f){const i=Ju.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]}Yu(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),Yu(i,i,[-s[0],-s[1],0]),Xu(t,t,i)}}let gg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new go(["graphic"]),onSetStage:new go(["graphic","stage"]),onRemove:new go(["graphic"]),onRelease:new go(["graphic"]),onAddIncremental:new go(["graphic","group","stage"]),onClearIncremental:new go(["graphic","group","stage"]),beforeUpdateAABBBounds:new go(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new go(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new go(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Ro(t);return Qo(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=hg(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=lg(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){yu(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;yu(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};gg=cg([Ya(),ug(0,Wa(Vu)),dg("design:paramtypes",[Object])],gg);const fg=(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},mg=["radius","startAngle","endAngle",...bp];class vg extends Tp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Eu}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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.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>Vt-Ft?i.set(-r,-r,r,r):qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mg)}needUpdateTag(t){return super.needUpdateTag(t,mg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Hl,s.arc(0,0,r,a,o),s}clone(){return new vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vg.NOWORK_ANIMATE_ATTR}}function _g(t){return new vg(t)}vg.NOWORK_ANIMATE_ATTR=Mp;class yg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Co.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=ju,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 Cc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new xg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=yo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){yu(n,o/Math.abs(r+a),!0,l),i.union(n)}return yo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new yg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=yo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new yg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=lg(_,a),e=this.cache.verticalList.length*v,i=hg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Su.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=lg(_,a),S=this.cache.verticalList.length*v,A=hg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=id(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=bg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=bg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return xg.baselineMapAlign}getAlignMapBaseline(){return xg.alignMapBaseline}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Mp),xg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},xg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Ag=["symbolType","size",...bp];let kg=class t extends Tp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=zu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Cc(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}=yo.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;yu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return yo.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,Ag)}needUpdateTag(t){return super.needUpdateTag(t,Ag)}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 Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Mp);const Tg=["segments","points","curveType","curveTension",...bp];let wg=class t extends Tp{constructor(t={}){super(t),this.type="line",this.numberType=Ru}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=Jc(i,s,e))}getGraphicTheme(){return Cc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Hl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const Eg=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}},Bg=["width","x1","y1","height","cornerRadius",...bp];class Pg extends Tp{constructor(t){super(t),this.type="rect",this.numberType=Du}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Cc(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}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Eg(e);return t=new Hl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Pg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Mp;class Rg extends Tp{constructor(t){super(t),this.type="glyph",this.numberType=Bu,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,e=!1,i){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 Cc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Rg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Rg.NOWORK_ANIMATE_ATTR}}function Og(t){return new Rg(t)}Rg.NOWORK_ANIMATE_ATTR=Mp;class Ig{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=mh[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}}}function Dg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Fg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=id(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Th(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Th(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Dg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ah(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Th(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Dg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Ah(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Th(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const zg=["width","height","image",...bp];class jg extends Tp{constructor(t){super(t),this.type="image",this.numberType=Lu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Cc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);return fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ch[t]}needUpdateTags(t){return super.needUpdateTags(t,zg)}needUpdateTag(t){return super.needUpdateTag(t,zg)}clone(){return new jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return jg.NOWORK_ANIMATE_ATTR}}function Hg(t){return new jg(t)}jg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Mp);class Vg extends jg{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=$c(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=$c(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=ch.width,height:e=ch.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 Ng{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 Vg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=mh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Fg){const e=xh.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 Vg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Th(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Vg)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||_h;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,Sh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||vh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?fh(t,s,{AABBBounds:i}):s,Sh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Vg)break;const{width:n}=Th(t,s.character,s.ascentDescentMode),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 Vg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ug{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=mh[this.direction]}store(t){if(t instanceof Vg){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 Ng(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,e=!1){t instanceof Vg?"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||this.newLine)&&("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=Ah(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 Fg(i,t.newLine,t.character,t.ascentDescentMode),new Fg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Wg=!1;try{Wg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Wg=!1}const Gg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...bp];class Yg extends Tp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Fu,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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.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:hh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Cc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Yg.splitText(t.text).length>1)))}static splitText(t){if(Wg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Yg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),yo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||yo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,yo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Gg)}needUpdateTag(t){return super.needUpdateTag(t,Gg)}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;e0&&!Yg.AllSingleCharacter(_)&&(_=Yg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Ig(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ug(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Yg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Yg.NOWORK_ANIMATE_ATTR}}function $g(t){return new Yg(t)}Yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Mp);const Xg=["path","customPath",...bp];class Kg extends Tp{constructor(t){super(t),this.type="path",this.numberType=Ou}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 Cc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return yo.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,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}toCustomPath(){return(new Hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Mp);const Zg=["segments","points","curveType","curveTension",...bp];class Jg extends Tp{constructor(t){super(t),this.type="area",this.numberType=Cu}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 Cc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),yo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Hl;const 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 Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Mp);const tf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...bp];class ef extends Tp{constructor(t){super(t),this.type="arc",this.numberType=Tu}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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(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 Cc(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}=yo.graphicService.updateTempAABBBounds(i);fg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return yo.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<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(qc(l,o,s,i),qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Mp);const nf=["points","cornerRadius",...bp];class rf extends Tp{constructor(t){super(t),this.type="polygon",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Cc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),yo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return yo.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=Jc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Hl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Mp;class of extends Cp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function lf(t){return new of(t)}const hf=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 cf,df;function uf(t){return cf||(cf=hf.CreateGraphic("text",{})),cf.initAttributes(t),cf.AABBBounds}var pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gf=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)}};class mf{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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Cc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=hc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),hc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const vf=new mf;let _f=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)}))}};_f=pf([Ya(),ff(0,Wa(lo)),ff(0,$a(og)),gf("design:paramtypes",[Object])],_f);const yf=new 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){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const bf=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,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class xf{constructor(){this.time=Ko.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=hc.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])),hc.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,Vt),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=hc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Mg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:gh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),qp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},kf=Sf,Mf=vf;const Tf=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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:gh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},wf=Sf,Cf=vf;const Ef=new class extends mf{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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Bf=zt/2;function Pf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Bf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Bf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Bf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Bf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Rf{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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:gh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Pf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Of=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)}};Of=Lf([Ya()],Of);let If=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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Pf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};If=Lf([Ya()],If);const Df=new Rf,Ff=Sf,zf=vf;const jf=new class extends Rf{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)}},Hf=vf;const Vf=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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:gh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Nf=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,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Uf=Sf,Wf=vf;const Gf={x:0,y:0,z:0,lastModelMatrix:null};class Yf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(yf),this.builtinContributions.push(bf),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)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Cc(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,_=Wp(d,u,h),y=Yp(d,g),b=Np(h),x=Up(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Qo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Wp(o,l,n),p=Yp(o,c),g=Np(n,r),f=Up(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,s=!1){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;Gf.x=n,Gf.y=r,Gf.z=a,Gf.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=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(s,d||s,n),Gf.x=0,Gf.y=0,Gf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Ju.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,Gf.z=a,i.setTransformForCurrent()}else if(p)Gf.x=0,Gf.y=0,Gf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Gf.x+=s.x,Gf.y+=s.y,this.transformWithoutTranslate(i,Gf.x,Gf.y,Gf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Gf.x=0,Gf.y=0,Gf.z=0;return Gf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Ju.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Xf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kf=function(t,e){return function(i,s){e(i,s,t)}};let qf=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[Af,Mf,kf],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(nFt){const t=Yt(b,y),r=Yt(x,y),a=Xp(v,_,f,m,n,t,Number(u)),o=Xp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Xp(M,T,A,k,r,-n,Number(u)),o=Xp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(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*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Gc[s]=t,i&&(i=!(null!==(e=Gc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Gc[e]=!!t[e],i&&(i=!!Gc[e]);else Gc[0]=!1,Gc[1]=!1,Gc[2]=!1,Gc[3]=!1;return{isFullStroke:i,stroke:Gc}})(d);if((_||E)&&(e.beginPath(),qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),qp(t,e,i,s,k,M,B),C||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(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Vt;for(;i>Vt;)i-=Vt;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),hp(o.color,l.color,h,!1)}(0,0,h,n);a||Wp&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};qf=$f([Ya(),Kf(0,Wa(lo)),Kf(0,$a(Zp)),Xf("design:paramtypes",[Object])],qf);var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Tf,Cf,wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function em(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]=al(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 im(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 sm(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=im(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),em(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=$o.ROW:"y"===s?u=$o.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 rm=class extends Yf{constructor(){super(...arguments),this.numberType=Ru}draw(t,e,i,s){const n=Cc(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;if(!e)return;t.beginPath();sm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=jl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function am(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),em(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),em(t,l,1,s),o=!1):o=!0}t.closePath()}rm=nm([Ya()],rm);const om=new class extends xf{constructor(){super(...arguments),this.time=Ko.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Qc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Qc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Qc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Qc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},lm=vf;var hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[om,lm],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=Cc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=jl(B(t.points,x),E,{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=jl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=jl(e,E,{curveTension:b}),n=jl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Cc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=$o.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?$o.ROW:null==_.y1?$o.COLUMN:Number.isFinite(S+A)?S>A?$o.ROW:$o.COLUMN:$o.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?$o.ROW:$o.COLUMN,Number.isFinite(c)||(o=$o.COLUMN),Number.isFinite(d)||(o=$o.ROW);const u=i*(o===$o.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),sm(t,i[0]?e.top:e.bottom,l,x===$o.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};um=hm([Ya(),dm(0,Wa(lo)),dm(0,$a(Jp)),cm("design:paramtypes",[Object])],um);const pm=Sf,gm=vf;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},mm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vm=function(t,e){return function(i,s){e(i,s,t)}};let _m=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[gm,pm],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:Cc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Qo(t.pathShape.commandList,e,i,s,1,1,f);else{Qo((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,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=Cc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};_m=fm([Ya(),vm(0,Wa(lo)),vm(0,$a(ig)),mm("design:paramtypes",[Object])],_m);var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Du,this.builtinContributions=[Df,zf,Ff],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Cc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Gp(g,f,T,w,h),E=$p(g,v,T,w,M),B=Np(h,c),P=Up(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Pf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Sm=ym([Ya(),xm(0,Wa(lo)),xm(0,$a(ng)),bm("design:paramtypes",[Object])],Sm);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)},Mm=function(t,e){return function(i,s){e(i,s,t)}};let Tm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Vf,Wf,Uf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Cc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Tm=Am([Ya(),Mm(0,Wa(lo)),Mm(0,$a(rg)),km("design:paramtypes",[Object])],Tm);const wm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Cm=new class extends mf{constructor(){super(...arguments),this.time=Ko.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=wm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=uf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Pf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&wm.free(E),C()}};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)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Lm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Cm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Cc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=id(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(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)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Cc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:lg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Rm(t,e,i,s){if(e&&e.length){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},jm=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 Vm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Fm,Dm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Rm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Rm(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,_=v/m;const y=Om(d,u),b=Om(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Im(h,_,y,d,u),A=Im(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Om(k,M),w=Im(h,Om(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Cc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Vm=zm([Ya(),Hm(0,Wa(lo)),Hm(0,$a(sg)),jm("design:paramtypes",[Object])],Vm);var Nm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Um=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 Gm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Pu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Cc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Gp(p,m,g,f,c),C=$p(p,v,g,f),E=Np(c,u),B=Up(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Pf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Ef));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Ko.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ko.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=yo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Cc(t,null==s?void 0:s.theme).group,i=Ju.allocate(),n=Ju.allocate();pg(n,t,e),Xu(i,p||i,n),a.modelMatrix=i,Ju.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Ju.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Gm=Nm([Ya(),Wm(0,Wa(lo)),Wm(0,$a(tg)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};const Km=["","repeat-x","repeat-y","repeat"];let qm=class extends Yf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[jf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Cc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Pf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Km[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Nc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Cc(t).image;this._draw(t,a,!1,i)}};qm=Ym([Ya(),Xm(0,Wa(lo)),Xm(0,$a(eg)),$m("design:paramtypes",[Object])],qm);const Zm=Symbol.for("IncrementalDrawContribution"),Jm=Symbol.for("ArcRender"),Qm=Symbol.for("AreaRender"),tv=Symbol.for("CircleRender"),ev=Symbol.for("GraphicRender"),iv=Symbol.for("GroupRender"),sv=Symbol.for("LineRender"),nv=Symbol.for("PathRender"),rv=Symbol.for("PolygonRender"),av=Symbol.for("RectRender"),ov=Symbol.for("SymbolRender"),lv=Symbol.for("TextRender"),hv=Symbol.for("RichTextRender"),cv=Symbol.for("GlyphRender"),dv=Symbol.for("ImageRender"),uv=Symbol.for("DrawContribution"),pv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===wu,!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+=Vt;for(;o<0;)o+=Vt;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 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},fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mv=Symbol.for("DrawItemInterceptor"),vv=new Ve,_v=new Ve;class yv{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){vv.copy(s.dirtyBounds),_v.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(vv),s.backupDirtyBounds.copy(_v)),!0}}class bv{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 xv=class{constructor(){this.order=1,this.interceptors=[new yv,new Av,new Sv,new bv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Ju.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}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},Mv=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)}};let wv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};wv=kv([Ya(),Tv(0,Wa(uv)),Mv("design:paramtypes",[Object])],wv);var Cv=new Ra((t=>{t(_o).to(wv)}));const Ev=Symbol.for("PickerService"),Bv=Symbol.for("GlobalPickerService"),Pv=Symbol.for("PickItemInterceptor"),Lv=Symbol.for("PickServiceInterceptor");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};let Ov=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ov=Rv([Ya()],Ov);let Iv=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=Cc(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 ne(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}};Iv=Rv([Ya()],Iv);let Dv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};Dv=Rv([Ya()],Dv);let Fv=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=pv(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()}};Fv=Rv([Ya()],Fv);var zv=new Ra(((t,e,i)=>{i(Ev)||(t(Bv).toSelf(),t(Ev).toService(Bv)),t(Fv).toSelf().inSingletonScope(),t(Pv).toService(Fv),t(Iv).toSelf().inSingletonScope(),t(Pv).toService(Iv),t(Dv).toSelf().inSingletonScope(),t(Pv).toService(Dv),co(t,Pv),t(Ov).toSelf().inSingletonScope(),t(Lv).toService(Ov),co(t,Lv)})),jv=new Ra((t=>{t(Hu).to(gg),t(Vu).toConstantValue(hf)}));const Hv=Symbol.for("AutoEnablePlugins"),Vv=Symbol.for("PluginService");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},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{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&&vo.isBound(Hv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Gv=Nv([Ya(),Wv(0,Wa(lo)),Wv(0,$a(Hv)),Uv("design:paramtypes",[Object])],Gv);var Yv=new Ra((t=>{t(Vv).to(Gv),function(t,e){t(lo).toDynamicValue((({container:t})=>new ho(e,t))).whenTargetNamed(e)}(t,Hv)})),$v=new Ra((t=>{co(t,fo)})),Xv=new Ra((t=>{t(Bh).to(Ph).inSingletonScope(),co(t,Bh)})),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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Zv=class{constructor(){this.type="static",this.offscreen=!1,this.global=yo.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=Oh({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()}};Zv=Kv([Ya(),qv("design:paramtypes",[])],Zv);var Jv=new Ra((t=>{t(Zv).toSelf(),t(Op).toService(Zv)}));var Qv=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,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 e_(t,e,i,s=!1,n=!1){let 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}=t_(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;t{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}=t_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var n_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},r_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a_=function(t,e){return function(i,s){e(i,s,t)}};let o_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):e_(e,ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=yo.global,this.layerService=yo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Zu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=s_(e,i,ql.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=wm.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())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),wm.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||vo.get(Zm);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 h_=class extends rm{constructor(){super(...arguments),this.numberType=Ru}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=Cc(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=Wp(u,p,c),_=Yp(u,g),y=Np(c),b=Up(d,f);if(!t.valid||!m)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())}};h_=l_([Ya()],h_);var c_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 d_=class extends um{constructor(){super(...arguments),this.numberType=Cu}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=Cc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Wp(u,d,c),f=Np(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())}};d_=c_([Ya()],d_);var u_,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)},f_=function(t,e){return function(i,s){e(i,s,t)}},m_=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"}(u_||(u_={}));let v_=class extends o_{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=u_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new go([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return m_(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:ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:ql.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 m_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return m_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>m_(this,void 0,void 0,(function*(){if(2!==t.count)yield i_(t,ql.zIndex,((i,s)=>{if(this.status===u_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return m_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return m_(this,void 0,void 0,(function*(){this.rendering&&(this.status=u_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=u_.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 m_(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:()=>m_(this,void 0,void 0,(function*(){yield i_(t,ql.zIndex,(t=>m_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};v_=p_([Ya(),f_(0,Ga(ev)),f_(1,Wa(h_)),f_(2,Wa(d_)),f_(3,Wa(lo)),f_(3,$a(mv)),g_("design:paramtypes",[Array,Object,Object,Object])],v_);var __=new Ra((t=>{t(mf).toSelf().inSingletonScope(),t(xf).toSelf().inSingletonScope(),t(uv).to(o_),t(Zm).to(v_),t(iv).to(Gm).inSingletonScope(),t(ev).toService(iv),co(t,tg),t(_f).toSelf().inSingletonScope(),co(t,og),co(t,ev),t(xv).toSelf().inSingletonScope(),t(mv).toService(xv),co(t,mv)}));function y_(){y_.__loaded||(y_.__loaded=!0,vo.load(Vp),vo.load(jv),vo.load(Cv),vo.load(zv),vo.load(Yv),function(t){t.load($v),t.load(Xv),t.load(Jv)}(vo),function(t){t.load(__)}(vo))}y_.__loaded=!1,y_();const b_=vo.get(mo);yo.global=b_;const x_=vo.get(Lp);yo.graphicUtil=x_;const S_=vo.get(Pp);yo.transformUtil=S_;const A_=vo.get(Hu);yo.graphicService=A_;const k_=vo.get(Rp);yo.layerService=k_;class M_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=La.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class T_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=La.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=yo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=yo.global.getRequestAnimationFrame();this.rafId=t((()=>{yo.global.devicePixelRatio!==this.dpr&&(this.dpr=yo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=yo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,yo.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 C_=new Ve;class E_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=La.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()}));const e=this.pluginService.stage;e&&(e.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&&(C_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(C_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=yo.global&&yo.global.env;return t?"browser"===t:B_}let L_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};L_._pluginClasses={};const R_="white";class O_ extends Cp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Tc,this.hooks={beforeRender:new go(["stage"]),afterRender:new go(["stage"]),afterClearScreen:new go(["stage"]),afterClearRect:new go(["stage"])},this.global=yo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=vo.get(uc),this.renderService=vo.get(_o),this.pluginService=vo.get(Vv),this.layerService=vo.get(Rp),this.graphicService=vo.get(Hu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Vc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=L_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=L_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=L_.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 M_))}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 T_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new E_,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=L_.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=L_.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=L_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=vo.get(uc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=vo.get(Ev)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},D_=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 F_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return D_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};F_=I_([Ya()],F_);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 H_=class{constructor(){this._uid=La.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};H_=z_([Ya(),j_("design:paramtypes",[])],H_);var V_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},N_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},U_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=yo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Cc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=Cc(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&&Ju.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}};function G_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Y_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function J_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),sy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ny=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return sy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return sy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ny(n[0],s,i),ny(n[1],e-s,i)}};let ry=!1;const ay=new Ra((t=>{ry||(ry=!0,t(qf).toSelf().inSingletonScope(),t(Jm).to(qf).inSingletonScope(),t(ev).toService(Jm),t(Zp).toService(_f),co(t,Zp))}));let oy=!1;const ly=new Ra((t=>{oy||(oy=!0,t(Sm).toSelf().inSingletonScope(),t(av).to(Sm).inSingletonScope(),t(ev).toService(av),t(If).toSelf(),t(Of).toSelf(),t(ng).toService(If),t(ng).toService(Of),t(ng).toService(_f),co(t,ng))}));let hy=!1;const cy=new Ra((t=>{hy||(hy=!0,t(rm).toSelf().inSingletonScope(),t(h_).toSelf().inSingletonScope(),t(sv).to(rm).inSingletonScope(),t(ev).toService(sv))}));let dy=!1;const uy=new Ra((t=>{dy||(dy=!0,t(um).toSelf().inSingletonScope(),t(Qm).to(um).inSingletonScope(),t(ev).toService(Qm),t(Jp).toService(_f),co(t,Jp),t(d_).toSelf().inSingletonScope())}));let py=!1;const gy=new Ra((t=>{py||(py=!0,t(Tm).toSelf().inSingletonScope(),t(ov).to(Tm).inSingletonScope(),t(ev).toService(ov),t(rg).toService(_f),co(t,rg))}));let fy=!1;const my=new Ra((t=>{fy||(fy=!0,t(tm).toSelf().inSingletonScope(),t(tv).to(tm).inSingletonScope(),t(ev).toService(tv),t(Qp).toService(_f),co(t,Qp))}));let vy=!1;const _y=new Ra((t=>{vy||(vy=!0,t(lv).to(Lm).inSingletonScope(),t(ev).toService(lv),t(ag).toService(_f),co(t,ag))}));let yy=!1;const by=new Ra((t=>{yy||(yy=!0,t(_m).toSelf().inSingletonScope(),t(nv).to(_m).inSingletonScope(),t(ev).toService(nv),t(ig).toService(_f),co(t,ig))}));let xy=!1;const Sy=new Ra((t=>{xy||(xy=!0,t(rv).to(Vm).inSingletonScope(),t(ev).toService(rv),t(sg).toService(_f),co(t,sg))}));var Ay=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Bu}reInit(){}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=Cc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Ay([Ya()],ky);let My=!1;const Ty=new Ra((t=>{My||(My=!0,t(cv).to(ky).inSingletonScope(),t(ev).toService(cv))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ey=class extends Yf{constructor(){super(),this.numberType=Fu,this.builtinContributions=[Cm],this.init()}drawShape(t,e,i,s,n){const r=Cc(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=Wp(o,l,!0),d=Wp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Cc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Pf(e,i-t,s-n,v,_,f,!0)),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=Cc(t).richtext;this._draw(t,s,!1,i)}};Ey=wy([Ya(),Cy("design:paramtypes",[])],Ey);let By=!1;const Py=new Ra((t=>{By||(By=!0,t(hv).to(Ey).inSingletonScope(),t(ev).toService(hv))}));let Ly=!1;const Ry=new Ra((t=>{Ly||(Ly=!0,t(dv).to(qm).inSingletonScope(),t(ev).toService(dv),t(eg).toService(_f),co(t,eg))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Fy=(t,e)=>(d(jy.warnHandler)&&jy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),zy=(t,e,i)=>{if(!d(jy.errorHandler))throw new Error(t);jy.errorHandler.call(null,t,e)},jy={silent:!1,warnHandler:!1,errorHandler:!1},Hy=P_(),Vy=Hy&&globalThis?globalThis.document:void 0;function Ny(t){return("desktop-browser"===t||"mobile-browser"===t)&&Hy}function Uy(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Gy=0;function Yy(){return Gy>=9999999&&(Gy=0),Gy++}function $y(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Ky=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class qy extends Cp{constructor(t,e){super(t),this._skipRenderAttributes=Ky,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},kb=(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,e={}){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.startTime=Dc.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=Dc.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||Ab(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=kb(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=Dc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Ab(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("pointerleave",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("pointerleave",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=Dc.now()-i>this.config.press.time&&kb(s[0],t){yo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Cb=[0,0,0];let Eb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Wl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},$l),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Vt;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(f,-2*y),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&&vp.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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[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&&(Ku(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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,e=yo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=yo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:$l.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:$l.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&&(Ku(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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=fh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:gh(this,a,this.dpr),r.strokeStyle=fh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Zu.free(t))),this.stack.length=0}};Eb.env="browser",Eb=Tb([Ya(),wb("design:paramtypes",[Object,Number])],Eb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lb=class extends rp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=yo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Eb(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 Rb(t,e){return new Ra((i=>{i(Lh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Rh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Lb.env="browser",Lb=Bb([Ya(),Pb("design:paramtypes",[Object])],Lb);const Ob=Rb(Lb,Eb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fb=function(t,e){return function(i,s){e(i,s,t)}};let zb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=hc.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 Hb=class{constructor(){this.type="group",this.numberType=Pu}contains(t,e,i){return!1}};Hb=jb([Ya()],Hb);const Vb=new Ra(((t,e,i,s)=>{Vb.__vloaded||(Vb.__vloaded=!0,t(xb).to(Hb).inSingletonScope(),t(Sb).toService(xb),co(t,Sb))}));Vb.__vloaded=!1;var Nb=Vb;const Ub=new Ra(((t,e,i,s)=>{i(zb)||t(zb).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(zb):t(Ev).toService(zb)}));var Wb,Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let $b=Wb=class extends H_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=yo.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Lb(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 Lb({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)}};$b.env="browser",$b.idprefix="visactor_window",$b.prefix_count=0,$b=Wb=Gb([Ya(),Yb("design:paramtypes",[])],$b);const Xb=new Ra((t=>{t($b).toSelf(),t(pc).toDynamicValue((t=>t.container.get($b))).whenTargetNamed($b.env)}));var Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zb=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 Jb{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 Qb(t,e=!1){const i=document.createElement("img");if(yo.global.isImageAnonymous&&(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 tx=class extends F_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Jb(t)}return new Ve}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 Qb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qb(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:La.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(...t){}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}}loadFont(t,e,i){return Zb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};tx=Kb([Ya(),qb("design:paramtypes",[])],tx);const ex=new Ra((t=>{ex.isBrowserBound||(ex.isBrowserBound=!0,t(tx).toSelf().inSingletonScope(),t(fo).toService(tx))}));function ix(t,e=!0){ix.__loaded||(ix.__loaded=!0,t.load(ex),t.load(Ob),t.load(Xb),e&&function(t){t.load(Nb),t.load(Ub)}(t))}ex.isBrowserBound=!1,ix.__loaded=!1;var sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 nx=class extends Eb{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}};nx.env="feishu",nx=sx([Ya()],nx);var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let ox=class extends rp{constructor(t){super(t)}init(){this._context=new nx(this,this._dpr)}release(...t){}};ox.env="feishu",ox=rx([Ya(),ax("design:paramtypes",[Object])],ox);const lx=Rb(ox,nx);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},cx=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)}};class ux{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 px=class extends H_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ux}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:La.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new ox(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 ox({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()}};px.env="feishu",px=hx([Ya(),dx(0,Wa(mo)),cx("design:paramtypes",[Object])],px);const gx=new Ra((t=>{t(px).toSelf(),t(pc).toDynamicValue((t=>t.container.get(px))).whenTargetNamed(px.env)}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 sp(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}};_x=fx([Ya(),vx(0,Wa(lo)),vx(0,$a(Zy)),vx(1,Wa(lo)),vx(1,$a(Pv)),vx(2,Wa(lo)),vx(2,$a(Lv)),mx("design:paramtypes",[Object,Object,Object])],_x);const yx=new Ra((t=>{yx.__vloaded||(yx.__vloaded=!0,co(t,Zy))}));yx.__vloaded=!1;var bx=yx;class xx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:gh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Mx=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};Mx=Sx([Ya(),kx(0,Wa(Jm)),Ax("design:paramtypes",[Object])],Mx);let Tx=!1;const wx=new Ra(((t,e,i,s)=>{Tx||(Tx=!0,t(Jy).to(Mx).inSingletonScope(),t(Zy).toService(Jy))}));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)},Bx=function(t,e){return function(i,s){e(i,s,t)}};let Px=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};Px=Cx([Ya(),Bx(0,Wa(Qm)),Ex("design:paramtypes",[Object])],Px);let Lx=!1;const Rx=new Ra(((t,e,i,s)=>{Lx||(Lx=!0,t(Qy).to(Px).inSingletonScope(),t(Zy).toService(Qy))}));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},Ix=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 xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};Fx=Ox([Ya(),Dx(0,Wa(tv)),Ix("design:paramtypes",[Object])],Fx);let zx=!1;const jx=new Ra(((t,e,i,s)=>{zx||(zx=!0,t(tb).to(Fx).inSingletonScope(),t(Zy).toService(tb))}));class Hx{constructor(){this.type="glyph",this.numberType=Bu}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},Nx=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 Wx=class extends Hx{constructor(t){super(),this.canvasRenderer=t}};Wx=Vx([Ya(),Ux(0,Wa(cv)),Nx("design:paramtypes",[Object])],Wx);let Gx=!1;const Yx=new Ra(((t,e,i,s)=>{Gx||(Gx=!0,t(lb).to(Wx).inSingletonScope(),t(Wx).toService(lb))}));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 Xx=class{constructor(){this.type="image",this.numberType=Lu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Xx=$x([Ya()],Xx);let Kx=!1;const qx=new Ra(((t,e,i,s)=>{Kx||(Kx=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=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 tS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};tS=Zx([Ya(),Qx(0,Wa(sv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new Ra(((t,e,i,s)=>{eS||(eS=!0,t(ib).to(tS).inSingletonScope(),t(Zy).toService(ib))}));var sS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rS=function(t,e){return function(i,s){e(i,s,t)}};let aS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};aS=sS([Ya(),rS(0,Wa(rv)),nS("design:paramtypes",[Object])],aS);let oS=!1;const lS=new Ra(((t,e,i,s)=>{oS||(oS=!0,t(ob).to(aS).inSingletonScope(),t(Zy).toService(ob))}));var hS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dS=function(t,e){return function(i,s){e(i,s,t)}};let uS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};uS=hS([Ya(),dS(0,Wa(nv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new Ra(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(uS).inSingletonScope(),t(Zy).toService(sb))})),fS=new Ve;class mS{constructor(){this.type="rect",this.numberType=Du}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:gh(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;fS.setValue(i.x1,i.y1,i.x2,i.y2),fS.expand(-r/2),h=!fS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var vS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yS=function(t,e){return function(i,s){e(i,s,t)}};let bS=class extends mS{constructor(t){super(),this.canvasRenderer=t}};bS=vS([Ya(),yS(0,Wa(av)),_S("design:paramtypes",[Object])],bS);let xS=!1;const SS=new Ra(((t,e,i,s)=>{xS||(xS=!0,t(nb).to(bS).inSingletonScope(),t(Zy).toService(nb))}));let AS=!1;const kS=new Ra(((t,e,i,s)=>{AS||(AS=!0,t(eb).to(Xx).inSingletonScope(),t(Xx).toService(eb))}));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},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wS=function(t,e){return function(i,s){e(i,s,t)}};let CS=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}};CS=MS([Ya(),wS(0,Wa(ov)),TS("design:paramtypes",[Object])],CS);let ES=!1;const BS=new Ra(((t,e,i,s)=>{ES||(ES=!0,t(rb).to(CS).inSingletonScope(),t(Zy).toService(rb))}));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};let LS=class{constructor(){this.type="text",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};LS=PS([Ya()],LS);let RS=!1;const OS=new Ra(((t,e,i,s)=>{RS||(RS=!0,t(ab).to(LS).inSingletonScope(),t(Zy).toService(ab))})),IS=new Ra(((t,e,i,s)=>{i(_x)||t(_x).toSelf().inSingletonScope(),i(Ev)?s(Ev).toService(_x):t(Ev).toService(_x)}));class DS{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 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},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let jS=class extends F_{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 DS(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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};jS=FS([Ya(),zS("design:paramtypes",[])],jS);const HS=new Ra((t=>{HS.isFeishuBound||(HS.isFeishuBound=!0,t(jS).toSelf().inSingletonScope(),t(fo).toService(jS))}));function VS(t,e=!0){VS.__loaded||(VS.__loaded=!0,t.load(HS),t.load(lx),t.load(gx),e&&function(t){t.load(bx),t.load(IS),t.load(wx),t.load(Rx),t.load(jx),t.load(Yx),t.load(qx),t.load(iS),t.load(lS),t.load(gS),t.load(SS),t.load(kS),t.load(BS),t.load(OS)}(t))}HS.isFeishuBound=!1,VS.__loaded=!1;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},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends Eb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};WS.env="node",WS=NS([Ya(),US("design:paramtypes",[Object,Number])],WS);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},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let $S=class extends rp{constructor(t){super(t)}init(){this._context=new WS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};$S.env="node",$S=GS([Ya(),YS("design:paramtypes",[Object])],$S);const XS=Rb($S,WS);var KS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ZS=function(t,e){return function(i,s){e(i,s,t)}};let JS=class extends H_{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:La.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new $S(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new $S({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};JS.env="node",JS=KS([Ya(),ZS(0,Wa(mo)),qS("design:paramtypes",[Object])],JS);const QS=new Ra((t=>{t(JS).toSelf(),t(pc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)}));var tA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eA=class extends F_{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 ed.call(t)}}getCancelAnimationFrame(){return t=>{ed.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};eA=tA([Ya()],eA);const iA=new Ra((t=>{iA.isNodeBound||(iA.isNodeBound=!0,t(eA).toSelf().inSingletonScope(),t(fo).toService(eA))}));function sA(t,e=!0){sA.__loaded||(sA.__loaded=!0,t.load(iA),t.load(XS),t.load(QS))}iA.isNodeBound=!1,sA.__loaded=!1;var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Tu}};oA=nA([Ya(),aA(0,Wa(Jm)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new Ra(((t,e,i,s)=>{lA||(lA=!0,t(hb).to(oA).inSingletonScope(),t(Sb).toService(hb))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends mS{constructor(t){super(),this.canvasRenderer=t}};pA=cA([Ya(),uA(0,Wa(av)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new Ra(((t,e,i,s)=>{gA||(gA=!0,t(fb).to(pA).inSingletonScope(),t(Sb).toService(fb))}));class mA extends Yf{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:gh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ru}};bA=vA([Ya(),yA(0,Wa(sv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new Ra(((t,e,i,s)=>{xA||(xA=!0,t(pb).to(bA).inSingletonScope(),t(Sb).toService(pb))}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MA=function(t,e){return function(i,s){e(i,s,t)}};let TA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Cu}};TA=AA([Ya(),MA(0,Wa(Qm)),kA("design:paramtypes",[Object])],TA);let wA=!1;const CA=new Ra(((t,e,i,s)=>{wA||(wA=!0,t(cb).to(TA).inSingletonScope(),t(Sb).toService(cb))}));class EA extends Yf{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&&Ju.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let RA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=zu}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:gh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Ju.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};RA=BA([Ya(),LA(0,Wa(ov)),PA("design:paramtypes",[Object])],RA);let OA=!1;const IA=new Ra(((t,e,i,s)=>{OA||(OA=!0,t(mb).to(RA).inSingletonScope(),t(Sb).toService(mb))}));var DA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};let jA=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Eu}};jA=DA([Ya(),zA(0,Wa(tv)),FA("design:paramtypes",[Object])],jA);let HA=!1;const VA=new Ra(((t,e,i,s)=>{HA||(HA=!0,t(db).to(jA).inSingletonScope(),t(Sb).toService(db))}));var NA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let GA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=ju}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=hg(a,u,n),v=lg(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&&Ju.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};GA=NA([Ya(),WA(0,Wa(lv)),UA("design:paramtypes",[Object])],GA);let YA=!1;const $A=new Ra(((t,e,i,s)=>{YA||(YA=!0,t(vb).to(GA).inSingletonScope(),t(Sb).toService(vb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ou}};ZA=XA([Ya(),qA(0,Wa(nv)),KA("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new Ra(((t,e,i,s)=>{JA||(JA=!0,t(gb).to(ZA).inSingletonScope(),t(Sb).toService(gb))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ek=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 sk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Iu}};sk=tk([Ya(),ik(0,Wa(rv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new Ra(((t,e,i,s)=>{nk||(nk=!0,t(_b).to(sk).inSingletonScope(),t(Sb).toService(_b))}));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 Hx{constructor(t){super(),this.canvasRenderer=t}};hk=ak([Ya(),lk(0,Wa(cv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new Ra(((t,e,i,s)=>{ck||(ck=!0,t(bb).to(hk).inSingletonScope(),t(Sb).toService(bb))}));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 fk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};fk=uk([Ya(),gk(0,Wa(hv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new Ra(((t,e,i,s)=>{mk||(mk=!0,t(yb).to(fk).inSingletonScope(),t(Sb).toService(yb))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends xx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Lu}};xk=_k([Ya(),bk(0,Wa(dv)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new Ra(((t,e,i,s)=>{Sk||(Sk=!0,t(ub).to(xk).inSingletonScope(),t(Sb).toService(ub))})),kk=P_();function Mk(){Mk.__loaded||(Mk.__loaded=!0,hf.RegisterGraphicCreator("arc",sf),vo.load(ay),vo.load(kk?hA:wx))}Mk.__loaded=!1;const Tk=Mk;function wk(){wk.__loaded||(wk.__loaded=!0,hf.RegisterGraphicCreator("area",Qg),vo.load(uy),vo.load(kk?CA:Rx))}wk.__loaded=!1;const Ck=wk;function Ek(){Ek.__loaded||(Ek.__loaded=!0,hf.RegisterGraphicCreator("circle",_g),vo.load(my),vo.load(kk?VA:jx))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,hf.RegisterGraphicCreator("glyph",Og),vo.load(Ty),vo.load(kk?dk:Yx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,hf.RegisterGraphicCreator("group",Ep))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,hf.RegisterGraphicCreator("image",Hg),vo.load(Ry),vo.load(kk?Ak:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,hf.RegisterGraphicCreator("line",Cg),vo.load(cy),vo.load(kk?SA:iS))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,hf.RegisterGraphicCreator("path",qg),vo.load(by),vo.load(kk?QA:gS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,hf.RegisterGraphicCreator("polygon",af),vo.load(Sy),vo.load(kk?rk:lS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,hf.RegisterGraphicCreator("rect",Lg),vo.load(ly),vo.load(kk?fA:SS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,hf.RegisterGraphicCreator("richtext",$g),vo.load(Py),vo.load(kk?vk:kS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,hf.RegisterGraphicCreator("shadowRoot",lf))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,hf.RegisterGraphicCreator("symbol",Mg),vo.load(gy),vo.load(kk?IA:BS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,hf.RegisterGraphicCreator("text",Sg),vo.load(_y),vo.load(kk?$A:OS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Ok(),Wk()}const tM=-.5*Math.PI,eM=1.5*Math.PI,iM="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 sM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sM||(sM={}));const nM={[sM.selectedReverse]:{},[sM.selected]:{},[sM.hover]:{},[sM.hoverReverse]:{}},rM={container:"",width:30,height:30,style:{}},aM="scrollDrag";function oM(){return"browser"===b_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const lM={debounce:xt,throttle:St};Qk();let hM=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=oM(),a="browser"===b_.env?b_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:lM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(aM,{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",lM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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]=ri(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)}_clearDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};hM.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};var cM,dM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 uM=cM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=La.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=cM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(aM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new hM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(uM)||(t(uM).toSelf(),t(Hv).toService(uM))}));function gM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&gM(t,e)}))}const fM=t=>!u(t)&&!1!==t.visible;function mM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function vM(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 yM=["#ffffff","#000000"];function bM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return xM(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(...yM);for(const n of a)if(t!==n&&xM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function xM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(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=AM(t),s=AM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function AM(t){const e=si(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 kM(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 MM(t,e){return[t[0]*e,t[1]*e]}function TM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const CM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:iM,fontSize:14},s),getTextBounds:i?void 0:uf,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function EM(t,e,i={}){if(!t)return{width:0,height:0};const s=uf({text:t,fontFamily:e.fontFamily||i.fontFamily||iM,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 BM(t,e="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 PM(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 LM(t,e="type"){const i=BM(t,e);return"rich"===i?hf.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),hf.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 DM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function FM(){Ok(),Wk(),qk(),Yk(),Jk()}var zM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=zM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Hl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},jM.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))}}jM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const HM={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}},VM={poptip:j({},HM)};var NM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}KM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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 ZM=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={};j(s,KM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new KM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,VM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};ZM=qM([Ya()],ZM);var JM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 QM{constructor(){this.activeEvent="onRegister",this._uid=La.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 tT=class extends QM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};tT=JM([Ya()],tT);let eT=class extends QM{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)}};eT=JM([Ya()],eT);const iT=new Ra(((t,e,i,s)=>{i(ZM)||(t(ZM).toSelf().inSingletonScope(),t(og).toService(ZM)),i(tT)||(t(tT).toSelf(),t(Hv).toService(tT)),i(eT)||(t(eT).toSelf(),t(Hv).toService(eT))}));class sT extends qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ok(),zk();class nT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nT.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})}}nT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ok(),Wk();class rT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Tk();class aT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}aT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ok(),Tk();class oT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=tM,endAngle:s=eM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}oT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Hk();class lT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function hT(){Ok(),zk(),Nk(),qk()}function cT(){Ok(),zk(),Tk(),qk()}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},hT();class dT extends qy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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(k(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=hf.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),P(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=hf.line;Y(i)[0].cornerRadius&&(t=hf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=hf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}dT.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}}},cT();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=hf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var pT,gT;!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"}(pT||(pT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gT||(gT={}));const fT={[gT.selectedReverse]:{},[gT.selected]:{},[gT.hover]:{},[gT.hoverReverse]:{}},mT={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}}},vT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const _T=Math.sin(Math.PI/10);function yT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function bT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function xT(t){const e={};return gM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ST(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function AT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return MM(r,(s?-1:1)*(n?-1:1)*t/TM(r))}function kT(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 TT(t,e,i){var s;if(bT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function wT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(sM.hover,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.hoverReverse,!0)})),s):i},ET=(t,e,i)=>i?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),null):i,BT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(sM.selected)?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.selectedReverse),t.removeState(sM.selected))})),null):s.name&&!P(s.states)?(s.addState(sM.selected,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.selectedReverse,!0)})),s):i};class PT extends qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const LT={type:"default",duration:300,easing:"linear"};class RT extends PT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=CT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=hf.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._prepare(),this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(LT)}_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=hf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pT.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=hf.group({x:0,y:0,pickable:!1});t.name=pT.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=hf.group({x:0,y:0,pickable:!1});i.name=pT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=hf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=pT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=nM;else{const t=this.data[s],e=j({},nM,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=hf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=pT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=nM;else{const i=j({},nM,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=hf.group({x:0,y:0,pickable:!1});return r.name=`${pT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=LM(this._getLabelAttribute(t,e,n,i));if(a.name=pT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=nM;else{const s=j({},nM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new jM(Object.assign({},e));i.name=pT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ST(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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},mT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},gM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const OT={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&&TT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function IT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function DT(t,e,i,s,n=!1){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:OT[n]||OT.parity;if(s.length>=3&&wT(s,r)){do{s=a(s,r)}while(s.length>=3&&wT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);TT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),DT(l,s,n,(t=>TT(t,l,r))),DT(h,s,o,(t=>TT(t,h,r)||!(!n||t===l)&&TT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function zT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},VT(t,e.attribute.angle)),{angle:HT(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({},NT(t,e.attribute.angle)),{angle:HT(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 HT(t=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 VT(t,e=0){let 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=HT(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 NT(t,e=0){let 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=HT(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 UT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=bT(h),m=yT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 WT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class GT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=TM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return MM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class YT{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-YT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*YT.bounceIn(2*t):.5*YT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){YT[t]=e}}function $T(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}YT.quadIn=YT.getPowIn(2),YT.quadOut=YT.getPowOut(2),YT.quadInOut=YT.getPowInOut(2),YT.cubicIn=YT.getPowIn(3),YT.cubicOut=YT.getPowOut(3),YT.cubicInOut=YT.getPowInOut(3),YT.quartIn=YT.getPowIn(4),YT.quartOut=YT.getPowOut(4),YT.quartInOut=YT.getPowInOut(4),YT.quintIn=YT.getPowIn(5),YT.quintOut=YT.getPowOut(5),YT.quintInOut=YT.getPowInOut(5),YT.backIn=YT.getBackIn(1.7),YT.backOut=YT.getBackOut(1.7),YT.backInOut=YT.getBackInOut(1.7),YT.elasticIn=YT.getElasticIn(1,.3),YT.elasticOut=YT.getElasticOut(1,.3),YT.elasticInOut=YT.getElasticInOut(1,.3*1.5),YT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),YT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},YT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)YT[`flicker${t}`]=e=>$T(e,t);for(let t=2;t<10;t++)YT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function XT(t,e,i){return t+(e-t)*i}const KT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=XT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=XT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=XT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=XT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=XT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=XT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=XT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=XT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=XT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=hp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?dp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=hp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?dp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=XT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=XT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=XT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=XT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=XT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=XT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=XT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Jc(e,i,s),r.addUpdateBoundTag()}}};function qT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=YT[s])&&void 0!==n?n:YT.linear:YT.linear,"wait"===t&&(this.onUpdate=ZT),this.id=La.GenAutoIncrementId(),this.syncAttributeUpdate=ZT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=op.Get(i,ap.Color255),r=op.Get(s,ap.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(KT["fill"===e?"fillPure":"strokePure"])}else KT[e]?t.push(KT[e]):t.push(qT)}else KT[e]?t.push(KT[e]):t.push(qT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class QT extends JT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=La.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Po.END?this.removeAnimate(t,!0):t.status!==Po.RUNNING&&t.status!==Po.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ew=new tw;ew.isGlobal=!0;class iw{constructor(t=La.GenAutoIncrementId(),e=ew,i){this.id=t,this.status=Po.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new JT(Bo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new QT(Bo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new JT(Bo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Po.RUNNING&&(this.status=Po.PAUSED)}resume(){this.status===Po.PAUSED&&(this.status=Po.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Po.END&&this.onEnd(),this.status=Po.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Po.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Po.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Po.END);this.status=Po.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const sw=new xo;class nw{constructor(){this.released=!1}tick(t,e){sw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class rw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Eo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Eo.INITIAL,yo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),yo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new nw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Eo.INITIAL&&(this.status=Eo.PAUSE,!0)}resume(){return this.status!==Eo.INITIAL&&(this.status=Eo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Eo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Eo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Eo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}ow.getInstance();class lw{static registerBuiltInAnimate(t,e){lw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Po.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}lw.builtInAnimateMap={};const hw="appear",cw="disappear",dw="update",uw="highlight",pw="unhighlight";class gw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=ow.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hw],[{name:hw,animation:t}],e)}applyDisappearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyUpdateState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyHighlightState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mw)._getAnimationStateManager(t),t}}class vw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new iw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:ew,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new tw}createTicker(t){return new rw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _w(){G(Tp,mw),G(Tp,vw)}class yw extends JT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bw extends yw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Sw(t){return new xw(t)}class Aw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kw=1e3,Mw="quadInOut",Tw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],ww=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=hp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Cw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Z_(t):[],n=Z_(e);i&&s&&(i.fromTransform&&J_(s,i.fromTransform.clone().getInverse()),J_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Bw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Pw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Bw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?op.Get(t,ap.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lw extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Cw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&ww(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Rw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Ew(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Pw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Mw);return c.play(d),c};class Ow extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Cw(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&ww(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Iw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Tw.includes(t))(i)||(e[i]=t[i])})),e},Dw=(t,e,i)=>{const s=Iw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=yo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Fw=(t,e,i)=>{const s=[],n=i?null:Iw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Iw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Eg(t.attribute),n=ty(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(yo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ty(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ty(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(yo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ey(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ey(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(yo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:iy(i)}];const s=[];return ny(i,e,s),s})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ny(l,e,h),h})(t,e).forEach((t=>{s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Z_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(yo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(yo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Dw(t,s,e),s};class jw extends yw{constructor(t,e,i,s,n){super(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(){super.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:Yo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Yo.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:Yo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Hw extends jw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=yo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vw extends jw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=yo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Nw extends yw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Zc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Uw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends Uw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const $w=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Xw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Kw extends Xw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$w(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class qw extends Xw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Zw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Jw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Qw=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class tC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Qw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const iC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class sC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Zc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class nC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:iC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class rC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:iC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const aC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class oC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:aC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class lC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:aC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const hC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class cC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class dC extends sC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const uC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class pC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends pC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=uC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class fC extends pC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const mC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class vC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=mC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _C extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{onBind(){var t;const e=Sw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class bC extends bw{onBind(){const t=Sw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function xC(){Ok(),zk(),Yk(),Jk(),lw.registerBuiltInAnimate("axisEnter",yC),lw.registerBuiltInAnimate("axisUpdate",bC)}var SC=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=hf.group({zIndex:999});e.name=pT.axisBreak,e.id=this._getNodeId(`${pT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},vT,s),a=null!==(e=r.size)&&void 0!==e?e:vT.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=hf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=pT.axisBreakSymbol;const h=hf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=pT.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=hf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=pT.background,n.id=this._getNodeId("background"),n.states=j({},fT,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=SC(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];P(l)||(c.state={line:j({},fT,l),symbol:j({},fT,l)});const d=new dT(c);d.name=pT.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=SC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},fT,c.text),shape:j({},fT,c.shape),panel:j({},fT,c.background)}});return E.angle=w,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 VT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return NT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=ae(e)})),jT(i,t),!zT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=bT(a),l=yT(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=WT(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);k(i)&&(c=Yt(c,i))}}else{if(l){const i=WT(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);k(i)&&(c=Yt(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&&k(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);UT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&FT(t,{orient:o,method:m,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(k(c)&&(!k(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=hf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pT.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=EM(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=ri(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}}AC.defaultAttributes=mT,G(AC,GT);class kC{isInValidValue(t){const{startAngle:e=tM,endAngle:i=eM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=tM,endAngle:i=eM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return AT(t,i,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 MC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=MC(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 CC=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),k(l)&&l>=3){const t=kT(n,l,c,e,i);h=hf.path(Object.assign(Object.assign({},a.style),{path:MT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=hf.circle(t)}h.name=pT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},fT,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=CC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},fT,d.text),shape:j({},fT,d.shape),panel:j({},fT,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}=MC(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&&TC(e,c,i)}else e.AABBBounds.width()>r&&TC(e,r,i)}else o>a.x&&h.x2>n.x2?(TC(e,n.x2-o,i),r&&wC(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}}EC.defaultAttributes=mT,G(EC,kC);const BC=t=>t.map(((t,e)=>({index:e,value:t}))),PC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},LC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=CM(a),_=t.range();let y=[];for(let i=0;i{IC[t]=!0}));const HC=t=>-Math.log(-t),VC=t=>-Math.exp(-t),NC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,UC=t=>10===t?NC:t===Math.E?Math.exp:e=>Math.pow(t,e),WC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),GC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),YC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function $C(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 XC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function KC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function qC(t,e,i,s){return 1===i&&(i=0),KC(t,i,s)*(e/(1-i))}function ZC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function JC(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]{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 tE{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=ZC(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 eE=Symbol("implicit");class iE extends tE{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=OC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=eE}clone(){const t=(new iE).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!==eE)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 sE(t,e,r,n)}class rE extends iE{constructor(t){super(),this.type=OC.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=qC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:nE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return nE(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 rE(!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:aE}=ni;function oE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return At(t,e);if("string"===i){if(s=ei.parseColorString(e)){const e=aE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?aE(t,e):e instanceof ei?aE(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):At(Number(t),Number(e))}class lE extends tE{constructor(t=jC,e=jC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jC,this._piecewise=XC,this._interpolate=oE}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),At)),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=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=yt(i[0],i[r-1])),this._piecewise=r>2?JC:XC,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:jC),this.rescale(i)):this._clamp!==jC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 hE=Math.sqrt(50),cE=Math.sqrt(10),dE=Math.sqrt(2),uE=[1,2,5,10],pE=(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=vE(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?fE(0,-(e-1)/s,s):fE((e-1)/s,0,s)},gE=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 pE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pE(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=fE(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=fE(t,e,l);return n&&r.reverse(),r})),vE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uE[0];return i>=hE?s=uE[3]:i>=cE?s=uE[2]:i>=dE&&(s=uE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _E(t,e,i){const s=(e-t)/Math.max(0,i);return vE(s)}function yE(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;e0;){if(s=_E(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function xE(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 SE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AE=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})),kE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=mE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SE(t,e,n):SE(t,e,QC(n)),h=SE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),ME=mt(((t,e,i,s,n)=>yE(s(t),s(e),i).map((t=>QC(n(t))))));class TE extends lE{constructor(){super(...arguments),this.type=OC.Linear}clone(){var t;const e=new TE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return gE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=mE(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(t=10){const e=this.calculateVisibleDomain(this._range);return yE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 CE(t){return e=>-t(-e)}function EE(t=Number.EPSILON){return e=>Math.max(e,t)}class BE extends lE{constructor(){super(WC(10),UC(10)),this.type=OC.Log,this._limit=EE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new BE).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=WC(this._base),s=UC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=HC,this.untransformer=VC):(this._logs=i,this._pows=s,this._limit=EE(),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 jC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return AE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(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))))}}}G(BE,wE);class PE extends TE{constructor(){super(GC(1),YC(1)),this.type=OC.Symlog,this._const=1}clone(){return(new PE).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=GC(t),this.untransformer=YC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return AE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(PE,wE);class LE{constructor(){this.type=OC.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)&&k(+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 LE).domain(this._domain).range(this._range).unknown(this._unknown)}}function RE(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 OE(t,e,i,s,n=!1){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,n,r;if(!DC(t.type))return BC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return BC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=RE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=RE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=RE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=RC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=RC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?DE.greedy:DE.parity;for(;l.length>=3&&wT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;TT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),OE(t,l,a,(e=>TT(e,t,i))),OE(n,l,o,(e=>TT(e,n,i)||!(!a||e===t)&&TT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return BC(m)},DE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&TT(i,t,e)||(i=t,0))))}},FE=(t,e,i,s)=>{const n=RC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},zE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,jE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?BC([s[s.length-1]]):BC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=FE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=VE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=FE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!zE(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?jE(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=CM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=ST(r,AT(s,r,e,n));return o=a,l=AT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 BC(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=NE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WE(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 BC(c)},WE=(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&&PC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},GE=new Uint32Array(33),YE=new Uint32Array(33);YE[0]=0,GE[0]=~YE[0];for(let t=1;t<=32;++t)YE[t]=YE[t-1]<<1|1,GE[t]=~YE[t];function $E(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&GE[31&o]&YE[1+(31&l)])return!0}else{if(i[h]&GE[31&o])return!0;if(i[c]&YE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,GE[31&o]&YE[1+(31&l)]);else for(s(h,GE[31&o]),s(c,YE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,YE[31&a]|GE[1+(31&o)]);else for(n(l,YE[31&a]),n(h,GE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 XE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function KE(t,e,i=!1){return i?XE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function qE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=KE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=XE(t,r)),e.getRange(r)))}function ZE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return ZE(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 ZE(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 ZE(t,e,n,s,h,c)}return!1}const QE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],tB=["top","inside-top","inside"];function eB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const iB={mode:"same-time",duration:300,easing:"linear"};function sB(t){return 3===t||4===t}function nB(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 rB=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 aB(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)}}var oB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const cB=(t,e)=>Math.ceil(t)>Math.floor(e),dB=([t,e],[i,s])=>s>t&&e>i;function uB(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 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);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(sM.hover,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gM(this,(t=>{P(t.states)||(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void gM(this,(t=>{P(t.states)||(t.removeState(sM.selectedReverse),t.removeState(sM.selected))}));P(e.states)||(e.addState(sM.selected,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.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)===Yo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Yo.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(Se(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[aB(g,f,c,d,a,o),aB(-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=hf.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.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return LM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&cB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&cB(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(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(uB([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])&&!dB([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 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},h),{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(KE(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(KE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(KE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{fB[t]=e};var vB=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{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,i,s)}}_B.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const yB=()=>{mB("symbol",_B),mB("line-data",_B)};var bB=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{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}}}xB.tag="rect-label",xB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var SB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};AB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const kB=()=>{mB("line",AB),mB("area",AB)};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);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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new TB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):sB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(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=sB(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=sB(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&&(ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=sB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?sB(t.quadrant)?"left":"right":sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 BB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 PB(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=MT(t,!!n),o=MT(r,!!n);const h=re.distancePP(s,l),c=re.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=BB(e,t,!1,!!n),o=BB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=MT(t,!!n),o=MT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}EB.defaultAttributes={pickable:!1};class LB extends qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=hf.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 ST(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?`${pT.grid}-sub`:`${pT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=MT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BB(t,o,!1,!!a)}const u=hf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:LB.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=MT(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=hf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:LB.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}}LB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ok(),Hk();class RB extends LB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LB.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=tM,endAngle:r=eM}=this.attribute;i=kT(t,s,re.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=j({},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})}}G(RB,GT);var OB=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"})}}G(IB,kC);const DB="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",FB={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:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zB={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 jB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={}));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);nt,this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===b_.env?b_:this.stage,s=oM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===jB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===jB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=jB.endHandler):h+=l:this._activeTag===jB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===jB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===b_.env?b_:this.stage,e=oM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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===jB.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===jB.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=HB(c,["formatMethod"]),{formatMethod:g}=d,f=HB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 He).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},zB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},zB.horizontal),V),{pickable:!U&&(null===(b=V.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},zB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},zB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},zB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},zB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zB.vertical),{pickable:!U}),"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 jM(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)}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var UB,WB,GB,YB;function $B(){Ok(),FM(),_w()}NB.defaultAttributes=FB,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"}(UB||(UB={})),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"}(WB||(WB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(GB||(GB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(YB||(YB={}));class XB extends qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=CT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=hf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=hf.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=hf.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 KB(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 qB(t,e,i,s){t&&(KB(t.startSymbol,e,i,s),t.lines.forEach((t=>KB(t,e,i,s))),KB(t.line,e,i,s),KB(t.endSymbol,e,i,s))}function ZB(t,e,i,s){t&&(KB(t.getTextShape(),e,i,s),KB(t.getBgRect(),e,i,s))}function JB(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 QB(t,e,i,s){t&&(JB(t.startSymbol,e,i,s),t.lines.forEach((t=>JB(t,e,i,s))),JB(t.line,e,i,s),JB(t.endSymbol,e,i,s))}function tP(t,e,i,s){t&&(JB(t.getTextShape(),e,i,s),JB(t.getBgRect(),e,i,s))}function eP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;KB(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)})),KB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;KB(t.getTextShape(),e,l,n),KB(t.getBgRect(),e,l,n)}))}function iP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function sP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function nP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function rP(t,e,i,s,n,r){var a;qB(t,n,s,r),KB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?ZB(i,n,s,r):KB(i,n,s,r)}function aP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;KB(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)})),KB(e,n+o+l,h,r),KB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(KB(i.getTextShape(),n+o+l+h+c,d,r),KB(i.getBgRect(),n+o+l+c,d,r)):KB(i,n+o+l+c,d,r)}function oP(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?eP(t,e,s,r,a):"fadeIn"===i&&iP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?eP(t,e,s,n,a):"fadeIn"===i&&iP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function lP(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&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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?rP(n,r,e,i,s,o):"callIn"===t&&aP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?rP(n,r,e,i,s,a):"callIn"===t&&aP(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;QB(t,n,s,r),JB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?tP(i,n,s,r):JB(i,n,s,r)}(n,r,e,t,i,s)}}const dP={type:"clipIn",duration:500,easing:"linear",delay:0},uP={type:"fadeIn",duration:500,easing:"linear",delay:0},pP={type:"callIn",duration:500,easing:"linear",delay:0},gP={type:"fadeOut",duration:500,easing:"linear",delay:0};class fP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new jM(Object.assign(Object.assign({},h),{state:{panel:j({},nM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},nM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},nM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},nM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class mP extends XB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=dP,this.defaultExitAnimation=gP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;DM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(mP,fP);const vP=.001,_P={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:UB.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]}},yP={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"}}},bP={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:{autoRotate:!0,position:GB.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]}},xP={interactive:!0,label:{position:WB.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}},SP={interactive:!0,label:{autoRotate:!0,position:GB.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}},AP={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"}},kP={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"}},MP={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 TP(){wP._animate=oP}$B(),hT(),_w();class wP extends mP{markerAnimate(t){wP._animate&&this._animationConfig&&wP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(mM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return vM(Math.abs(e),Math.PI/2,vP)||vM(Math.abs(e),3*Math.PI/2,vP)?_M(i,e,t):mM(e)?yP.postiveXAxis[t]:yP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new dT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",wP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(wP.defaultAttributes.label)}}function CP(){EP._animate=lP}wP.defaultAttributes=_P,$B(),Nk(),_w();class EP extends XB{markerAnimate(t){EP._animate&&this._animationConfig&&EP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},EP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=hf.polygon(Object.assign({points:e},i));n.states=j({},nM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",EP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},nM,null==i?void 0:i.area)),this._updateMarkLabels(EP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}EP.defaultAttributes=xP,G(EP,fP),$B(),cT(),_w();class BP extends mP{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case GB.arcInnerStart:l=n;case GB.arcOuterStart:l=n;break;case GB.arcInnerEnd:l=r;case GB.arcOuterEnd:l=r;break;case GB.center:case GB.arcInnerMiddle:case GB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return AP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new uT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",BP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(BP.defaultAttributes.label)}}BP.defaultAttributes=bP,$B(),Tk(),_w();class PP extends XB{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case GB.center:h=(s+n)/2,c=(r+a)/2;break;case GB.arcInnerStart:h=s,c=r;break;case GB.arcOuterStart:h=n,c=r;break;case GB.arcInnerEnd:h=s,c=a;break;case GB.arcOuterEnd:h=n,c=a;break;case GB.arcInnerMiddle:h=s,c=(r+a)/2;break;case GB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},AP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=hf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},nM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",PP.defaultAttributes.label)}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=j({},nM,null==o?void 0:o.area)),this._updateMarkLabels(PP.defaultAttributes.label)}isValidPoints(){return!0}}function LP(){RP._animate=cP}PP.defaultAttributes=SP,G(PP,fP),$B(),hT(),cT(),qk(),Dk(),zk(),_w();class RP extends XB{markerAnimate(t){RP._animate&&this._animationConfig&&RP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=gP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return vM(Math.abs(s),Math.PI/2,vP)||vM(Math.abs(s),3*Math.PI/2,vP)?_M(t,s,n):mM(s)?MP.postiveXAxis[n]:MP.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,style:d,position:u=YB.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},nM,null==p?void 0:p.textBackground),text:j({},nM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},nM,null==p?void 0:p.itemContent));const v=mM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=hf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"text"===n?o=new jM(Object.assign(Object.assign({},i),{state:{panel:j({},nM,null==s?void 0:s.textBackground),text:j({},nM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=hf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"image"===n?(o=hf.image(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},nM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=vM(c,0,vP)||vM(d,0,vP),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=OM(e-u,t-d),o=OM(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(NP.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(NP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===NP.focus||"focus"===o){const s=a.hasState(HP.focus);a.toggleState(HP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover,HP.focus],t),this._setLegendItemState(e,HP.selected,t)})):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover,HP.focus],t),this._setLegendItemState(e,HP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(VP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HP.selected,HP.selectedHover],t),this._setLegendItemState(a,HP.unSelected,t)):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t))}else this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover],t),this._setLegendItemState(e,HP.unSelected,t))}))}this._dispatchLegendEvent(VP.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,HP.selected),this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover])):(this._removeLegendItemState(e,[HP.selected,HP.selectedHover]),this._setLegendItemState(e,HP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FP,spaceRow:l=zP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=hf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ri(c);let w;!1===x.visible?(w=hf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,NP.item,t,w)):(w=hf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,NP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?HP.selected:HP.unSelected);const C=hf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=hf.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,NP.itemShape,t,w,S.state),s.addState(e?HP.selected:HP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=hf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,NP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=LM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,NP.itemLabel,t,w,A.state),D.addState(e?HP.selected:HP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=LM(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,NP.itemValue,t,w,k.state),r.addState(e?HP.selected:HP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 DP(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 DP(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 hM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new hM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FP,spaceRow:o=zP}=n,l=this._itemsContainer,{space:h=jP,defaultCurrent:c=1}=r,d=YP(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=hf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FP,spaceRow:a=zP}=s,o=this._itemsContainer,{space:l=jP,defaultCurrent:h=1}=n,c=YP(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 _=hf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=hf.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(HP.selected)?this._setLegendItemState(t,HP.selectedHover,e):this._setLegendItemState(t,HP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===NP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(VP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HP.unSelectedHover)||t.hasState(HP.selectedHover))&&(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HP.unSelectedHover)&&!t.hasState(HP.selectedHover)||(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===NP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(VP.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!==NP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(VP.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!==NP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},$P,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(HP.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 KP;function qP(t){return y(t)?t:[t,t]}function ZP(t){return t?"ew-resize":"ns-resize"}XP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FP,spaceRow:zP,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:jP,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"}(KP||(KP={})),WP();class JP extends qy{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:j({},JP.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===b_.env?b_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:qP(d)[0],endValue:qP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=hf.group({x:0,y:0});f.name=KP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=hf.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)),m.name=KP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=hf.group({x:g?v:0,y:g?0:v});f.add(_);const y=hf.group({x:0,y:0});let b;if(y.name=KP.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=hf.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=KP.endText,f.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=hf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KP.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,f]=qP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(v.name=KP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(i.name=KP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=KP.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 f=hf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=KP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":ZP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=hf.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=KP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return hf.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":ZP(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),hf.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=hf.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=hf.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),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=oM(),e="browser"===b_.env?b_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===KP.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===KP.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===KP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KP.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}}release(t){super.release(t),("browser"===b_.env?b_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}JP.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}}},GP(),WP();class QP extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},QP.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tL(t="bottom"){let 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`}QP.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"}}},GP(),WP(),Hk();class eL extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=hf.group({x:0,y:0});this._innerView.add(x);const S=new JP({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:tL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=hf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eL.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)"}},Ok(),Jk(),Yk();let iL=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},rM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},rM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};iL.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 sL={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"}}};Ok(),Jk(),Yk();let nL=class extends qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(sL,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=LM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=EM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 rL extends kg{constructor(t){super(t)}}var aL,oL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aL||(aL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oL||(oL={}));class lL extends qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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"},lL.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"},lL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.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 rL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rL(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(aL.OnPlay)},this.pause=()=>{this._dispatchEvent(aL.OnPause)},this.forward=()=>{this._dispatchEvent(aL.OnForward)},this.backward=()=>{this._dispatchEvent(aL.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()}}lL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lL.defaultAttributes={[oL.Start]:{},[oL.Pause]:{},[oL.Backward]:{},[oL.Forward]:{}};const hL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cL=[200,10];var dL,uL;!function(t){t.Default="default",t.Reverse="reverse"}(dL||(dL={})),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"}(uL||(uL={}));const pL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),fL=t=>"top"===t||"bottom"===t;class mL extends qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Gt(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:k(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(fL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cL[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:cL[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 JP(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=fL(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 lL(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=fL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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:fL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:fL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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 vL(){WP(),Ok(),qk()}mL.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({},hL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hL),{key:"backward",position:"start"})}},vL();class _L extends mL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:dL.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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=b_.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(uL.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(uL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=b_.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(),b_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.change),this.dispatchCustomEvent(uL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yL,bL=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())}))};vL();class xL extends mL{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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change))},this.play=()=>bL(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(uL.play),this._rafId=b_.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=b_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,b_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.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(uL.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.brushActive="brushActive",t.brushClear="brushClear"}(yL||(yL={}));const SL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},AL=5;const kL={debounce:xt,throttle:St};Ok(),Nk();let ML=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=SL.updateTrigger,endTrigger:i=SL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:kL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=SL.trigger,resetTrigger:e=SL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(yL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(yL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=AL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(yL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(yL.brushActive,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._dispatchBrushEvent(yL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=AL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=SL.updateTrigger,endTrigger:e=SL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=hf.polygon(Object.assign(Object.assign({points:I(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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};ML.defaultAttributes=SL;const TL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},wL=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}},CL={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:iM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ok(),Wk(),qk(),Jk(),Yk();let BL=class t extends qy{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=ri(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:fM(u)&&fM(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:fM(u)&&fM(u.value)},wL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:fM(u)&&fM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:fM(u)&&fM(u.value)},wL(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},rM),u.value),visible:fM(u)&&fM(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=fM(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 _=fM(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(!fM(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)+(fM(n.key)?r+n.key.spacing:0)+(fM(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&&(RM(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:fM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(fM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=id(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(fM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},wL(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},wL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},rM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(fM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},wL(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},wL(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=>EL.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)&&fM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=fM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=CM(d),_=CM(u);let y=0;if(fM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(fM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&au[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 TL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return TL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};BL.defaultAttributes=CL;const PL=pt;function LL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function OL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function IL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function DL(t,e){const i=IL(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 FL(t,e){const i=zL(t),s=zL(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 zL(t,e={x:0,y:0}){return re.distancePP(t,e)}function jL(t){return k(t.x)&&k(t.y)}function HL(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 VL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const NL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function WL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&WL(t[i],e)}}var GL,YL,$L;function XL(t){var e,i;const{type:s}=t;return s===YL.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(GL||(GL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(YL||(YL={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}($L||($L={}));const KL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},qL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function ZL(t,e){var i;if(!t)return[];const s=nR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?iR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>eR(i)?QL(t,i,e):i)).filter(p)}))):i.map((i=>eR(i)?QL(t,i,e):i)).filter(p):[]}return[]}function JL(t,e){var i,s;return iR(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 QL(t,e,i){var s;const n=nR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=KL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=qL[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 tR=(t,e)=>{if(e&&eR(t)){const i=QL(e,t);if(i)return i}return t};function eR(t){return t&&"palette"===t.type&&!!t.key}function iR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function sR(t){return y(t)?{dataScheme:t}:t}function nR(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=XL(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 rR extends iE{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(!iR(this._range))return void super.range(this._range);const t=JL(this._range,this._domain);super.range(t)}}const aR={linear:TE,band:rE,point:class extends rE{constructor(t){super(!1),this.type=OC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:iE,threshold:LE,colorOrdinal:rR};function oR(t){const e=aR[t];return e?new e:null}function lR(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 hR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function cR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function dR(t){return!!_(t)&&(!!t.endsWith("%")&&$y(t.substring(0,t.length-1)))}function uR(t){return!!g(t)&&("percent"in t||"offset"in t)}function pR(t,e,i,s=0){var n,r;return S(t)?t:dR(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 gR(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]=pR(t[s],e.size,i)}))})),o}function fR(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}}function mR(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)||dR(t)||d(t)||uR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function vR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const _R=(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},yR=[{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"]}];function bR(t,e){return t&&e.key in t?t[e.key]:e.default}function xR(t){return t&&"token"===t.type&&!!t.key}const SR={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%"},AR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:yR,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"}}},token:SR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},kR={name:"dark",colorScheme:{default:{dataScheme:yR,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}}}}}},MR=(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]={}),MR(t[s],e.slice(1),i))};function TR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=sR(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)})}wR._charts={},wR._series={},wR._components={},wR._graphicComponents={},wR._marks={},wR._regions={},wR._animations={},wR._implements={},wR._chartPlugin={},wR._vChartPlugin={},wR._componentPlugin={},wR.transforms={fields:Yr,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}},wR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,ta(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ia,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Qr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,ea(t))},wR._layout={},wR._grammarTransforms={},wR._stageEventPlugins={},wR.registerStageEventPlugin=(t,e)=>{wR._stageEventPlugins[t]=e},wR.getStageEventPlugin=t=>wR._stageEventPlugins[t],wR._interactionTriggers={},wR.registerInteractionTrigger=(t,e)=>{wR._interactionTriggers[t]=e},wR._composedEventMap={},wR.registerComposedEvent=(t,e)=>{wR._composedEventMap[t]=e},wR._tooltipProcessors={},wR.registerTooltipProcessor=(t,e)=>{wR._tooltipProcessors[t]=e},wR.createTooltipProcessor=(t,e)=>{const i=wR._tooltipProcessors[t];return i?new i(e):null};const BR=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},PR=BR(),LR={[AR.name]:AR},RR=AR.name,OR=new Map(Object.keys(LR).map((t=>[t,LR[t]]))),IR=new Map,DR=new Map(Object.keys(LR).map((t=>[t,t===RR]))),FR=(t,e)=>{if(!t)return;const i=VR(e);OR.set(t,i),DR.set(t,!0)},zR=(t=RR)=>(DR.has(t)&&!DR.get(t)&&FR(t,OR.get(t)),OR.get(t)),jR=t=>OR.delete(t)&&IR.delete(t)&&DR.delete(t),HR=t=>!!_(t)&&OR.has(t),VR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:RR;return CR({},zR(i),t)};class NR{static registerInstance(t){NR.instances.set(t.id,t)}static unregisterInstance(t){NR.instances.delete(t.id)}static getInstance(t){return NR.instances.get(t)}static instanceExist(t){return NR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return NR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}NR.instances=new Map;class UR{static registerTheme(t,e){FR(t,e)}static getTheme(t,e=!1){return zR(t)}static removeTheme(t){return jR(t)}static themeExist(t){return HR(t)}static getDefaultTheme(){return UR.themes.get(RR)}static setCurrentTheme(t){UR.themeExist(t)&&(UR._currentThemeName=t,NR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return UR.getTheme(UR._currentThemeName,t)}static getCurrentThemeName(){return UR._currentThemeName}}function WR(t){return _(t)?UR.themeExist(t)?UR.getTheme(t):{}:g(t)?t:{}}UR.themes=OR,UR._currentThemeName=RR;const GR=["animationThreshold","colorScheme","name","padding"];function YR(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];GR.includes(n)?s[n]=r:m(r)?eR(r)?s[n]=tR(r,e):xR(r)?s[n]=bR(i,r):s[n]=YR(r,e,i):s[n]=r})),s}function $R(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]=$R(t[s],e)}return i}return y(t)?t.map((t=>$R(t,e))):t}function XR(t,e){if(!t)return t;if(m(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]=XR(t[s],e)}return i}return y(t)?t.map((t=>XR(t,e))):t}const KR=(t,e,i,s)=>((t,e,i)=>CM(t,e,i,{fontFamily:SR.fontFamily,fontSize:SR.fontSize}))(e,i,s).measure(t),qR="__VCHART",ZR=500,JR=500,QR=`${qR}_MEASURE_CANVAS_ID`,tO=`${qR}_DEFAULT_DATA_INDEX`,eO=`${qR}_DEFAULT_DATA_KEY`,iO=`${qR}_DEFAULT_DATA_SERIES_FIELD`,sO=`${qR}_DEFAULT_SERIES_STYLE_NAME`,nO=`${qR}_STACK_KEY`,rO=`${qR}_STACK_START`,aO=`${qR}_STACK_END`,oO=`${qR}_STACK_START_PERCENT`,lO=`${qR}_STACK_END_PERCENT`,hO=`${qR}_STACK_START_OffsetSilhouette`,cO=`${qR}_STACK_END_OffsetSilhouette`,dO=`${qR}_STACK_TOTAL`,uO=`${qR}_STACK_TOTAL_PERCENT`,pO=`${qR}_STACK_TOTAL_TOP`,gO=`${qR}_STACK_TOTAL_BOTTOM`,fO=`${qR}_MOSAIC_VALUE_START_PERCENT`,mO=`${qR}_MOSAIC_VALUE_END_PERCENT`,vO=`${qR}_MOSAIC_CAT_START_PERCENT`,_O=`${qR}_MOSAIC_CAT_END_PERCENT`,yO=`${qR}_SEGMENT_START`,bO=`${qR}_SEGMENT_END`,xO=`${qR}_KEY`;function SO(t,e){for(let i=0;it.key===e))}function kO(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 MO(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:{}},BO(t,a,n[o],l,e,r))})),s?TO(n):n}function TO(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))):TO(t[e].nodes);return t}function wO(t,e){if("values"in t&&t.values.length){const i=OL(t.values,e),s=RL(t.values,lO);t.values.forEach((t=>{t[dO]=i,t[uO]=s}))}else for(const i in t.nodes)wO(t.nodes[i],e)}function CO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][aO]/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)EO(t.nodes[r],e,i,s,n)}function BO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[aO]=function(t){if(k(t))return t;const e=+t;return k(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)),BO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const PO=(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]=RO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function OO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>FO(t.style(e,i,s,n)):P(t.style)||(e.style=FO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>FO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=FO(t.state[e]))})),e.state=i}return e}function IO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e,s,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}function DO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),FO(i)}function FO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const zO=t=>"line"===t||"area"===t,jO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return zO(i)?e:null==e?void 0:e[0]},HO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let VO=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},n=wR.getComposedEvent(t);if(n){const e=new n(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(wR.getComposedEvent(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()}};var NO;!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"}(NO||(NO={}));const UO=["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 WO,GO,YO;t.ChartEvent=void 0,(WO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",WO.rendered="rendered",WO.renderFinished="renderFinished",WO.animationFinished="animationFinished",WO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",WO.afterInitData="afterInitData",WO.afterInitEvent="afterInitEvent",WO.afterInitMark="afterInitMark",WO.rawDataUpdate="rawDataUpdate",WO.viewDataFilterOver="viewDataFilterOver",WO.viewDataUpdate="viewDataUpdate",WO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",WO.markDeltaYUpdate="markDeltaYUpdate",WO.viewDataLabelUpdate="viewDataLabelUpdate",WO.scaleDomainUpdate="scaleDomainUpdate",WO.scaleUpdate="scaleUpdate",WO.dataZoomChange="dataZoomChange",WO.drill="drill",WO.layoutStart="layoutStart",WO.layoutEnd="layoutEnd",WO.layoutRectUpdate="layoutRectUpdate",WO.playerPlay="playerPlay",WO.playerPause="playerPause",WO.playerEnd="playerEnd",WO.playerChange="playerChange",WO.playerForward="playerForward",WO.playerBackward="playerBackward",WO.scrollBarChange="scrollBarChange",WO.brushStart="brushStart",WO.brushChange="brushChange",WO.brushEnd="brushEnd",WO.brushClear="brushClear",WO.brushActive="brushActive",WO.legendSelectedDataChange="legendSelectedDataChange",WO.legendFilter="legendFilter",WO.legendItemClick="legendItemClick",WO.legendItemHover="legendItemHover",WO.legendItemUnHover="legendItemUnHover",WO.tooltipShow="tooltipShow",WO.tooltipHide="tooltipHide",WO.tooltipRelease="tooltipRelease",WO.afterResize="afterResize",WO.afterRender="afterRender",WO.afterLayout="afterLayout",WO.afterMarkLayoutEnd="afterMarkLayoutEnd",WO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(GO||(GO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(YO||(YO={}));const $O=[YO.mark,YO.model,YO.chart,YO.vchart];class XO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(YO.vchart,[]),this._levelNodes.set(YO.chart,[]),this._levelNodes.set(YO.model,[]),this._levelNodes.set(YO.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 KO={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 qO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>jO(t)))};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)||GO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||GO.chart);o.get(t)||o.set(t,new XO);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)||GO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||GO.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)||GO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||GO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i<$O.length;)n=this._invoke(s.getHandlers($O[i]),t,e),i++}return this}prevent(t,e){return["canvas","chart","window"].forEach((i=>{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?$O.indexOf(t.filter.level)<$O.indexOf(e.level)&&t.callback!==e.handler&&s.preventHandler(t):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(){[GO.chart,GO.window,GO.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&&L(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 KO[a]&&(a=KO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?YO.model:YO.vchart:YO.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=GO.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!==YO.model&&s!==YO.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=YO.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 GO.chart:return this._viewBubbles;case GO.window:return this._windowBubbles;case GO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case GO.chart:return this._viewListeners;case GO.window:return this._windowListeners;case GO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return UO.includes(t)||Object.values(NO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&wR.hasInteractionTrigger(e)}}function ZO(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function JO(t,e,i){t.getParser(e)||t.registerParser(e,i)}const QO=new Map;let tI;function eI(){tI||(tI=new Ta,JO(tI,"geojson",ba),JO(tI,"topojson",Sa),ZO(tI,"simplify",Wr))}function iI(t,e,i={type:"geojson",centroid:!0}){QO.has(t)&&Fy(`map type of '${t}' already exists, will be overwritten.`),eI();const s=new wa(tI),n=j({},{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}),QO.set(t,s)}function sI(t){QO.has(t)?QO.delete(t):Fy(`map type of '${t}' does not exists.`)}function nI(t,e=!1){let i=e;return t.latestData instanceof wa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const rI=(t,e)=>0===t.length?[]:1===t.length?nI(t[0],null==e?void 0:e.deep):t.map((t=>nI(t,null==e?void 0:e.deep)));function aI(e,i,s){ZO(i=i instanceof Ta?i:e.dataSet,"copyDataView",rI);const n=new wa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function oI(t,e,i=[]){var s;if(t instanceof wa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 wa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Fy(`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 Fy(`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([]),Fy("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 lI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var hI,cI,dI,uI;t.TransformLevel=void 0,(hI=t.TransformLevel||(t.TransformLevel={}))[hI.copyDataView=-10]="copyDataView",hI[hI.treemapFilter=-8]="treemapFilter",hI[hI.treemapFlatten=-7]="treemapFlatten",hI[hI.dotObjFlat=-7]="dotObjFlat",hI[hI.linkDotInfo=-7]="linkDotInfo",hI[hI.sankeyLayout=-7]="sankeyLayout",hI[hI.dataZoomFilter=-6]="dataZoomFilter",hI[hI.legendFilter=-5]="legendFilter",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"}(cI||(cI={})),function(t){t.data="data",t.mark="mark"}(dI||(dI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(uI||(uI={}));const pI=["line","area","trail"];function gI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(xO,i?t.slice().sort(i):t.slice()),{keys:[xO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const fI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function mI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{mI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function _I(t,e,i,s){const n=gI(t,(t=>i(t))),r=gI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 yI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;b_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Ep({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Uy(o))&&!1!==c&&wR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=uI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(b_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=b_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>mI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>mI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{mI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Dy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===uI.before&&(this._layoutState=uI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=uI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Dy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=vI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=_I(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=_I(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=gI(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=gI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===GO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:jO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===GO.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===GO.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===GO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===GO.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===GO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{mI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=vI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Ny(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return _u(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{yo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{mI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=b_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){b_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function bI(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:zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function xI(t){t.crosshair=Y(t.crosshair||{}).map((e=>TR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function SI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Ny(e.mode)){let t;t=_(h)?b_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if(Wy(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 AI(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 kI(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}}var MI,TI,wI,CI,EI,BI;t.LayoutZIndex=void 0,(MI=t.LayoutZIndex||(t.LayoutZIndex={}))[MI.SeriesGroup=0]="SeriesGroup",MI[MI.Axis_Grid=50]="Axis_Grid",MI[MI.CrossHair_Grid=100]="CrossHair_Grid",MI[MI.Region=450]="Region",MI[MI.Mark=300]="Mark",MI[MI.Node=400]="Node",MI[MI.Axis=100]="Axis",MI[MI.MarkLine=500]="MarkLine",MI[MI.MarkArea=100]="MarkArea",MI[MI.MarkPoint=500]="MarkPoint",MI[MI.DataZoom=500]="DataZoom",MI[MI.ScrollBar=500]="ScrollBar",MI[MI.Player=500]="Player",MI[MI.Legend=500]="Legend",MI[MI.CrossHair=500]="CrossHair",MI[MI.Indicator=500]="Indicator",MI[MI.Title=500]="Title",MI[MI.Label=500]="Label",MI[MI.Brush=500]="Brush",MI[MI.CustomMark=500]="CustomMark",MI[MI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(TI=t.LayoutLevel||(t.LayoutLevel={}))[TI.Indicator=10]="Indicator",TI[TI.Region=20]="Region",TI[TI.Axis=30]="Axis",TI[TI.DataZoom=40]="DataZoom",TI[TI.Player=40]="Player",TI[TI.ScrollBar=40]="ScrollBar",TI[TI.Legend=50]="Legend",TI[TI.Title=70]="Title",TI[TI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(wI=t.AttributeLevel||(t.AttributeLevel={}))[wI.Default=0]="Default",wI[wI.Theme=1]="Theme",wI[wI.Chart=2]="Chart",wI[wI.Base_Series=3]="Base_Series",wI[wI.Series=4]="Series",wI[wI.Mark=5]="Mark",wI[wI.User_Chart=6]="User_Chart",wI[wI.User_Series=7]="User_Series",wI[wI.User_Mark=8]="User_Mark",wI[wI.User_SeriesStyle=9]="User_SeriesStyle",wI[wI.Built_In=99]="Built_In";class PI{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({},PI.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]))))}}PI.defaultMarkInfo={};class LI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class RI{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=>TR({},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 OI extends LI{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=RI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new PI,this._lastLayoutRect=null,this.id=Yy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new VO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${qR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=wR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class II{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=gR(mR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:pR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:pR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:pR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:pR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:pR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:pR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=pR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=pR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=pR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(fR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class DI extends OI{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,this._transformLayoutPadding=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 II(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 FI extends RI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class zI extends DI{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(e,i){var s;super(e,i),this.transformerConstructor=FI,this.modelType="region",this.specKey="region",this.type=zI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function jI(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 HI(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 VI(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 NI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),VI(d,!0,p,l),s&&HI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function UI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=YI(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=YI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),VI(d,!1,p,o),s&&HI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function GI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=YI(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=YI(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"left",s),r.length&&NI(r,e,i,!0,"left",s),a.length&&UI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"top",s),r.length&&WI(r,e,i,!0,"top",s),a.length&&GI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&NI(n,e,i,!1,"right",s),r.length&&NI(r,e,i,!0,"right",s),a.length&&UI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=jI(t);n.length&&WI(n,e,i,!1,"bottom",s),r.length&&WI(r,e,i,!0,"bottom",s),a.length&&GI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=YI(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=YI(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:zy)("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}}}$I.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(CI||(CI={})),t.STATE_VALUE_ENUM=void 0,(EI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",EI.STATE_HOVER="hover",EI.STATE_HOVER_REVERSE="hover_reverse",EI.STATE_DIMENSION_HOVER="dimension_hover",EI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",EI.STATE_SELECTED="selected",EI.STATE_SELECTED_REVERSE="selected_reverse",EI.STATE_SANKEY_EMPHASIS="selected",EI.STATE_SANKEY_EMPHASIS_REVERSE="blur",EI.STATE_HIGHLIGHT="highlight",EI.STATE_BLUR="blur",EI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(BI||(BI={}));const XI=["linear","radial","conical"],KI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const qI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{qI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class ZI extends LI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class JI extends ZI{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,pI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!qI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(qR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(qR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(DC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class QI extends LI{constructor(){super(...arguments),this.id=Yy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=wR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class tD extends QI{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const eD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,iD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=eD(l.delay,n,a,o),d=eD(l.duration,n,a,o),u=eD(l.oneByOne,n,a,o),p=eD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Rw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ew(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Pw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Yo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kw,null!==(l=i.easing)&&void 0!==l?l:Mw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Yo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Ow({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Mw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Rw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},sD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},nD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class rD extends QI{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new tD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Ep("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Hl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new JI(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&TR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(FC(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=oR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):XI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):FC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=JL(ZL(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({},KI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)XI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=JL(ZL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return gI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return wR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[eO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=gI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{nD(t),s.push(...t.getGraphics())})),e.forEach((t=>{nD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);iD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=sD(e,n),r=sD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===cI.exit?cI.exit:i===cI.update?cI.update:cI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===CI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===CI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=CI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=CI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=CI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=cI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=cI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return fI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=fI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=HO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=wR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=wR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===uI.before||(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===CI.exit&&!e.isExiting)if(e.context.animationState===CI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Ep({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var aD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(aD||(aD={}));class oD extends rD{constructor(){super(...arguments),this.type=oD.type,this._marks=[],this._diffState=CI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Fy("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?(Fy("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))}getMarkInUserId(t){let e;return mI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===CI.update){const t=this.hasAnimation(),e=HO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=CI.update}render(){this._isCommited&&(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}oD.type="group";const lD={measureText:KR};class hD{static instance(){return hD.instance_||(hD.instance_=new hD),hD.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 cD{constructor(){this.id=Yy(),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))?Fy("不要重复添加相同的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 dD extends cD{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}}const uD={type:"fadeIn"};function pD(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 uD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const gD={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"}},fD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},mD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},vD=()=>{wR.registerAnimation("scaleInOut",(()=>fD))},_D=()=>{wR.registerAnimation("fadeInOut",(()=>mD))},yD=(t,e)=>({appear:pD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Nw,duration:gD.update.duration,easing:gD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),bD=()=>{wR.registerAnimation("line",yD)},xD=()=>{lw.registerBuiltInAnimate("growPointsIn",nC),lw.registerBuiltInAnimate("growPointsOut",rC),lw.registerBuiltInAnimate("growPointsXIn",oC),lw.registerBuiltInAnimate("growPointsXOut",lC),lw.registerBuiltInAnimate("growPointsYIn",cC),lw.registerBuiltInAnimate("growPointsYOut",dC),lw.registerBuiltInAnimate("clipIn",Gw),lw.registerBuiltInAnimate("clipOut",Yw)},SD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class AD{constructor(t){this._markSet=new PI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 kD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class MD extends AD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},kD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}MD.type="element-highlight",MD.defaultOptions=kD;const TD=()=>{wR.registerInteractionTrigger(MD.type,MD)},wD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class CD extends AD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},wD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}CD.type="element-select",CD.defaultOptions=wD;const ED=()=>{wR.registerInteractionTrigger(CD.type,CD)};class BD extends cD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class PD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>wR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>wR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>wR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return wR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>wR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){wR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}static getFunction(t){return t?hD.instance().getFunction(t):null}static getFunctionList(){return hD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=wR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=wR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,QO.get(e);var e}static registerSVG(t,e,i){const s=wR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=wR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){NR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Yy(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=AI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?wR.getSeriesBuiltInTheme(e):wR.getComponentBuiltInTheme(e);i=i?TR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=YR({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},WL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Ny(v);if(S?ix(vo):"node"===v&&sA(vo),S&&f&&(this._container=_(f)?b_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=UR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new yI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new qO(this,this._compiler),this._event=new VO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),NR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=TR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=$R(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;PD.getFunctionList()&&PD.getFunctionList().length&&(t=XR(t,PD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=wR.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=wR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=wR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 SI(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:ZR,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:JR})}_initDataSet(t){this._dataSet=t instanceof Ta?t:new Ta,JO(this._dataSet,"dataview",Aa),JO(this._dataSet,"array",s),ZO(this._dataSet,"copyDataView",rI);for(const t in wR.transforms)ZO(this._dataSet,t,wR.transforms[t]);for(const t in wR.dataParser)JO(this._dataSet,t,wR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?cI.none:cI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,NR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 wa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=oI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?TR({},t[n][e.index],i):i):t[n]=s?TR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?TR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?TR({},t[n],i):i)}))}(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=TR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=CR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=WR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}else{const t=CR({},WR(this._currentThemeName),WR(n),WR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(VM.poptip,HM,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=!!Ny(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.getTheme("background")||this._option.background}getCurrentTheme(){return WR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!UR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 bI(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(!Ny(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;this._chart.resetLayoutItemTag(),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)?b_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?vR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Fy("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?vR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Fy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return hD.instance().getFunction(t)}registerFunction(t,e){t&&e&&hD.instance().registerFunction(t,e)}unregisterFunction(t){t&&hD.instance().unregisterFunction(t)}getFunctionList(){return hD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=wR.getChartPlugins();t.length>0&&(this._chartPlugin=new dD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=wR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new BD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}PD.InstanceManager=NR,PD.ThemeManager=UR,PD.globalConfig={uniqueTooltip:!0},PD.Utils=lD,PD.vglobal=b_;wR.registerRegion("region",zI),wR.registerLayout("base",$I),Xk(),Ok(),wR.registerMark(oD.type,oD),wR.registerStageEventPlugin("gesture",Mb),TD(),ED(),FR(kR.name,kR);const LD="monotone",RD="linear",OD="bevel";function ID(t,e){return e("component",t)}function DD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=wR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const FD=(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},zD=(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)))},jD=(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},HD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=DD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},VD=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const ND=(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 UD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=GD(HD(h,r,a,c),d,g),o.value=GD(HD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=HD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function WD(t,e,i,s,n,r,a){if(d(e)){UD(t,e(n,a),i,s,r,a)}else e&&UD(t,e,i,s,r,a)}const GD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class YD{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 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=>{y(t)?t.forEach((t=>{WD(a,t,e,i,s,n,r)})):d(t)?WD(a,t,e,i,s,n,r):t&&UD(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:HD(r.visible,t,n),value:GD(HD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:HD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=HD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&ND(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 $D={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}},XD=(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=SO([],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 KD(a,n,o)},KD=(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)=>{$y(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=>{$y(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=$D[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},qD=(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=>{$y(t[e])||(t[e]=0)}))})),t},ZD=`${qR}_HIERARCHY_DEPTH`,JD=`${qR}_HIERARCHY_ROOT`,QD=`${qR}_HIERARCHY_ROOT_INDEX`;function tF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function eF(t,e,i){t&&(i.needDefaultSeriesField&&(t[iO]=i.defaultSeriesField),t[tO]=e,t[eO]=i.getKey(t,e,i))}function iF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function sF(t,e,i,s=0,n,r){void 0===r&&(r=e),eF(t,e,i),t[ZD]=s,t[JD]=n||t[i.categoryField],t[QD]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>sF(e,s,i,t[ZD]+1,t[JD],r)))}const nF={label:{name:"label",type:"text"}},rF=`${qR}_rect_x`,aF=`${qR}_rect_x1`,oF=`${qR}_rect_y`,lF=`${qR}_rect_y1`,hF={data:!0},cF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},dF=[...Object.keys(gD),"normal"];function uF(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 vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=TR({},o[e],a);return vF(n)&&delete n.type,n.oneByOne&&(n=gF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:fF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function pF(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;const i=["custom","customParameters"];return t=I(t,null,i),_F(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}),i),t}(h,i)}function gF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function fF(t,e){var i;return null!==(i=null==t?void 0:t[tO])&&void 0!==i?i:e.context.graphicIndex}function mF(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 vF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function _F(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),_F(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),_F(t[s],e,i))}function yF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class bF extends RI{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=XL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=wR.getSeriesMarkMap(o)?function(t,e,i){const s=wR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=TR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return TR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=TR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>TR({},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 xF extends OI{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:`${qR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=bF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=yF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(ZO(this._rawData.dataSet,"invalidTravel",qD),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=oI(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=aI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=aI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new tD(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=KD(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(){ZO(this._dataSet,"dimensionStatistics",XD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new wa(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&&SO(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){ZO(this._dataSet,"dimensionStatistics",XD);const s=new wa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=SO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&SO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new wa(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)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=uF({},pF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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)||Wy(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=TR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=TR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=SD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=SD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=SD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:iO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:sO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,sO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new YD(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},hF),cF),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=>cF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof wa||lI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();yF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:iO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new rR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return ZL(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:iO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,TR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:eO}_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!==aO&&t!==lO&&t!==rO&&t!==oO||(t=this.getStackValueField()),null!==(e=kO(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=>$y(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:iO]}}function SF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();DC(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 AF(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}}}xF.mark=nF,xF.transformerConstructor=bF;class kF extends xF{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);DC(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:`${qR}_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(aO),this.setFieldX2(rO)):(this.setFieldY(aO),this.setFieldY2(rO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(lO),this.setFieldX2(oO)):(this.setFieldY(lO),this.setFieldY2(oO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(cO),this.setFieldX2(hO)):(this.setFieldY(cO),this.setFieldY2(hO))}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(t.ChartEvent.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)&&(SF("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)}}function MF(t){return"bottom"===t||"top"===t}function TF(t){return"left"===t||"right"===t}function wF(t){return"z"===t}function CF(t,e){return cR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function EF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function BF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?MF(t)?"linear":"band":MF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const PF=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):["linear","log","symlog"].includes(e)?ID("axisLinear",i):{})&&void 0!==s?s:{},r=MF(t)?ID("axisX",i):TF(t)?ID("axisY",i):ID("axisZ",i);return TR({},ID("axis",i),n,r)};class LF{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:zy)("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:zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>zC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return MF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class RF extends LF{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:GO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const OF=(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))},IF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},DF=(t,e,i,s)=>{var n;const r=e.getScale(),a=zC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:FF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,zF=(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};class jF extends LF{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)=>!OF(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:GO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:GO.canvas}),callback:this.onMouseOut}),Uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:GO.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})}}var HF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(HF||(HF={}));const VF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class NF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(VF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:OD,curveType:RD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===LD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(VF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:mF(this._spec,VF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new wa(this._option.dataSet,{name:`${qR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[VF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(HF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,TR({},this._spec[VF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const UF=Object.assign(Object.assign({},nF),VF),WF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>WF(t,e[i])));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]))},GF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class YF extends rD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return GF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(FC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?WF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:CI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[eO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class $F extends YF{constructor(){super(...arguments),this.type=$F.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)===YL.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}$F.type="line";const XF=()=>{wR.registerMark($F.type,$F),Xk(),zk(),kB(),yB(),xD(),wR.registerGraphicComponent("line",Cg)};class KF extends rD{constructor(){super(...arguments),this.type=KF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}KF.type="symbol";const qF=()=>{wR.registerMark(KF.type,KF),Xk(),qk(),yB(),wR.registerGraphicComponent("symbol",Mg)};class ZF extends bF{_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 JF(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function QF(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:!k(o.min),extendable_max:!k(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 tz(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 ez(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 iz(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 sz(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 nz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return BC(v)};class rz{constructor(t){this.id=Yy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class az extends rz{constructor(){super(az.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!DC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&JF(c)&&JF(d)))return;const u=QF(t,c),p=QF(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!ez(u,p))return}else if(0===y&&0===b){if(!ez(p,u))return}else if(_||A)if(_&&!A){if(!tz(u,p))return}else if(A&&!_){if(!tz(p,u))return}else{if(f===b)return;if(f>b){if(!iz(u,p))return}else if(!iz(p,u))return}else{if(0===f&&0===y){if(!sz(u,p))return}else if(0===b&&0===g&&!sz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){ZO(e.getOption().dataSet,"tickAlign",nz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}az.pluginType="component",az.type="AxisSyncPlugin";const oz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function lz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function hz(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 cz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const dz=t=>"band"===t||"ordinal"===t||"point"===t;function uz(t,e){return{id:t,label:t,value:e,rawValue:t}}function pz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class gz extends cD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const fz=`${qR}_ARC_TRANSFORM_VALUE`,mz=`${qR}_ARC_RATIO`,vz=`${qR}_ARC_START_ANGLE`,_z=`${qR}_ARC_END_ANGLE`,yz=`${qR}_ARC_K`,bz=`${qR}_ARC_MIDDLE_ANGLE`,xz=`${qR}_ARC_QUADRANT`,Sz=`${qR}_ARC_RADIAN`,Az=-Math.PI/2,kz=3*Math.PI/2,Mz=.6,Tz=(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 pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},wz=(t,e,i)=>{var s;const n=null!==(s="band"===e?ID("axisBand",i):"linear"===e?ID("axisLinear",i):{})&&void 0!==s?s:{},r=ID("angle"===t?"axisAngle":"axisRadius",i);return TR({},ID("axis",i),n,r)};function Cz(t,e,i,s){switch(t){case r.cartesianBandAxis:return PF(CF(i,["z"]),"band",e);case r.cartesianLinearAxis:return PF(CF(i,["z"]),"linear",e);case r.cartesianLogAxis:return PF(CF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return PF(CF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return PF(CF(i),void 0,e);case r.polarBandAxis:return wz(i.orient,"band",e);case r.polarLinearAxis:return wz(i.orient,"linear",e);case r.polarAxis:return wz(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>MF(t.orient)));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>TF(t.orient)));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=ID(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?TR({},dz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?TR({},zC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Ez(i,ID(t,e));default:return ID(t,e)}}const Ez=(t,e)=>{var i;const s=TR({},e,e[EF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Bz extends RI{getTheme(t,e){return Cz(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({},mR(e)),{[s]:0}))}}class Pz extends DI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Bz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Ic||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:GO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 gz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Lz,Rz;Pz.transformerConstructor=Bz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Lz||(Lz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Rz||(Rz={}));class Oz extends rD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=wR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(NO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Oz.type="component";const Iz=()=>{wR.registerMark(Oz.type,Oz)},Dz=t=>t;class Fz extends Pz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Lz.circleAxis:Lz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Rz.circleAxisGrid:Rz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=uF(null===(h=wR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new tD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return HL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?DC(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 HL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=VL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(HL(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=OO(s=t.domainLine)).startSymbol=OO(s.startSymbol),s.endSymbol=OO(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 FO(TR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:FO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>FO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=FO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 FO(TR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:FO(t.tick.style)),t.tick.state&&(i.tick.state=IO(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 FO(TR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:FO(t.subTick.style)),t.subTick.state&&(i.subTick.state=IO(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=oz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:TR({},d,FO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:FO(h.style)}),h.state&&(i.title.state.shape=IO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:FO(o.style)}),o.state&&(i.title.state.background=IO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=IO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=FO(t.background.style)),t.background.state&&(i.panel.state=IO(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 FO(TR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:FO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:FO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=DD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){JO(this._option.dataSet,"scale",Dz);const i=this.registerTicksTransform();return new wa(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)}getDatum(t){var e;return t&&t.name===pT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Fz.specKey="axes";const zz=()=>{Iz(),wR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},jz=[az];class Hz extends Fz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),HL(this._regions,(t=>{const e=this.getOrient();MF(e)?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):TF(e)?pz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):wF(e)&&pz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=TR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(TR({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=MF(this.getOrient()),n=t=>{var e;return(s?!MF(t.getOrient()):MF(t.getOrient()))&&DC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=CF(i,["z"]),wF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!cz(e))return null;const{axisType:t,componentName:s}=BF(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=>TF(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(!cz(t))return;const{axisType:s,componentName:n}=BF(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=wR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return MF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):wF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(jz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){MF(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&&!MF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!wF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;TF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=MF(this.getOrient())?t.fieldX:wF(this.getOrient())?t.fieldZ:t.fieldY,DC(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:DC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(NO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(MF(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=MF(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)}))}collectScale(){const t=[];return HL(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]:MF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:wF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HL(this._regions,(e=>{MF(t)?pz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):TF(t)?pz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):wF(t)&&pz(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=MF(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=MF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=TR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=MF(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return uz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:DC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Hz.type=r.cartesianAxis,Hz.specKey="axes";const Vz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Nz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Wz=(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 Gz(t,e,i="count"){const s=Wz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Yz=Math.sqrt(50),$z=Math.sqrt(10),Xz=Math.sqrt(2);class Kz{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=hz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=MF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Uz),e.sort(Uz),{domain:Nz(t,e),scope:Gz(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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}=hz(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>=Yz?10:n>=$z?5:n>=Xz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const qz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Zz={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}}},Jz={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}}},Qz={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}}};class tj extends Hz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!wF(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=MF(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=dR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 ZO(this._option.dataSet,t,IE),t}}tj.type=r.cartesianLinearAxis,tj.specKey="axes",tj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(tj,Kz);const ej=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(tj.type,tj)};class ij{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new tD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=uz(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=>uz(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 sj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class nj extends Hz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,HE),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=qC(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{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(nj.type,nj,!1)};class aj extends tj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{MF(this.getOrient())?pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):pz(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=TR({},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 wa(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 tD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>uz(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=>uz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}aj.type=r.cartesianTimeAxis,aj.specKey="axes",aj.builtInTheme={axis:Qz,axisX:Zz,axisY:Jz};class oj extends tj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new BE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}oj.type=r.cartesianLogAxis,oj.specKey="axes",oj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(oj,Kz);class lj extends tj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PE}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 ZO(this._option.dataSet,t,IE),t}transformScaleDomain(){}}lj.type=r.cartesianSymlogAxis,lj.specKey="axes",lj.builtInTheme={axis:Qz,axisLinear:qz,axisX:Zz,axisY:Jz},G(lj,Kz);const hj=`${qR}_hide_`;function cj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const dj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[hj]&&(cj(t,!0),t[hj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[hj]=!0,cj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},uj=()=>{wR.registerGrammarTransform("symbolOverlap",{transform:dj,runType:"afterEncode"})},pj={min:K,max:X,average:IL,sum:OL};function gj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function fj(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 mj(t,e,i,s){return fj(t,e,i,"min",s)}function vj(t,e,i,s){return fj(t,e,i,"max",s)}function _j(t,e,i,s){return fj(t,e,i,"average",s)}function yj(t,e,i,s){return fj(t,e,i,"sum",s)}const bj=(t,e)=>{let i=d(t.size)?t.size():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=gj;if("min"===n?l=mj:"max"===n?l=vj:"average"===n?l=_j:"sum"===n&&(l=yj),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[]},xj=()=>{wR.registerGrammarTransform("dataSampling",{transform:bj})};class Sj extends kF{constructor(){super(...arguments),this.type=YL.line,this.transformerConstructor=ZF,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(uF(null===(i=wR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),pF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Sj.type=YL.line,Sj.mark=UF,Sj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Sj.transformerConstructor=ZF,G(Sj,NF);class Aj{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)=>{lI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof wa)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];Fy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Fy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class kj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{SO(e,[{key:t,operations:DC(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&&SO(e,[{key:i.field,operations:DC(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?oR("colorOrdinal"):oR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:U(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=DC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=DC(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;DC(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(DC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=DC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));DC(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 Mj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Tj extends LI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Yy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ZR,height:JR},this._viewRect={width:ZR,height:JR},this._viewBox={x1:0,y1:0,x2:ZR,y2:JR},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=mR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new VO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Aj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Mj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=wR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=wR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=wR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof OI)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 rD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof rD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&lI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=SI(this._spec,this._option,{width:ZR,height:JR})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=ZL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new kj(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){AI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=ZL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{AI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,AI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):AI(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()];AI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=gR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NO.AFTER_MARK_RENDER_END,e)};this._event.on(NO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:jO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(zO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===HF.dimensionHover||s===HF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>zC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const wj=(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 Cj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):MR(t,a,c.spec),MR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=wj(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=wj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(wR.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(wR.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=wR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=wR.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=wR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):FD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=FD(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"];return 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}))}_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 Ej extends Cj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&TR(i,kI(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 Bj extends Ej{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),xI(t)}}const Pj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=MO(t,!0);for(const e in o)for(const i in o[e].nodes)EO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)CO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&wO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Rj{_beforeInit(){this._dataSet&&ZO(this._dataSet,"stackSplit",Pj)}_initStack(){this._stack=new Lj(this),this._stack.init()}}const Oj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:HF.dimensionHover};class Ij extends AD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Oj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=jO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Ij.type="dimension-hover",Ij.defaultOptions=Oj;const Dj=()=>{wR.registerInteractionTrigger(Ij.type,Ij)},Fj=()=>{wR.registerComposedEvent(HF.dimensionHover,jF),wR.registerComposedEvent(HF.dimensionClick,RF)},zj=t=>t.fieldX[0],jj=t=>t.fieldY[0],Hj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Vj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Nj=(t,e)=>t?e?zj:Hj:e?jj:Vj,Uj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=zF(t,(t=>MF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=zF(t,(t=>TF(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=>{zC(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=Wj(t,i,Nj(e,zC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Wj(t,i,Nj(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},Wj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Gj(t,s,i)},Gj=(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=DF(e,t,"cartesian",null!=i?i:MF(t.getOrient())?zj:jj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},Yj=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(zC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(DC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=lz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Xj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&$j(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),$j=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=DD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Xj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},Kj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},qj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},Zj=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return Yj(c,r,e),c.xField.cacheInfo?Kj(c.xField):c.yField.cacheInfo?Kj(c.yField):void 0},Jj=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],Qj=(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])&&Jj.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(tH(s).every((t=>{var e;return!ND("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},tH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},eH={dom:`${qR}_TOOLTIP_HANDLER_DOM`,canvas:`${qR}_TOOLTIP_HANDLER_CANVAS`},iH={key:"其他",value:"..."};var sH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sH||(sH={}));class nH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=Qj(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({},iH),t):iH;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)&&ND(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 rH extends nH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!zC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aH=()=>{wR.registerTooltipProcessor("dimension",rH)};class oH extends nH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Go.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(jO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lH=()=>{wR.registerTooltipProcessor("mark",oH)};class hH extends nH{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 cH=()=>{wR.registerTooltipProcessor("group",hH)};class dH extends Tj{constructor(){super(...arguments),this.transformerConstructor=Bj,this.type="line",this.seriesType=YL.line}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}dH.type="line",dH.seriesType=YL.line,dH.transformerConstructor=Bj,G(dH,Rj);const uH=[...GF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class pH extends YF{constructor(){super(...arguments),this.type=pH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return uH}_getIgnoreAttributes(){return[]}}pH.type="area";const gH=()=>{wR.registerMark(pH.type,pH),Xk(),Ck(),kB(),yB(),xD(),wR.registerGraphicComponent("area",Qg)};class fH extends YD{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 mH=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}}),vH=()=>{wR.registerAnimation("area",yD),bD(),vD()};class _H extends ZF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=TR({},f.style,g.style),l.state=TR({},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 yH extends kF{constructor(){super(...arguments),this.type=YL.area,this.transformerConstructor=_H,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(yH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===LD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return lR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[aO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(uF(null===(e=wR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),pF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),pF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=AF(this);this._symbolMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),pF("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 fH(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(){super.onLayoutEnd(),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}}}yH.type=YL.area,yH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},yH.mark=mH,yH.transformerConstructor=_H,G(yH,NF);class bH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(t)}}class xH extends Tj{constructor(){super(...arguments),this.transformerConstructor=bH,this.type="area",this.seriesType=YL.area}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}xH.type="area",xH.seriesType=YL.area,xH.transformerConstructor=bH,G(xH,Rj);function SH(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 AH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:SH(t,e)}),kH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:SH(t,e)}),MH={type:"fadeIn"},TH={type:"growCenterIn"};function wH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return MH;case"scaleIn":return TH;default:return AH(t)}}class CH extends rD{constructor(){super(...arguments),this.type=CH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}CH.type="rect";const EH=()=>{Xk(),Wk(),mB("rect",xB),wR.registerMark(CH.type,CH),lw.registerBuiltInAnimate("growHeightIn",tC),lw.registerBuiltInAnimate("growHeightOut",eC),lw.registerBuiltInAnimate("growWidthIn",vC),lw.registerBuiltInAnimate("growWidthOut",_C),lw.registerBuiltInAnimate("growCenterIn",Zw),lw.registerBuiltInAnimate("growCenterOut",Jw),wR.registerGraphicComponent("rect",Lg)},BH=Object.assign(Object.assign({},nF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function PH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=_R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[rF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):lR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[aF]):lR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=lR(this._dataToPosX(t),e,i),n=lR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[oF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):lR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[lF]):lR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=lR(this._dataToPosY(t),e,i),n=lR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},OH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:mF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(OH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(ZO(this._option.dataSet,"addVChartProperty",jD),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};ZO(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new wa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new tD(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=lF,s=oF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=aF,s=rF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=MO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)PH(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=lR(this[r](t),l,i),u=lR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[rO],n=t[aO],r=t[oO],h=t[lO];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]),{[rO]:i,[aO]:s}),a?{[oO]:o,[lO]: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(Lg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>lR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>lR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=AF(this);this._barMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),pF(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=_R(this._spec.barWidth,a)),l&&(c=Math.max(c,_R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,_R(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=_R(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=DC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}OH.type=YL.bar,OH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},OH.mark=BH,OH.transformerConstructor=RH;const IH=()=>{xj(),EH(),wR.registerAnimation("bar",((t,e)=>({appear:wH(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t)}))),rj(),ej(),wR.registerSeries(OH.type,OH)};class DH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),xI(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 FH extends Tj{constructor(){super(...arguments),this.transformerConstructor=DH,this.type="bar",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}FH.type="bar",FH.seriesType=YL.bar,FH.transformerConstructor=DH,G(FH,Rj);const zH=[10,20],jH=OC.Linear,HH="circle",VH=OC.Ordinal,NH=["circle","square","triangle","diamond","star"],UH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},WH=Object.assign(Object.assign({},nF),{point:{name:"point",type:"symbol"}});class GH extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class YH extends kF{constructor(){super(...arguments),this.type=YL.scatter,this.transformerConstructor=GH,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=`${qR}_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=`${qR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:jH,defaultRange:zH},"size")}getShapeAttribute(t,e){return u(e)?HH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:VH,defaultRange:NH},"shape")}initMark(){this._symbolMark=this._createMark(YH.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,YH.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=AF(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(uF(null===(i=wR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),pF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:HH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}YH.type=YL.scatter,YH.mark=WH,YH.builtInTheme={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"}}}}},YH.transformerConstructor=GH;const $H=()=>{qF(),wR.registerAnimation("scatter",((t,e)=>Object.assign({appear:UH(0,e)},fD))),rj(),ej(),wR.registerSeries(YH.type,YH)};class XH extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class KH extends Tj{constructor(){super(...arguments),this.transformerConstructor=XH,this.type="scatter",this.seriesType=YL.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}KH.type="scatter",KH.seriesType=YL.scatter,KH.transformerConstructor=XH,G(KH,Rj);class qH extends xF{constructor(){super(...arguments),this.type=YL.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=`${qR}_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 ZH=`${qR}_MAP_LOOK_UP_KEY`,JH=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[tO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[ZH]=e.nameMap[n]:t[ZH]=n})),t.features);class QH extends YD{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 tV extends rD{constructor(){super(...arguments),this.type=tV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}tV.type="path";const eV=()=>{wR.registerMark(tV.type,tV),Xk(),Hk(),wR.registerGraphicComponent("path",qg)},iV=Object.assign(Object.assign({},nF),{area:{name:"area",type:"path"}});class sV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Pa(i,e):Ea[i]?(Ca[i]||(Ca[i]=Pa(i,Ea[i])),Ca[i]):null}(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 nV{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(){}}class rV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:nV}:Uy(e)||Wy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:rV}:null}const oV={debounce:xt,throttle:St};class lV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Uy(this._renderMode)||Wy(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,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,oV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:YO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:YO.chart,consume:!1}];l.on(...c,oV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,oV[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:YO.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:YO.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||aV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:YO.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:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:YO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=oV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=oV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:YO.chart})}));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:YO.chart,source:GO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:YO.chart,source:GO.chart},this._handleDragMouseUp)}))}}function hV(t,e){return`${qR}_${e}_${t}`}class cV extends Pz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:hV(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=TR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 sV(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===YL.map||e.type===YL.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),HL(this._regions,(t=>{var e;if(t.type===YL.map||t.type===YL.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==YL.map&&e.type!==YL.pictogram||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[ZH],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}cV.type=r.geoCoordinate,G(cV,lV);const dV=()=>{wR.registerComponent(cV.type,cV)};class uV extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class pV extends qH{constructor(){super(...arguments),this.type=YL.map,this.transformerConstructor=uV,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 !`),QO.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),ZO(this._dataSet,"copyDataView",rI),ZO(this._dataSet,"map",JH),ZO(this._dataSet,"lookup",zD);const s=QO.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new wa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:ZH,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(pV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:mF(this._spec,pV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:iO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:iO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(uF(null===(t=wR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),pF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new QH(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[tO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[tO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 tO}getActiveMarks(){return[this._pathMark]}}pV.type=YL.map,pV.mark=iV,pV.builtInTheme={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"}}}}},pV.transformerConstructor=uV;const gV=`${qR}_waterfall_default_seriesField`,fV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[pO]=!0:delete t[pO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=mV([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 f=g[0];let{start:m,end:v}=vV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ie(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=mV(r,t,n,a,c,h,i,e),a.push(n)})),a};function mV(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}=vV(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===gV)&&(t[gV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function vV(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?Fy("total.collectCountField error"):n=e[a].start;o<0?Fy("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=ie(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 _V=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},yV={type:"fadeIn"},bV={type:"growCenterIn"};function xV(t,e){switch(e){case"fadeIn":return yV;case"scaleIn":return bV;default:return AH(t,!1)}}class SV extends rD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Cg(t)}}SV.type="rule";const AV=()=>{wR.registerMark(SV.type,SV),Xk(),zk(),wR.registerGraphicComponent("line",Cg)},kV=Object.assign(Object.assign({},BH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),MV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:TV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function TV(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)=>TV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class wV{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 wa(e instanceof Ta?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),ZO(e,"dimensionTree",MV),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 CV extends RH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const EV={rect:IV,symbol:RV,arc:FV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=RV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:zV,line:jV,area:jV,rect3d:IV,arc3d:FV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function BV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=EV[t])&&void 0!==i?i:EV.point;return e.series.type===YL.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=LV(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:HV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function PV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==YL.sankey){const{formatFunc:t,args:n}=DD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function LV(t){return d(t)?e=>t(e.data):t}function RV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=LV(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:OV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function OV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function IV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=LV(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:DV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function DV(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 FV(t){var e;const{labelSpec:i}=t,s=null!==(e=LV(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 zV(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=PV(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),Sg(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 jV(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}))):[{index:0,[iO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function HV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class VV extends OH{constructor(){super(...arguments),this.type=YL.waterfall,this.transformerConstructor=CV,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 wV(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=gV)}getSeriesKeys(){return this._seriesField===gV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),ZO(this._dataSet,"waterfallFillTotal",_V),ZO(this._dataSet,"waterfall",fV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=aI(this.getViewData(),this._dataSet,{name:`${qR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new tD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:rO,endAs:aO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=AF(this);this._barMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),pF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("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(){super.initMark();const t=this._createMark(VV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return zV(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?lR(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):lR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}VV.type=YL.waterfall,VV.mark=kV,VV.builtInTheme={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}}}},VV.transformerConstructor=CV;const NV=()=>{AV(),EH(),wR.registerAnimation("waterfall",((t,e)=>({appear:xV(t,e),enter:AH(t,!1),exit:kH(t,!1),disappear:kH(t,!1)}))),_D(),rj(),ej(),wR.registerSeries(VV.type,VV)},UV=`${qR}_BOX_PLOT_OUTLIER_VALUE`;var WV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(WV||(WV={}));const GV=(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={[UV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class YV extends YD{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return this.series.getOutliersField();if(t===WV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case WV.MIN:return this.series.getMinField();case WV.MAX:return this.series.getMaxField();case WV.MEDIAN:return this.series.getMedianField();case WV.Q1:return this.series.getQ1Field();case WV.Q3:return this.series.getQ3Field();case WV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===WV.OUTLIER)return e[UV];if(t===WV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case WV.MIN:return e[this.series.getMinField()];case WV.MAX:return e[this.series.getMaxField()];case WV.MEDIAN:return e[this.series.getMedianField()];case WV.Q1:return e[this.series.getQ1Field()];case WV.Q3:return e[this.series.getQ3Field()];case WV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[UV])}getDefaultContentList(t){return[{key:this.getContentKey(WV.OUTLIER),value:this.getContentValue(WV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(WV.MAX),value:this.getContentValue(WV.MAX)},{key:this.getContentKey(WV.Q3),value:this.getContentValue(WV.Q3)},{key:this.getContentKey(WV.MEDIAN),value:this.getContentValue(WV.MEDIAN)},{key:this.getContentKey(WV.Q1),value:this.getContentValue(WV.Q1)},{key:this.getContentKey(WV.MIN),value:this.getContentValue(WV.MIN)},{key:this.getContentKey(WV.SERIES_FIELD),value:this.getContentValue(WV.SERIES_FIELD)}]}}class $V extends rD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==CI.enter&&t.context.diffState!==CI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Og(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=wR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const XV=()=>{wR.registerGraphicComponent("glyph",Og),Xk(),Lk()},KV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],qV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class ZV extends $V{constructor(){super(...arguments),this.type=ZV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=KV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=qV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}ZV.type="boxPlot";const JV=Object.assign(Object.assign({},nF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),QV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},tN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},eN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),iN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=eN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=eN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=eN(t,"box").attribute.width,i=eN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=eN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=eN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=eN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=eN(t,"box").attribute.height,i=eN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},sN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=eN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=eN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=eN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=eN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=eN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=eN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=eN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=eN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=eN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=eN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class nN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return QV(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class rN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return tN(iN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class aN extends nN{computeAttribute(){return QV(sN)(this.target,this.params,this.params.options)}}class oN extends rN{computeAttribute(){return tN(sN)(this.target,this.params,this.params.options)}}class lN extends kF{constructor(){super(...arguments),this.type=YL.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(){this._boxPlotMark=this._createMark(lN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(lN.mark.outlier,{key:tO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>lR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>lR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>lR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>lR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>lR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>lR(e(this.getDatumPositionValues(t,UV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;ZO(this._dataSet,"foldOutlierData",GV),ZO(this._dataSet,"addVChartProperty",jD);const t=new wa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${qR}_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:tF.bind(this),call:eF}},!1),this._outlierDataView=new tD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=AF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=wR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(pF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(uF(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(uF(null===(a=wR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new YV(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]}}lN.type=YL.boxPlot,lN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},lN.mark=JV;const hN=()=>{XV(),zk(),Wk(),wR.registerGraphicComponent("line",(t=>Cg(t))),wR.registerGraphicComponent("rect",(t=>Lg(t))),wR.registerMark(ZV.type,ZV),qF(),vD(),rj(),ej(),lw.registerBuiltInAnimate("boxplotScaleIn",nN),lw.registerBuiltInAnimate("boxplotScaleOut",rN),lw.registerBuiltInAnimate("barBoxplotScaleIn",aN),lw.registerBuiltInAnimate("barBoxplotScaleOut",oN),wR.registerSeries(lN.type,lN)};class cN extends rD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=cN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?$g(t):Sg(t)}}cN.type="text";const dN=()=>{wR.registerMark(cN.type,cN),Xk(),Jk(),Yk(),wR.registerGraphicComponent("text",Sg),wR.registerGraphicComponent("richtext",$g)};class uN extends YD{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 pN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),gN={type:"fadeIn"},fN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function mN(t,e){return"fadeIn"===e?gN:pN(t)}const vN=Object.assign(Object.assign({},BH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class _N extends RH{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 yN extends OH{constructor(){super(...arguments),this.type=YL.rangeColumn,this._barMarkType="rect",this._barName=YL.bar,this.transformerConstructor=_N}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(yN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,yN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(yN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(yN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=AF(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(uF(null===(i=wR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),pF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(uF(null===(n=wR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),pF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new uN(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)}}yN.type=YL.rangeColumn,yN.mark=vN,yN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},yN.transformerConstructor=_N;const bN=()=>{EH(),dN(),wR.registerAnimation("rangeColumn",((t,e)=>({appear:mN(t,e),enter:pN(t),exit:fN(t),disappear:fN(t)}))),_D(),rj(),ej(),wR.registerSeries(yN.type,yN)};var xN,SN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(xN||(xN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(SN||(SN={}));class AN extends YD{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 kN=Object.assign({},mH);class MN extends yH{constructor(){super(...arguments),this.type=YL.rangeArea}initMark(){this._areaMark=this._createMark(MN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new AN(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))}}MN.type=YL.rangeArea,MN.mark=kN;class TN extends xF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Mz,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:[]};DC(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:[]};DC(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(t.ChartEvent.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)&&SF(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 wN(t){return $y(t)?Number.parseFloat(t):0}const CN=(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&&EN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[fz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[fz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},EN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===wN(t[e])))||!i&&0===t.reduce(((t,i)=>t+wN(i[e])),0)));function BN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const PN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:BN(t,!0,cI.appear)}),LN={type:"fadeIn"},RN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:BN(t,!0,cI.enter)}),ON=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:BN(t,!0,cI.exit)}),IN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:BN(t,!0,cI.exit)});function DN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return LN;case"growRadius":return PN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return PN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class FN extends rD{constructor(t,e){super(t,e),this.type=zN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[bz])[t]+s,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 zN extends FN{constructor(){super(...arguments),this.type=zN.type}}zN.type="arc";const jN=()=>{Xk(),Tk(),mB("arc",wB),lw.registerBuiltInAnimate("growRadiusIn",gC),lw.registerBuiltInAnimate("growRadiusOut",fC),lw.registerBuiltInAnimate("growAngleIn",Kw),lw.registerBuiltInAnimate("growAngleOut",qw),wR.registerGraphicComponent("arc",sf),wR.registerMark(zN.type,zN)},HN=Object.assign(Object.assign({},nF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class VN extends bF{_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=TR({},this._theme,i,t);const n=(t,e)=>TR({},"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 NN=`${qR}_LABEL_VISIBLE`;class UN extends TN{constructor(){super(...arguments),this.transformerConstructor=VN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:pR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:pR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Az,this._endAngle=kz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[bz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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;ZO(this._dataSet,"pie",CN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:vz,asEndAngle:_z,asRatio:mz,asMiddleAngle:bz,asRadian:Sz,asQuadrant:xz,asK:yz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new tD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},UN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return UL(vz)(t)}endAngleScale(t){return UL(_z)(t)}_computeLayoutRadius(){return Tz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:hR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:hR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:UL(NN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[bz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===cI.appear)return this._startAngle;if(i===cI.disappear)return this._endAngle;const r=[cI.disappear,cI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[tO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[tO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[bz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[bz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=uF(null===(i=wR.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]}}UN.transformerConstructor=VN,UN.mark=HN,UN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class WN extends UN{constructor(){super(...arguments),this.type=YL.pie}}WN.type=YL.pie;const GN=()=>{jN(),wR.registerAnimation("pie",((t,e)=>({appear:DN(t,e),enter:RN(t),exit:ON(t),disappear:IN(t)}))),wR.registerAnimation("emptyCircle",((t,e)=>({appear:DN(t,e)}))),wR.registerSeries(WN.type,WN)};function YN(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const $N=t=>({type:YN(t.growField),options:{overall:!0}}),XN={type:"fadeIn"},KN=t=>({type:YN(t.growField)}),qN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},ZN=qN;function JN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XN;case"growAngle":return $N(Object.assign(Object.assign({},t),{growField:"angle"}));default:return $N(Object.assign(Object.assign({},t),{growField:"radius"}))}}class QN extends TN{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(aO),this.setInnerRadiusField(rO)}setValueFieldToPercent(){this.setRadiusField(lO),this.setInnerRadiusField(oO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const tU=Object.assign(Object.assign({},nF),{rose:{name:"rose",type:"arc"}});class eU extends bF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class iU extends Fz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=wR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=Az,this._endAngle=kz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):pz(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:pR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:pR(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:lz(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(){HL(this._regions,(t=>{"radius"===this.getOrient()?pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):pz(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 DC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:DC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(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=>uz(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",scale:this._scale});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=re.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",scale:this._scale.clone()});(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 Tz((()=>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=Mz,e=0;const i=this.getChart().getSpec();return HL(this.getRegions(),(s=>{const n=s;if(r=n.type,[YL.rose,YL.radar,YL.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(TR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(TR({},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)}}iU.type=r.polarAxis,iU.specKey="axes";const sU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},nU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class rU extends iU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}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 ZO(this._option.dataSet,t,IE),t}}rU.type=r.polarLinearAxis,rU.specKey="axes",rU.builtInTheme={axis:Qz,axisLinear:qz,axisAngle:nU,axisRadius:sU},G(rU,Kz);const aU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(rU.type,rU)};class oU extends iU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rE}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 ZO(this._option.dataSet,t,UE),t}transformScaleDomain(){}}oU.type=r.polarBandAxis,oU.specKey="axes",oU.builtInTheme={axis:Qz,axisBand:sj,axisAngle:nU,axisRadius:sU},G(oU,ij);const lU=()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),wR.registerGraphicComponent(Lz.circleAxis,((t,e)=>new EC(t,e))),wR.registerGraphicComponent(Rz.circleAxisGrid,((t,e)=>new IB(t,e))),zz(),wR.registerComponent(oU.type,oU)};class hU extends QN{constructor(){super(...arguments),this.type=YL.rose,this.transformerConstructor=eU,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(){this._roseMark=this._createMark(hU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:mF(this._spec,hU.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=>lR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=lR(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(uF(null===(i=wR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),pF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}hU.type=YL.rose,hU.mark=tU,hU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},hU.transformerConstructor=eU;const cU=()=>{wR.registerSeries(hU.type,hU),jN(),wR.registerAnimation("rose",((t,e)=>({appear:JN(t,e),enter:KN(t),exit:qN(t),disappear:ZN(t)}))),lU(),aU()};class dU extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,PL(this._fromAngle,this._toAngle)&&PL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class uU extends Nw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!jL(t)&&!jL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({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 ne(s,n,r,a);return o.defined=e.defined,o}}const pU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function gU(t,e,i){return"fadeIn"===e?pU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function fU(t,e,i){return"fadeIn"===e?pU(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 mU=(t,e)=>({custom:Hw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),vU=Object.assign(Object.assign(Object.assign({},nF),VF),{area:{name:"area",type:"area"}});class _U extends QN{constructor(){super(...arguments),this.type=YL.radar,this.transformerConstructor=ZF,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(_U.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:RD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?ae(this._spec.startAngle):Az},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(uF(null===(s=wR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),pF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=wR.getAnimationInKey(e);t.setAnimationConfig(uF(null==i?void 0:i(n,r),pF(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}}}_U.type=YL.radar,_U.mark=vU,_U.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_U.transformerConstructor=ZF,G(_U,NF);const yU=()=>{wR.registerSeries(_U.type,_U),gH(),XF(),qF(),wR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:gU(t,e,"in"),enter:gU(t,e,"in"),exit:gU(t,e,"out"),disappear:"clipIn"===e?void 0:gU(t,e,"out"),update:[{channel:["points","center"],custom:uU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),wR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:fU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:fU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:dU,customParameters:t,duration:gD.update.duration,easing:gD.update.easing}]}))),wR.registerAnimation("radarGroup",((t,e)=>({appear:mU(t,"in"),disappear:mU(t,"out")}))),Tk(),lU(),aU()};class bU extends YD{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=>fi.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 xU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(qR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[tO]:r,[eO]:`${s}_${e}`})),r++}))})),n},SU={fill:"#bbb",fillOpacity:.2},AU=Object.assign(Object.assign({},nF),{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 kU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),ZO(this._option.dataSet,"objFlat",xU),ZO(this._option.dataSet,"copyDataView",rI),JO(this._option.dataSet,"dataview",Aa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(TR(SU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(kU.mark.group),this._containerMark=this._createMark(kU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(kU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(kU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(kU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(kU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(kU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(kU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:iO}}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 rR).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:iO}}initTooltip(){this._tooltipHelper=new bU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}kU.type=YL.dot,kU.mark=AU,kU.builtInTheme={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"}}}}};class MU extends YD{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=>fi.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 TU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),wU=(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 CU extends kF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),ZO(this._option.dataSet,"linkDotInfo",wU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(CU.mark.group),this._containerMark=this._createMark(CU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(CU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(CU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:iO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new MU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}CU.type=YL.link,CU.mark=TU,CU.builtInTheme={link:{arrow:{style:{size:10}}}};const EU=Object.assign(Object.assign({},nF),{group:{name:"group",type:"group"}});class BU extends TN{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()?rO:yO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?aO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):Az;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):kz,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=lR(this.angleAxisHelper.dataToPosition([t[rO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=lR(this.angleAxisHelper.dataToPosition([t[aO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?lR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(BU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return sf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Lg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 OU=()=>{wR.registerAnimation("circularProgress",((t,e)=>({appear:RU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class IU extends bF{constructor(){super(...arguments),this._supportStack=!0}}class DU extends BU{constructor(){super(...arguments),this.type=YL.circularProgress,this.transformerConstructor=IU,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(k(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(k(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(){return this._progressMark=this._createMark(DU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:mF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(DU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?rO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?aO: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",t.AttributeLevel.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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}DU.type=YL.circularProgress,DU.mark=PU,DU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DU.transformerConstructor=IU;const FU=()=>{wR.registerSeries(DU.type,DU),jN(),OU(),_D(),lU(),aU()};function zU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const jU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:zU(t)}),HU={type:"fadeIn"};function VU(t,e="grow"){return!1===e?{}:"fadeIn"===e?HU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:zU(t)}))(t)}class NU extends YD{enableByType(t){return"dimension"!==t}}const UU=Object.assign(Object.assign({},nF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class WU extends kF{constructor(){super(...arguments),this.type=YL.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;return this._progressMark=this._createMark(WU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return lR(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+n},y1:t=>{var e,i;return lR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return lR(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 e,s;return lR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(WU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return lR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(uF(null===(i=wR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),pF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),pF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new NU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}WU.type=YL.linearProgress,WU.mark=UU,WU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const GU=()=>{EH(),wR.registerAnimation("linearProgress",((t,e)=>({appear:VU(t,e),enter:VU(t),disappear:jU(t)}))),_D(),wR.registerSeries(WU.type,WU)},YU=[0],$U=[20,40],XU=[200,500],KU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},qU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],ZU=`${qR}_WORD_CLOUD_TEXT`,JU=Object.assign(Object.assign({},nF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),QU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class tW extends xF{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=$U}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:XU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:YU,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)?ZU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:KU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Ny(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:YU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!qU.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 e;this._wordMark=this._createMark(tW.mark.word,{key:eO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(tW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(uF(wR.getAnimationInKey("wordCloud")(n,s),pF("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 rR).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:iO])}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 TE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new TE).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[tO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:eO,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,createCanvas:b_.createCanvas.bind(b_),getTextBounds:uf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:Hg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}tW.mark=JU,tW.builtInTheme={wordCloud:QU};function eW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||gD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=iW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},sW=(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=sW(t.children,e,t,n))})),s},nW=(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=nW(t.children,e,t,n)),n=e(t,s,i,n)})),n},rW=(t,e=[],i)=>{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):rW(t.children,e,i)))})),e};function aW(t,e){let i,s;if(hW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function hW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function pW(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 gW(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 fW(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 mW(t){return{_:t,next:null,prev:null}}function vW(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];pW(n,s,r);let a,o,l,h,c,d,u,p=mW(s),g=mW(n),f=mW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=iW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:xW.defaultOpionts.nodeSort;sW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)sW([o],_W(h)),nW([o],yW(this._getPadding,.5,a)),sW([o],bW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);sW([o],_W(xW.defaultOpionts.setRadius)),nW([o],yW(Lt,1,a)),c&&nW([o],yW(this._getPadding,o.radius/t,a)),sW([o],bW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}xW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const SW=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=SW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function AW(t){return t.depth}function kW(t,e){return e-1-t.endDepth}const MW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),TW=(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},wW={left:AW,right:kW,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:AW,end:kW},CW=yt(0,1);class EW{constructor(t){this._ascendingSourceBreadth=(t,e)=>MW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>MW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},EW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):wW[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)};"vertical"===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<=0)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))),"vertical"===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=[];SW(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:Mt(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+=Mt(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=[TW(s[t.source]),TW(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=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*CW(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(MW),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(MW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];BW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),PW);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({},LW.defaultOpionts,t):Object.assign({},LW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=iW(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=he({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)}}}function RW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:BW,slice:RW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?RW:BW)(t,e,i,s,n)}};class DW{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({},DW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?OW(this.options.aspectRatio):null!==(e=IW[this.options.splitType])&&void 0!==e?e:IW.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=iW(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)}))}}function FW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=FW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=zW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function GW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*YW({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},XW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||HW,s=e.lossFunction||jW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:$W(l),arcs:l})}))},KW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:qW,triangle:qW,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 qW(){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 ZW(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 JW=t=>KW[t]?KW[t]():KW.circle(),QW=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function tG(t){return d(t)?t:function(){return t}}class eG{constructor(t){var e,i;switch(this.options=j({},eG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=JW(this.options.shape),this.getText=null!==(e=tG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=tG(this.options.fontWeight),this.getTextFontSize=tG(this.options.fontSize),this.getTextFontStyle=tG(this.options.fontStyle),this.getTextFontFamily=tG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>QW(10,50);break;case"random-light":this.getTextColor=()=>QW(50,90);break;default:this.getTextColor=tG(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 ae(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():Tt(e);return ae(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 sG extends eG{constructor(t){var e;super(j({},sG.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<=sG.defaultOptions.minFontSize&&(this.options.minFontSize=sG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=iG[this.options.spiral])&&void 0!==e?e:iG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=tG(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}=ZW(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(aG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}oG(p,this._size)&&(p=lG(p,this._size))}else if(oG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||rG(p,i))&&(!i||!nG(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 nG(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 rG(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,oG=(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 lG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},cG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},dG=(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()},uG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=ZW(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=JW("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)dG(n,cG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)dG(n,cG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)dG(n,cG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=cG({x:l,y:h},o,-Math.PI/2,5),e=cG({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]);dG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let gG=class t extends iG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?cG(t,o,l.width,l.height,h):"geometric"===t.type&&pG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=JW(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()}};gG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class fG extends iG{constructor(t){super(j({},fG.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)}fG.defaultOptions={enlarge:!1};const vG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},_G=(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?yG(t.fontFamily):"sans-serif",d=t.fontStyle?yG(t.fontStyle):"normal",u=t.fontWeight?yG(t.fontWeight):"normal",p=t.rotate?yG(t.rotate):0,g=yG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?yG(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},vG),t.as):vG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?yG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=xG(SG(t,l),C);w=i=>e(t(i))}let E=nG;"fast"===t.layoutType?E=fG:"grid"===t.layoutType&&(E=gG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},yG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],bG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),xG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=bG(t[0]),n=bG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(bG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},SG=(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 AG(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{CR.registerGrammarTransform("wordcloud",{transform:_G}),uN(),CR.registerAnimation("wordCloud",((t,e)=>({appear:iW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),CR.registerSeries(kG.type,kG)},TG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},wG=(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},CG=`${ZR}_FUNNEL_TRANSFORM_RATIO`,EG=`${ZR}_FUNNEL_REACH_RATIO`,BG=`${ZR}_FUNNEL_HEIGHT_RATIO`,PG=`${ZR}_FUNNEL_VALUE_RATIO`,LG=`${ZR}_FUNNEL_LAST_VALUE_RATIO`,RG=`${ZR}_FUNNEL_NEXT_VALUE_RATIO`,OG=`${ZR}_FUNNEL_LAST_VALUE`,IG=`${ZR}_FUNNEL_CURRENT_VALUE`,DG=`${ZR}_FUNNEL_NEXT_VALUE`,FG=`${ZR}_FUNNEL_TRANSFORM_LEVEL`;class zG extends $D{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[EG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class jG extends aD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class HG extends jG{constructor(){super(...arguments),this.type=HG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}HG.type="polygon";const VG=()=>{CR.registerMark(HG.type,HG),Kk(),Uk(),hw.registerBuiltInAnimate("growPointsOut",aC),CR.registerGraphicComponent("polygon",rf)},NG=Object.assign(Object.assign({},rF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class UG extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class WG extends SF{constructor(){super(...arguments),this.type=$L.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=UG,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;JO(this._dataSet,"funnel",TG),JO(this._dataSet,"funnelTransform",wG);const t=new wa(this._dataSet,{name:`${ZR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new eD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:IG,asTransformRatio:CG,asReachRatio:EG,asHeightRatio:BG,asValueRatio:PG,asNextValueRatio:RG,asLastValueRatio:LG,asLastValue:OG,asNextValue:DG,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:FG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},WG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:vF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},WG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(WG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(WG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new zG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Dy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Dy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*WL(EG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),gF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("fadeInOut")(),gF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(pF(CR.getAnimationInKey("funnel")({},o),gF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(pF(null===(a=CR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),gF("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[LG])/2:this._getSecondaryAxisLength(t[PG])/2,n=this._getSecondaryAxisLength(t[PG])/2):(s=this._getSecondaryAxisLength(t[PG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[RG])/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[FG])}_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[iO]===t[iO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{VG(),uN(),kV(),CR.registerSeries(WG.type,WG),CR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},vD))),CR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),yD()},YG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},$G=t=>{const e=t.filter((t=>t.context.diffState===EI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},XG=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},KG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=XG(r,s,n);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),qG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},ZG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=$G(i.parent.children),a=qG(r);return YG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),JG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},QG=(t,e={})=>{if(!t)return[];const i=[];return aW(t,i,e),i},tY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new RW(i).layout(t,{width:s,height:n})};class eY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var iY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(iY||(iY={}));const sY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===iY.DrillDown){return Y(LO(t,n,s,"children"))}if(i.type===iY.DrillUp){const e=RO(t,n,s,"children");if(e)return Y(e)}return t};class nY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=oV(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;JO(t,"drillFilter",sY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:iY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:iY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:iY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:iY.DrillUp},model:this}),r}}const rY=Object.assign(Object.assign({},rF),{sunburst:{name:"sunburst",type:"arc"}}),aY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:JD,operations:["max","min","values"]}),t.push({key:QD,operations:["values"]}),t),oY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class lY extends wN{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),JO(this._dataSet,"sunburstLayout",tY),JO(this._dataSet,"flatten",QG),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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(lY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(lY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new eY(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(pF(null===(e=CR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}lY.type=$L.sunburst,lY.mark=rY,lY.builtInTheme={sunburst:oY},G(lY,nY);const hY=()=>{CR.registerSeries(lY.type,lY),HN(),uN(),yD(),CR.registerAnimation("sunburst",((t,e)=>({appear:JG(0,e),enter:KG(t),exit:ZG(t),disappear:ZG(t)})))},cY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new SW(i).layout(t,{width:s,height:n})};class dY extends $D{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const uY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},pY=Object.assign(Object.assign({},rF),{circlePacking:{name:"circlePacking",type:"arc"}});class gY extends MF{constructor(){super(...arguments),this.type=$L.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:QD),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:iO},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),JO(this._dataSet,"circlePackingLayout",cY),JO(this._dataSet,"flatten",QG),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)||(JO(t.dataSet,"addVChartProperty",HD),t.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(gY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return aY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new dY(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(pF(null===(i=CR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}gY.type=$L.circlePacking,gY.mark=pY,gY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(gY,nY);const fY=()=>{CR.registerSeries(gY.type,gY),HN(),uN(),_D(),CR.registerAnimation("circlePacking",((t,e)=>({appear:uY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},mY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&mY(t,e.children,i)}))},vY=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},_Y=(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 BW(e),r=[];return r.push(n.layout(s,i)),r},yY=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:[]},bY=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 xY extends $D{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 SY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),AY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:SY(t),kY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class MY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class TY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const wY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},CY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class EY extends XV{constructor(){super(...arguments),this.type=EY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?CY:wY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}EY.type="linkPath";const BY=Object.assign(Object.assign({},rF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class PY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const LY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class RY extends MF{constructor(){super(...arguments),this.type=$L.sankey,this.transformerConstructor=PY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=HO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=HO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=HO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),LY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=HO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=HO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=HO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=HO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=HO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(HO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=HO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=HO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void LY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){JO(this._dataSet,"sankeyLayout",_Y),JO(this._dataSet,"sankeyFormat",vY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;JO(o,"sankeyNodes",yY),JO(o,"flatten",QG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._nodesSeriesData=l,JO(o,"sankeyLinks",bY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:eF.bind(this),call:iF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(RY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(RY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=FD(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(pF(null===(i=CR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),gF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),gF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:$O.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(HO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new xY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new aR;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 mY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}RY.type=$L.sankey,RY.transformerConstructor=PY,RY.mark=BY,RY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const OY=()=>{BH(),KV(),Vk(),CR.registerGraphicComponent("path",(t=>Kg(t))),CR.registerMark(EY.type,EY),uN(),CR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:AY(t,e)},vD))),CR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:kY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),hw.registerBuiltInAnimate("linkPathGrowOut",TY),hw.registerBuiltInAnimate("linkPathGrowIn",MY),yD(),CR.registerSeries(RY.type,RY)},IY=(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=QG(n);return i=KD([{latestData:r}],e),i};class DY extends $D{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 FY=Object.assign(Object.assign({},rF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),zY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class jY extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const HY=(t,e)=>{if(e.getViewBox()){const i=new FW(e).layout(t,e.getViewBox()),s=[];return aW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[QD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class VY extends MF{constructor(){super(...arguments),this.type=$L.treemap,this.transformerConstructor=jY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:QD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:iO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),JO(this._dataSet,"treemap",HY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(JO(this._rawData.dataSet,"addVChartProperty",HD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=IY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){JO(this._dataSet,"hierarchyDimensionStatistics",IY),JO(this._dataSet,"flatten",QG);const i=new wa(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 aY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(VY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(VY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),gF(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 DY(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(UO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(UO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}VY.type=$L.treemap,VY.mark=FY,VY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},VY.transformerConstructor=jY,G(VY,nY),G(VY,hV);const NY=()=>{CR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),CR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),BH(),uN(),CR.registerAnimation("treemap",((t,e)=>({appear:zY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),yD(),CR.registerSeries(VY.type,VY)},UY=Object.assign(Object.assign({},BU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),WY=Object.assign(Object.assign({},rF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),GY={type:"fadeIn"};function YY(t,e){return"fadeIn"===e?GY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class $Y extends xF{constructor(){super(...arguments),this._supportStack=!1}}class XY extends $D{enableByType(t){return"dimension"!==t}}const KY="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",qY={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:KY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:KY,fill:"#ddd"}}};class ZY extends PU{constructor(){super(...arguments),this.type=$L.gaugePointer,this.transformerConstructor=$Y,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(ZY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},ZY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(ZY.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 XY(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}ZY.type=$L.gaugePointer,ZY.mark=WY,ZY.builtInTheme={gaugePointer:qY},ZY.transformerConstructor=$Y;const JY=()=>{CR.registerSeries(ZY.type,ZY),iV(),BH(),CR.registerAnimation("gaugePointer",((t,e)=>{const i=YY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),hU(),oU()};class QY extends xF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class t$ extends PU{constructor(){super(...arguments),this.type=$L.gauge,this.transformerConstructor=QY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();JO(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[xO]=t[this._angleField[0]],t[bO]=e>0?i[e-1][xO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(t$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(t$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[bO])?this.angleAxisHelper.dataToPosition([t[bO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[xO]])}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(pF(null===(i=CR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),gF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}t$.type=$L.gauge,t$.mark=UY,t$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},t$.transformerConstructor=QY;class e$ extends aD{constructor(){super(...arguments),this.type=e$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}e$.type="cell";function i$(t){return!1===t?{}:{type:"fadeIn"}}class s$ extends $D{enableByType(t){return"dimension"!==t}}const n$=Object.assign(Object.assign({},rF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class r$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class a$ extends MF{constructor(){super(...arguments),this.type=$L.heatmap,this.transformerConstructor=r$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(a$.mark.cell,{isSeriesMark:!0},{morph:vF(this._spec,a$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(a$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=kF(this);this._cellMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),gF("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 s$(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]}}a$.type=$L.heatmap,a$.mark=n$,a$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},a$.transformerConstructor=r$;const o$=()=>{uN(),CR.registerMark(e$.type,e$),CR.registerGraphicComponent("symbol",kg),Kk(),Zk(),bB(),CR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},vD),{appear:i$(e)}))),aj(),ij(),CR.registerSeries(a$.type,a$)},l$=Object.assign(Object.assign({},rF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),h$=`${ZR}_CORRELATION_X`,c$=`${ZR}_CORRELATION_Y`,d$=`${ZR}_CORRELATION_SIZE`,u$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=p$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),g$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},g$=(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,[eO]:null==n?void 0:n[eO],[sO]:null==n?void 0:n[sO]}};class m$ extends XV{constructor(){super(...arguments),this.type=m$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}m$.type="ripple";const v$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class _$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class y$ extends wN{constructor(){super(...arguments),this.type=$L.correlation,this.transformerConstructor=_$,this._viewBox=new He}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;JO(this._dataSet,"correlation",u$);const s=new Ta;QO(s,"dataview",Aa),JO(s,"correlationCenter",f$);const n=new wa(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 eD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(y$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:eO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(y$.mark.ripplePoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(y$.mark.centerPoint,{key:eO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[h$],y:t=>t[c$],size:t=>t[d$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),gF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}y$.type=$L.correlation,y$.mark=l$,y$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},y$.transformerConstructor=_$;const b$=()=>{ZF(),KV(),Zk(),CR.registerMark(m$.type,m$),CR.registerGraphicComponent("symbol",(t=>kg(t))),CR.registerSeries(y$.type,y$),CR.registerAnimation("correlation",((t,e)=>Object.assign({appear:v$(0,e)},mD)))},x$=Object.assign(Object.assign({},rF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class S$ extends XV{constructor(){super(...arguments),this.type=S$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}S$.type="liquid";const A$=(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 k$ extends $D{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 M$ extends SF{constructor(){super(...arguments),this.type=$L.liquid,this.transformerConstructor=JF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:A$(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=vR(this._spec.outlineMargin),this._paddingSpec=vR(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=Gt(...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(M$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(M$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(M$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(M$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new k$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(pF(null===(i=CR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),gF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(pF(null===(s=CR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),gF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=xM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}M$.type=$L.liquid,M$.mark=x$,M$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},M$.transformerConstructor=JF;const T$=t=>Y(t).join(",");class w$ extends $D{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>T$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const C$=Object.assign(Object.assign({},rF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class E$ extends xF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const B$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?KW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class P$ extends SF{constructor(){super(...arguments),this.type=$L.venn,this.transformerConstructor=E$,this._viewBox=new He}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:iO)}initData(){var t;super.initData(),JO(this._dataSet,"venn",B$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(P$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(P$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>T$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new w$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:T$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return T$(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[T$(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(T$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(pF(null===(e=CR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),gF(t.name,this._spec,this._markAttributeContext)))}))}}P$.type=$L.venn,P$.mark=C$,P$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},P$.transformerConstructor=E$;class L$ extends IH{constructor(){super(...arguments),this.type=$L.mosaic,this.transformerConstructor=OH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(vO),this.setFieldX2(mO)),this.setFieldY(yO),this.setFieldY2(_O)):(t&&(this.setFieldY(vO),this.setFieldY2(mO)),this.setFieldX(yO),this.setFieldX2(_O)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}L$.type=$L.mosaic,L$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},L$.transformerConstructor=OH;class R$ extends Ej{_isValidSeries(t){return t===$L.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class O$ extends wj{constructor(){super(...arguments),this.transformerConstructor=R$,this.type="map",this.seriesType=$L.map}}O$.type="map",O$.seriesType=$L.map,O$.transformerConstructor=R$;class I$ extends Ej{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 D$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=cz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,wR({},s,l)),n&&Object.assign(o,wR({},n,o))}}class F$ extends I${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class z$ extends I${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class j$ extends wj{constructor(){super(...arguments),this.transformerConstructor=z$}}j$.transformerConstructor=z$;class H$ extends j${constructor(){super(...arguments),this.transformerConstructor=z$,this.type="pie",this.seriesType=$L.pie}}H$.type="pie",H$.seriesType=$L.pie,H$.transformerConstructor=z$;class V$ extends F${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Tz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Tz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const N$=(t,e)=>{if(!t)return null;const i=jF(t,(t=>"angle"===t.getOrient()),e),s=jF(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&&jC(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=zL({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=jL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=FF(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&&jC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=zL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jL(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 _=FF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class U$ extends wj{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="rose",this.seriesType=$L.rose}_setModelOption(){this._modelOption.getDimensionInfo=N$}}U$.type="rose",U$.seriesType=$L.rose,U$.transformerConstructor=V$,G(U$,Oj);class W$ extends F${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=wR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>wR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class G$ extends wj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="radar",this.seriesType=$L.radar}_setModelOption(){this._modelOption.getDimensionInfo=N$}}G$.type="radar",G$.seriesType=$L.radar,G$.transformerConstructor=W$,G(G$,Oj);class Y$ extends Ej{_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=>{L(e,"trimPadding")&&wR(e,MI(this.type,t))})),this._transformAxisSpec(t)}}class $$ extends wj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Wj(t,e,i))&&void 0!==s?s:[],...null!==(n=N$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}$$.type="common",$$.transformerConstructor=Y$,G($$,Oj);class X$ extends Bj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class K$ extends wj{constructor(){super(...arguments),this.transformerConstructor=X$}}K$.transformerConstructor=X$,G(K$,Oj);class q$ extends X${transformSpec(t){super.transformSpec(t),SI(t)}}class Z$ extends K${constructor(){super(...arguments),this.transformerConstructor=q$,this.type="histogram",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}Z$.type="histogram",Z$.seriesType=$L.bar,Z$.transformerConstructor=q$;class J$ extends D${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class Q$ extends wj{constructor(){super(...arguments),this.transformerConstructor=J$,this.type="circularProgress",this.seriesType=$L.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=N$}}Q$.type="circularProgress",Q$.seriesType=$L.circularProgress,Q$.transformerConstructor=J$,G(Q$,Oj);class tX extends D${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=$L.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===$L.gauge||t.type===$L.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===$L.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class eX extends wj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="gauge",this.seriesType=$L.gaugePointer}}eX.type="gauge",eX.seriesType=$L.gaugePointer,eX.transformerConstructor=tX;class iX extends Ej{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class sX extends wj{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}sX.transformerConstructor=iX;class nX extends sX{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="wordCloud",this.seriesType=$L.wordCloud}}nX.type="wordCloud",nX.seriesType=$L.wordCloud,nX.transformerConstructor=iX;class rX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class aX extends wj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="funnel",this.seriesType=$L.funnel}}aX.type="funnel",aX.seriesType=$L.funnel,aX.transformerConstructor=rX;class oX extends Bj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=cz(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=cz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class lX extends wj{constructor(){super(...arguments),this.transformerConstructor=oX,this.type="linearProgress",this.seriesType=$L.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}lX.type="linearProgress",lX.seriesType=$L.linearProgress,lX.transformerConstructor=oX,G(lX,Oj);class hX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),SI(t)}}class cX extends wj{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="rangeColumn",this.seriesType=$L.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}cX.type="rangeColumn",cX.seriesType=$L.rangeColumn,cX.transformerConstructor=hX;class dX extends Ej{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class uX extends wj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="sunburst",this.seriesType=$L.sunburst}}uX.type="sunburst",uX.seriesType=$L.sunburst,uX.transformerConstructor=dX;class pX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gX extends wj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="circlePacking",this.seriesType=$L.circlePacking}}gX.type="circlePacking",gX.seriesType=$L.circlePacking,gX.transformerConstructor=pX;class fX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class mX extends wj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="treemap",this.seriesType=$L.treemap}}mX.type="treemap",mX.seriesType=$L.treemap,mX.transformerConstructor=fX;class vX extends FH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),SI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class _X extends zH{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="waterfall",this.seriesType=$L.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}_X.type="waterfall",_X.seriesType=$L.waterfall,_X.transformerConstructor=vX;class yX extends Bj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),SI(t)}}class bX extends wj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="boxPlot",this.seriesType=$L.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}bX.type="boxPlot",bX.seriesType=$L.boxPlot,bX.transformerConstructor=yX;class xX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class SX extends wj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="sankey",this.seriesType=$L.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=HO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}SX.type="sankey",SX.seriesType=$L.sankey,SX.transformerConstructor=xX;class AX extends Bj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),SI(t)}}class kX extends wj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rangeArea",this.seriesType=$L.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Wj,this._modelOption.getDimensionInfoByValue=Yj,this._modelOption.getRectByDimensionData=Jj}}kX.type="rangeArea",kX.seriesType=$L.rangeArea,kX.transformerConstructor=AX;class MX extends Bj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class TX extends wj{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="heatmap",this.seriesType=$L.heatmap}}TX.type="heatmap",TX.seriesType=$L.heatmap,TX.transformerConstructor=MX;class wX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CX extends wj{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="correlation",this.seriesType=$L.correlation}}CX.type="correlation",CX.seriesType=$L.correlation,CX.transformerConstructor=wX;function EX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=zO(t.style)),P(t.textStyle)||wR(s.textStyle,zO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&zO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&zO(s.background.style),s}const BX=(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},PX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:sO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class LX extends Lz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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=dR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new eD(this._option,e),this._initSelectedData(),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(VL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(wR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(wR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}LX.specKey="legends";class RX extends LX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){JO(this._option.dataSet,"discreteLegendFilter",PX),JO(this._option.dataSet,"discreteLegendDataMake",BX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return VL(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(!Ky(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=MO(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:f,regionIndex:m,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=EX(s):b.title={visible:!1},P(n.focusIconStyle)||zO(n.focusIconStyle),n.shape&&(n.shape=IO(n.shape)),n.label&&(n.label=IO(n.label)),n.value&&(n.value=IO(n.value)),n.background&&(n.background=IO(n.background)),uR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),uR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),uR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||zO(r.railStyle),P(r.sliderStyle)||zO(r.sliderStyle)):(P(r.textStyle)||zO(r.textStyle),r.handler&&IO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(wR(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 KP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(NP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(NP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=FD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=FD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}RX.specKey="legends",RX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},RX.type=r.discreteLegend;const OX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},IX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?OO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const DX={color:tL,size:iL},FX={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}},zX=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({},FX),{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"}}}})},jX={horizontal:zX(!0),vertical:zX(!1)},HX=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({},FX),{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"}}}})},VX={horizontal:HX(!0),vertical:HX(!1)},NX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],UX=[2,10];class WX extends LX{static getSpecInfo(t){const e=zD(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(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){JO(this._option.dataSet,"continuousLegendFilter",IX),JO(this._option.dataSet,"continuousLegendDataMake",OX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NL(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=MO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Ky(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MO(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()),P(a)&&(a="color"===this._legendType?NX:UX);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=wR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=EX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=zO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=zO(r.style)),P(a.style)||(w.trackStyle=zO(a.style)),w.startText=IO(o),w.endText=IO(l),w.handlerText=IO(h),P(c)||(w.sizeBackground=zO(c)),d.visible&&!P(d.style)&&(wR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return DX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}WX.specKey="legends",WX.builtInTheme={colorLegend:jX,sizeLegend:VX},WX.type=r.continuousLegend;const GX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,YX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),$X=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function XX(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=KX(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=>YX(i,s)(t)&&YX(n,r)(t)&&(u(a)||YX([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: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:YO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.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:YO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return LD.globalConfig.uniqueTooltip&&LD.hideTooltip(l.id),c}return"none"}const KX=(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=GX(c,t);let _=GX(d,t);const y=$X(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(YX(c,v));if(!y&&(_=GX(d,i),!$X(_)))return;const n=e.type===$L.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=jC(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(YX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=GX(d,o),!$X(_))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(YX(c,n));if(!y&&(_=GX(d,r),!$X(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===$L.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(YX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=GX(d,i),!$X(_))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},qX=t=>p(t)&&!y(t),ZX=t=>p(t)&&y(t);class JX extends Pz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=wR({},this._theme,r.style),r.offset=wR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Gy(this._option.mode)||!Uy(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=b_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Ny?void 0:Ny.body)}}const QX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class tK extends Lz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=JX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&qX(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&&LD.globalConfig.uniqueTooltip&&l&&LD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:YO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:YO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?iH.canvas:iH.dom,n=CR.getComponentPluginInType(t);n||jy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=CR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Wy(s)||Gy(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=XX(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(ZX(t)){if(qX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>IF(t,e[i])))}if(ZX(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}}tK.type=r.tooltip,tK.transformerConstructor=JX,tK.builtInTheme={tooltip:QX},tK.specKey="tooltip";var eK,iK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(eK||(eK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(iK||(iK={}));const sK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class nK extends Lz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{jC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:$O.chart}:{source:YO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Wy(e)||Gy(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(t.ChartEvent.tooltipHide,{source:YO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:YO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:YO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{sK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}nK.specKey="crosshair";const rK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class aK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=TF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){TF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:wF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"cartesian");e&&($j(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=qj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new rT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new aT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:rK},aK.type=r.cartesianCrosshair;class oK extends nK{static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=hz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=FD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new rT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new lT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new hT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new oT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}oK.specKey="crosshair",oK.builtInTheme={crosshair:rK},oK.type=r.polarCrosshair;const lK=(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},hK=(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)},cK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class dK extends Lz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=EF(t),this._isHorizontal="horizontal"===BF(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=>!FC(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(FC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};VL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,FC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;FC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else VL(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:n}=this._option;QO(n,"dataview",Aa),JO(n,"dataFilterComputeDomain",cK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new eD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(FC(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&&FC(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,FC(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=FC(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 aE,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||(JO(this._option.dataSet,"dataFilterWithNewDomain",hK),JO(this._option.dataSet,"lockStatisticsFilter",lK),VL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(FC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&jC(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,jC(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]}clear(){this._throttledHide=null}}G(dK,hV);class uK extends Pz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=wR({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}}}const pK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),gK={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:pK(!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:pK(!0)};class fK extends dK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=uK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new wE;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(!FC(t.type)||e[0]!==$(e))&&(!jC(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 UB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:zO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:zO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:zO(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:zO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:zO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:zO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:zO(g.style)},selectedBackgroundStyle:zO(this._spec.selectedBackground.style),dragMaskStyle:zO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:wR(zO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:wR(zO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},zO(null===(d=m.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}=FD(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()}}fK.type=r.dataZoom,fK.transformerConstructor=uK,fK.builtInTheme={dataZoom:gK},fK.specKey="dataZoom";const mK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class vK extends dK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 cM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=LL(this._start,e)&&LL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=zO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=zO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}vK.type=r.scrollBar,vK.builtInTheme={scrollBar:mK},vK.specKey="scrollBar";const _K=(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},yK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),bK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:yK("l1FontSize","primaryFontColor")},content:{visible:!0,style:yK("l2FontSize","tertiaryFontColor")}};class xK extends Lz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return zD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(HO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){JO(this._option.dataSet,"indicatorFilter",_K);const t=new wa(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 eD(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=wR({},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({},FO(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?yR(l,this._computeLayoutRadius()):0,dy:h?yR(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({},FO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}xK.type=r.indicator,xK.builtInTheme={indicator:bK},xK.specKey="indicator";const SK=["sum","average","min","max","variance","standardDeviation","median"];function AK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&AK(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=uR(t.x)?CK(t.x,n)+r.x:EK(l.getXAxisHelper(),[t.x])+r.x,h}function MK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&AK(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=uR(t.y)?CK(t.y,n)+r.y:EK(l.getYAxisHelper(),[t.y])+r.y,h}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&AK(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)),EK(a.angleAxisHelper,[t.angle])}function wK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&AK(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)),EK(a.radiusAxisHelper,[t.radius])}function CK(t,e){return Number(t.substring(0,t.length-1))*e/100}function EK(t,e){const i=t.getScale(0);return FC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function BK(t){return SK.includes(t)}function PK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=kK(t,_,n,u,c,o),r=MK(t,y,n,u,d,o),LK(s,b,S,g.length),LK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=kK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);LK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=MK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);LK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function LK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=TK(t,l,n,r),i=wK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=TK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=wK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function OK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=uR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=uR(i)?Number(i.substring(0,i.length-1))*f/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])&&AK(_,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])&&AK(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:EK(d.getXAxisHelper(),b)+p.x+m,y:EK(d.getYAxisHelper(),x)+p.y+v})})),n}function IK(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])&&AK(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])&&AK(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:EK(l.angleAxisHelper,d),radius:EK(l.radiusAxisHelper,u)})})),s}function DK(t,e,i){let{x:s,y:n}=t;return uR(s)&&(s=CK(s,e)),uR(n)&&(n=CK(n,i)),{x:s,y:n}}function FK(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}=DK(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=>DK(t,n,r)))}function zK(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 jK(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},zO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},VK(zO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=VK(zO(r),i,s)),t}return{visible:!1}}function HK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function VK(t,e,i){return d(t)?t(e,i):t}function NK(t,e){return d(t)?t(e):t}function UK(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 WK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=WK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function YK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=WK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function $K(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function XK(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])&&BK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&BK(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])&&BK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&BK(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=>qK(i,t,e))):i.x=qK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>qK(i,t,e))):i.y=qK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>qK(i,t,e))):i.angle=qK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>qK(i,t,e))):i.radius=qK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=qK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const KK={min:(t,e)=>RL(t[0].latestData,e.field),max:(t,e)=>OL(t[0].latestData,e.field),sum:function(t,e){return IL(t[0].latestData,e.field)},average:function(t,e){return DL(t[0].latestData,e.field)},variance:function(t,e){return FL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(FL(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 qK(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(m(t)){const{aggrType:i,field:s}=t;return KK[i](e,{field:s})}return t}function ZK(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 JK extends Lz{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 zD(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)&&BK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=UL(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){u(this._spec.offsetX)||(this._layoutOffsetX=gR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=gR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerFilter",ZK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function QK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=RL(t,e),r=OL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class tq extends JK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=GK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:VK(zO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{line:HK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return HK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return HK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:VK(zO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:VK(zO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=zK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=GK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;JO(this._option.dataSet,"markerAggregation",XK),JO(this._option.dataSet,"markerRegression",QK),JO(this._option.dataSet,"markerFilter",ZK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}tq.specKey="markLine";const eq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},sq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eq(!1),endSymbol:eq(!0),label:iq};class nq extends tq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new CP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=GK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=PK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=OK(i,r,d,e.coordinatesOffset):c&&(y=FK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(uR(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:u}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&p(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=Y(n.label),_=Y(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:u,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=GK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}nq.type=r.markLine,nq.coordinateType="cartesian",nq.builtInTheme={markLine:sq};class rq extends tq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=GK(this._spec);return e||i?new PP(t):new CP(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}=GK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=RK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=IK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=GK(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}}}rq.type=r.polarMarkLine,rq.coordinateType="polar",rq.builtInTheme={polarMarkLine:sq};class aq extends Lz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=dR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return zD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=gR(this._spec.width,l.width,null,l.width),c=gR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new sL(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}}aq.type=r.title,aq.specKey=r.title,aq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class oq extends JK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=YK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:VK(zO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>jK(t,this._markerData,this._markAttributeContext))),state:{area:HK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>HK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return HK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=zK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=YK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}oq.specKey="markArea";const lq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class hq extends oq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new BP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=YK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=PK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=OK(s,a,u,i.coordinatesOffset):d&&(f=FK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=YK(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}}}hq.type=r.markArea,hq.coordinateType="cartesian",hq.builtInTheme={markArea:lq};class cq extends oq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=YK(this._spec);return i||e||s?new LP(t):new BP(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}=YK(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=RK(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=IK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=YK(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}}}cq.type=r.polarMarkArea,cq.coordinateType="polar",cq.builtInTheme={polarMarkArea:lq};const dq=t=>zO(Object.assign({},t)),uq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},zO(t.style))}),pq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=dq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=dq(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:{},zO(Object.assign({},y)));var y;const b=uq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=uq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=uq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=uq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},gq=t=>"left"===t||"right"===t,fq=t=>"top"===t||"bottom"===t,mq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class vq extends Lz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},pq(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({},pq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new yL(t):this._playerComponent=new SL(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=gq(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=gq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(pL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(pL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(pL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=gq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=fq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):gq(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))):fq(this._orient)?this._maxSize():t.height}_computeDx(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return fq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}vq.builtInTheme={player:mq},vq.specKey="player",vq.type=r.player;class _q extends Lz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=eR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==EI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}_q.type=r.label;class yq extends dN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}yq.type="text",yq.constructorType="label";const bq=()=>{uN(),CR.registerMark(yq.constructorType,yq)};class xq extends Pz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sq extends _q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=xq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(UO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(UO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),VL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=wR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},PV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[fO])):t=>t.filter((t=>t.data[gO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?LV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Sq.type=r.label,Sq.specKey="label",Sq.transformerConstructor=xq;class Aq extends _q{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[uO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return wR({textStyle:{pickable:!0===this._spec.interactive},position:kq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[fO]:t.data[gO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>LV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function kq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Aq.type=r.totalLabel,Aq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Aq.specKey="totalLabel";class Mq extends JK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=$K(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=jK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=VK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=zO(VK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=VK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=VK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:NK(R.offsetX,this._relativeSeries.getRegion()),offsetY:NK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:VK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:VK(I.style,this._markerData,this._markAttributeContext)},state:{line:HK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:HK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:HK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:HK(J,this._markerData,this._markAttributeContext),textBackground:HK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:HK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:zO(st.style)}):{visible:!1};return new OP(et)}_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}=zK([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:UK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:UK(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}=$K(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Mq.specKey="markPoint";const Tq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class wq extends Mq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=PK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=OK(n,r,h,s.coordinatesOffset)[0]:l&&(c=FK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=$K(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}}}wq.type=r.markPoint,wq.coordinateType="cartesian",wq.builtInTheme={markPoint:Tq};class Cq extends Mq{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=RK(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:he({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}])]}}}Cq.type=r.polarMarkPoint,Cq.coordinateType="polar",Cq.builtInTheme={polarMarkPoint:Tq};class Eq extends Mq{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}])]}}}Eq.type=r.geoMarkPoint,Eq.coordinateType="geo",Eq.builtInTheme={geoMarkPoint:Tq};const Bq="inBrush",Pq="outOfBrush";class Lq extends Lz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return zD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Bq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Pq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new TL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:zO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(bL.brushActive,(s=>{this._initMarkBrushState(i,Pq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(bL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(bL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(bL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},zO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Bq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Bq),i.addState(Pq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Bq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Bq),i.addState(Pq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Bq),s.removeState(Pq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Lq.type=r.brush,Lq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Lq.specKey="brush";class Rq extends Lz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${ZR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=pF({},gF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Rq.type=r.customMark,Rq.specKey="customMark";class Oq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Iq(t))),a=n.filter((t=>!Iq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Iq(t))),h=o.filter((t=>!Iq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Iq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Oq.type="grid";const Dq="vchart-tooltip",Fq=`${Dq}-container`,zq=`${Dq}-title`,jq=`${Dq}-content-box`,Hq={offsetX:10,offsetY:10},Vq="99999999999999";function Nq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Uq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Wq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Nq(t):"",Gq=(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},Yq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},$q=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Yq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class Xq extends az{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=ND(null==T?void 0:T.position,b,e),C=null!==(r=ND(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:JR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:QR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Uq(e,F),V=Uq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch($q(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Gq(t,_),W.top=Gq(i,_),W.right=Gq(e,_),W.bottom=Gq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Gq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=$q(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",qq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Kq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Kq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},Zq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?gR(e,t.fontSize):0},Jq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Kq(o)),{panelStyle:a,panelPadding:o}};function Qq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class tZ extends Xq{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(tZ.type),this.type=iH.dom,this._tooltipContainer=null==Ny?void 0:Ny.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Ny&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Jq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Kq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=qq(h),x=qq(d),S=qq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Kq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Kq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Kq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(Zq(p),Zq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(zq))),l=a.find((t=>t.className.includes(jq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(zq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Qq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Dq}-column`),e.classList.add(`${Dq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(jq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Qq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Qq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Dq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Wq(e.key),e.keyStyle&&qq(e.keyStyle,l)):"value"===i?(o.innerHTML=Wq(e.value),e.valueStyle&&qq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Nq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Nq(c):m,y=p,b=t=>new Ag({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=dh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Nq(u):"currentColor",`\n \n \n \n `;const w=T?dh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Qq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(jq))),h=[...o.children].find((t=>t.className.includes(zq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(zq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=gR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Qq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},cf||(cf=lf.CreateGraphic("richtext",{})),cf.setAttributes(a),cf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function sZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nZ=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 rZ extends Xq{constructor(){super(rZ.type),this.type=iH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=vR(d.padding),x=sZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=sZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=sZ(m,i),k={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},M={panel:nZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=wR({},S,sZ(b,void 0,{})),{width:s,height:n,text:r}=iZ(h,i);T.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(m)){const t=wR({},A,sZ(x,void 0,{})),{width:e,height:s,text:n}=iZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=wR({},x,sZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=iZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}rZ.type=iH.canvas;const aZ=/\{([^}]+)\}/,oZ=/\{([^}]+)\}/g,lZ=/:/;class hZ extends az{constructor(){super(hZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[hZ.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)),CR.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=aZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(oZ,((t,i)=>{if(!lZ.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(bi.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}}hZ.pluginType="chart",hZ.specKey="formatter",hZ.type="formatterPlugin";LD.useRegisters([()=>{oH(),hH(),dH(),zj(),Fj(),Sj(),pj(),KF(),ZF(),xD(),_D(),aj(),ij(),CR.registerSeries(Aj.type,Aj),CR.registerChart(uH.type,uH)},()=>{oH(),hH(),dH(),Fj(),Sj(),pj(),KF(),fH(),ZF(),_H(),aj(),ij(),CR.registerSeries(bH.type,bH),zj(),CR.registerChart(SH.type,SH)},()=>{oH(),hH(),dH(),Fj(),DH(),zj(),CR.registerChart(zH.type,zH)},()=>{oH(),hH(),zj(),Fj(),XH(),CR.registerChart(qH.type,qH)},()=>{hH(),YN(),CR.registerChart(H$.type,H$)},()=>{oH(),hH(),zj(),Fj(),dU(),CR.registerChart(U$.type,U$)},()=>{oH(),hH(),dH(),zj(),Fj(),bU(),CR.registerChart(G$.type,G$)},()=>{oH(),hH(),dH(),zj(),Fj(),DH(),CR.registerChart(Z$.type,Z$)},()=>{hH(),uV(),iV(),CR.registerSeries(gV.type,gV),CR.registerImplement("registerMap",sI),CR.registerImplement("unregisterMap",nI),yD(),CR.registerChart(O$.type,O$)},()=>{hH(),JY(),CR.registerSeries(t$.type,t$),HN(),IU(),oU(),zU(),CR.registerChart(eX.type,eX)},()=>{hH(),MG(),CR.registerChart(nX.type,nX)},()=>{hH(),GG(),CR.registerChart(aX.type,aX)},()=>{oH(),hH(),dH(),zj(),Fj(),UV(),CR.registerChart(_X.type,_X)},()=>{oH(),hH(),zj(),Fj(),cN(),CR.registerChart(bX.type,bX)},()=>{oH(),hH(),zj(),Fj(),zU(),CR.registerChart(Q$.type,Q$)},()=>{oH(),hH(),zj(),Fj(),YU(),CR.registerChart(lX.type,lX)},()=>{oH(),hH(),zj(),Fj(),xN(),CR.registerChart(cX.type,cX)},()=>{oH(),hH(),dH(),zj(),Fj(),fH(),aj(),ij(),CR.registerSeries(TN.type,TN),CR.registerChart(kX.type,kX)},()=>{hH(),hY(),CR.registerChart(uX.type,uX)},()=>{hH(),fY(),CR.registerChart(gX.type,gX)},()=>{hH(),NY(),CR.registerChart(mX.type,mX)},()=>{hH(),Bh.load(gM),OY(),CR.registerChart(SX.type,SX)},()=>{hH(),o$(),CR.registerChart(TX.type,TX)},()=>{hH(),b$(),CR.registerChart(CX.type,CX)},()=>{oH(),hH(),dH(),zj(),CR.registerChart($$.type,$$),Fj()},ij,aj,()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(oj.type,oj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(lj.type,lj)},()=>{CR.registerGraphicComponent(Rz.lineAxis,((t,e)=>new kC(t,e))),CR.registerGraphicComponent(Oz.lineAxisGrid,((t,e)=>new OB(t,e))),jz(),CR.registerComponent(hj.type,hj)},hU,oU,()=>{CR.registerComponent(RX.type,RX)},()=>{CR.registerComponent(WX.type,WX)},()=>{CR.registerComponent(tK.type,tK)},()=>{CR.registerComponent(aK.type,aK)},()=>{CR.registerComponent(oK.type,oK)},()=>{CR.registerComponent(fK.type,fK)},()=>{CR.registerComponent(vK.type,vK)},()=>{CR.registerComponent(xK.type,xK)},uV,()=>{CR.registerComponent(nq.type,nq),wP()},()=>{CR.registerComponent(hq.type,hq),EP()},()=>{CR.registerComponent(wq.type,wq),RP()},()=>{CR.registerComponent(rq.type,rq),PP._animate=lP,wP()},()=>{CR.registerComponent(cq.type,cq),LP._animate=cP,EP()},()=>{CR.registerComponent(Cq.type,Cq),RP()},()=>{CR.registerComponent(Eq.type,Eq),RP()},()=>{CR.registerComponent(aq.type,aq)},()=>{CR.registerComponent(vq.type,vq)},()=>{CR.registerGraphicComponent(Sq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Sq.type,Sq,!0,1/0)},()=>{CR.registerGraphicComponent(Aq.type,(t=>new BB(t))),bq(),Dz(),CR.registerComponent(Aq.type,Aq,!0)},()=>{CR.registerComponent(Lq.type,Lq)},()=>{CR.registerComponent(Rq.type,Rq)},()=>{Bh.load(sT)},()=>{CR.registerLayout(Oq.type,Oq)},()=>{var t;t=rZ,CR.registerComponentPlugin(t.type,t)},()=>{var t;t=hZ,CR.registerChartPlugin(t.type,t)},wD,BD]),LD.useRegisters([()=>{NS(Bh)}]),t.DEFAULT_CHART_HEIGHT=QR,t.DEFAULT_CHART_WIDTH=JR,t.DEFAULT_CLOSE_STROKE_JOIN=ID,t.DEFAULT_DATA_INDEX=eO,t.DEFAULT_DATA_KEY=iO,t.DEFAULT_DATA_SERIES_FIELD=sO,t.DEFAULT_KEY=SO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=OD,t.DEFAULT_MEASURE_CANVAS_ID=tO,t.DEFAULT_SERIES_STYLE_NAME=nO,t.DEFAULT_SMOOTH_INTERPOLATE=RD,t.Factory=CR,t.MOSAIC_CAT_END_PERCENT=yO,t.MOSAIC_CAT_START_PERCENT=_O,t.MOSAIC_VALUE_END_PERCENT=vO,t.MOSAIC_VALUE_START_PERCENT=mO,t.ManualTicker=class extends aw{constructor(t){super(t),this.lastFrameTime=0,this.status=wo.RUNNING}setupTickHandler(){const t=new ow;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===wo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===wo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=wo.RUNNING,!0}},t.PREFIX=ZR,t.SEGMENT_FIELD_END=xO,t.SEGMENT_FIELD_START=bO,t.STACK_FIELD_END=oO,t.STACK_FIELD_END_OffsetSilhouette=dO,t.STACK_FIELD_END_PERCENT=hO,t.STACK_FIELD_KEY=rO,t.STACK_FIELD_START=aO,t.STACK_FIELD_START_OffsetSilhouette=cO,t.STACK_FIELD_START_PERCENT=lO,t.STACK_FIELD_TOTAL=uO,t.STACK_FIELD_TOTAL_BOTTOM=fO,t.STACK_FIELD_TOTAL_PERCENT=pO,t.STACK_FIELD_TOTAL_TOP=gO,t.StreamLight=class extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=vo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new zl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=vo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Wo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=nl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=nl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?hG(t,o,l.width,l.height,h):"geometric"===t.type&&uG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=ZW(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()}};pG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class gG extends eG{constructor(t){super(j({},gG.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)}gG.defaultOptions={enlarge:!1};const mG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},vG=(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?_G(t.fontFamily):"sans-serif",d=t.fontStyle?_G(t.fontStyle):"normal",u=t.fontWeight?_G(t.fontWeight):"normal",p=t.rotate?_G(t.rotate):0,g=_G(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?_G(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},mG),t.as):mG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?_G(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=bG(xG(t,l),C);w=i=>e(t(i))}let E=sG;"fast"===t.layoutType?E=gG:"grid"===t.layoutType&&(E=pG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},_G=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],yG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),bG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=yG(t[0]),n=yG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(yG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},xG=(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 SG(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{wR.registerGrammarTransform("wordcloud",{transform:vG}),dN(),wR.registerAnimation("wordCloud",((t,e)=>({appear:eW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),wR.registerSeries(AG.type,AG)},MG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},TG=(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},wG=`${qR}_FUNNEL_TRANSFORM_RATIO`,CG=`${qR}_FUNNEL_REACH_RATIO`,EG=`${qR}_FUNNEL_HEIGHT_RATIO`,BG=`${qR}_FUNNEL_VALUE_RATIO`,PG=`${qR}_FUNNEL_LAST_VALUE_RATIO`,LG=`${qR}_FUNNEL_NEXT_VALUE_RATIO`,RG=`${qR}_FUNNEL_LAST_VALUE`,OG=`${qR}_FUNNEL_CURRENT_VALUE`,IG=`${qR}_FUNNEL_NEXT_VALUE`,DG=`${qR}_FUNNEL_TRANSFORM_LEVEL`;class FG extends YD{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[CG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class zG extends rD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class jG extends zG{constructor(){super(...arguments),this.type=jG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}jG.type="polygon";const HG=()=>{wR.registerMark(jG.type,jG),Xk(),Nk(),lw.registerBuiltInAnimate("growPointsOut",rC),wR.registerGraphicComponent("polygon",af)},VG=Object.assign(Object.assign({},nF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class NG extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class UG extends xF{constructor(){super(...arguments),this.type=YL.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=NG,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;ZO(this._dataSet,"funnel",MG),ZO(this._dataSet,"funnelTransform",TG);const t=new wa(this._dataSet,{name:`${qR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new tD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:OG,asTransformRatio:wG,asReachRatio:CG,asHeightRatio:EG,asValueRatio:BG,asNextValueRatio:LG,asLastValueRatio:PG,asLastValue:RG,asNextValue:IG,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:DG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},UG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:mF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},UG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(UG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(UG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new FG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Iy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*UL(CG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),pF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("fadeInOut")(),pF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(uF(wR.getAnimationInKey("funnel")({},o),pF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(uF(null===(a=wR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),pF("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[PG])/2:this._getSecondaryAxisLength(t[BG])/2,n=this._getSecondaryAxisLength(t[BG])/2):(s=this._getSecondaryAxisLength(t[BG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LG])/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[DG])}_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[eO]===t[eO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{HG(),dN(),AV(),wR.registerSeries(UG.type,UG),wR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},mD))),wR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),_D()},GG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},YG=t=>{const e=t.filter((t=>t.context.diffState===CI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},$G=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},XG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=$G(r,s,n);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),KG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},qG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=YG(i.parent.children),a=KG(r);return GG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),ZG=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},JG=(t,e={})=>{if(!t)return[];const i=[];return rW(t,i,e),i},QG=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new LW(i).layout(t,{width:s,height:n})};class tY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var eY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(eY||(eY={}));const iY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===eY.DrillDown){return Y(PO(t,n,s,"children"))}if(i.type===eY.DrillUp){const e=LO(t,n,s,"children");if(e)return Y(e)}return t};class sY{_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;ZO(t,"drillFilter",iY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:eY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:eY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:eY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:eY.DrillUp},model:this}),r}}const nY=Object.assign(Object.assign({},nF),{sunburst:{name:"sunburst",type:"arc"}}),rY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:ZD,operations:["max","min","values"]}),t.push({key:JD,operations:["values"]}),t),aY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class oY extends TN{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),ZO(this._dataSet,"sunburstLayout",QG),ZO(this._dataSet,"flatten",JG),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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(oY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(oY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new tY(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(uF(null===(e=wR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}oY.type=YL.sunburst,oY.mark=nY,oY.builtInTheme={sunburst:aY},G(oY,sY);const lY=()=>{wR.registerSeries(oY.type,oY),jN(),dN(),_D(),wR.registerAnimation("sunburst",((t,e)=>({appear:ZG(0,e),enter:XG(t),exit:qG(t),disappear:qG(t)})))},hY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new xW(i).layout(t,{width:s,height:n})};class cY extends YD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const dY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},uY=Object.assign(Object.assign({},nF),{circlePacking:{name:"circlePacking",type:"arc"}});class pY extends kF{constructor(){super(...arguments),this.type=YL.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:JD),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:eO},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),ZO(this._dataSet,"circlePackingLayout",hY),ZO(this._dataSet,"flatten",JG),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)||(ZO(t.dataSet,"addVChartProperty",jD),t.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(pY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return rY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new cY(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(uF(null===(i=wR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}pY.type=YL.circlePacking,pY.mark=uY,pY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(pY,sY);const gY=()=>{wR.registerSeries(pY.type,pY),jN(),dN(),vD(),wR.registerAnimation("circlePacking",((t,e)=>({appear:dY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},fY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&fY(t,e.children,i)}))},mY=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},vY=(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 EW(e),r=[];return r.push(n.layout(s,i)),r},_Y=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:[]},yY=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 bY extends YD{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 xY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),SY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:xY(t),AY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class kY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class MY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const TY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},wY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class CY extends $V{constructor(){super(...arguments),this.type=CY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?wY:TY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}CY.type="linkPath";const EY=Object.assign(Object.assign({},nF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class BY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const PY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class LY extends kF{constructor(){super(...arguments),this.type=YL.sankey,this.transformerConstructor=BY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=jO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=jO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=jO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),PY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=jO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=jO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=jO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=jO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=jO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(jO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=jO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=jO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void PY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){ZO(this._dataSet,"sankeyLayout",vY),ZO(this._dataSet,"sankeyFormat",mY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;ZO(o,"sankeyNodes",_Y),ZO(o,"flatten",JG);const l=new wa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._nodesSeriesData=l,ZO(o,"sankeyLinks",yY);const h=new wa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:tF.bind(this),call:eF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(LY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(LY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=DD(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(uF(null===(i=wR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),pF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),pF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:YO.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(jO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new bY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new rR;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 fY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}LY.type=YL.sankey,LY.transformerConstructor=BY,LY.mark=EY,LY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const RY=()=>{EH(),XV(),Hk(),wR.registerGraphicComponent("path",(t=>qg(t))),wR.registerMark(CY.type,CY),dN(),wR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:SY(t,e)},mD))),wR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:AY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lw.registerBuiltInAnimate("linkPathGrowOut",MY),lw.registerBuiltInAnimate("linkPathGrowIn",kY),_D(),wR.registerSeries(LY.type,LY)},OY=(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=JG(n);return i=XD([{latestData:r}],e),i};class IY extends YD{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 DY=Object.assign(Object.assign({},nF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class zY extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const jY=(t,e)=>{if(e.getViewBox()){const i=new DW(e).layout(t,e.getViewBox()),s=[];return rW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[JD,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class HY extends kF{constructor(){super(...arguments),this.type=YL.treemap,this.transformerConstructor=zY,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:JD),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:eO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),ZO(this._dataSet,"treemap",jY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(ZO(this._rawData.dataSet,"addVChartProperty",jD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:iF.bind(this),call:sF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=OY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){ZO(this._dataSet,"hierarchyDimensionStatistics",OY),ZO(this._dataSet,"flatten",JG);const i=new wa(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 rY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(HY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(HY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),pF(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 IY(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(NO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(NO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}HY.type=YL.treemap,HY.mark=DY,HY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},HY.transformerConstructor=zY,G(HY,sY),G(HY,lV);const VY=()=>{wR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),wR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),EH(),dN(),wR.registerAnimation("treemap",((t,e)=>({appear:FY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),_D(),wR.registerSeries(HY.type,HY)},NY=Object.assign(Object.assign({},EU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),UY=Object.assign(Object.assign({},nF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),WY={type:"fadeIn"};function GY(t,e){return"fadeIn"===e?WY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class YY extends bF{constructor(){super(...arguments),this._supportStack=!1}}class $Y extends YD{enableByType(t){return"dimension"!==t}}const XY="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",KY={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:XY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:XY,fill:"#ddd"}}};class qY extends BU{constructor(){super(...arguments),this.type=YL.gaugePointer,this.transformerConstructor=YY,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(qY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},qY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(qY.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 $Y(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})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}qY.type=YL.gaugePointer,qY.mark=UY,qY.builtInTheme={gaugePointer:KY},qY.transformerConstructor=YY;const ZY=()=>{wR.registerSeries(qY.type,qY),eV(),EH(),wR.registerAnimation("gaugePointer",((t,e)=>{const i=GY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),lU(),aU()};class JY extends bF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class QY extends BU{constructor(){super(...arguments),this.type=YL.gauge,this.transformerConstructor=JY,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();ZO(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[bO]=t[this._angleField[0]],t[yO]=e>0?i[e-1][bO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(QY.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(QY.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[yO])?this.angleAxisHelper.dataToPosition([t[yO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[bO]])}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(uF(null===(i=wR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),pF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}QY.type=YL.gauge,QY.mark=NY,QY.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},QY.transformerConstructor=JY;class t$ extends rD{constructor(){super(...arguments),this.type=t$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Mg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}t$.type="cell";function e$(t){return!1===t?{}:{type:"fadeIn"}}class i$ extends YD{enableByType(t){return"dimension"!==t}}const s$=Object.assign(Object.assign({},nF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class n$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class r$ extends kF{constructor(){super(...arguments),this.type=YL.heatmap,this.transformerConstructor=n$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(r$.mark.cell,{isSeriesMark:!0},{morph:mF(this._spec,r$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(r$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ri(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=AF(this);this._cellMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),pF("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 i$(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]}}r$.type=YL.heatmap,r$.mark=s$,r$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},r$.transformerConstructor=n$;const a$=()=>{dN(),wR.registerMark(t$.type,t$),wR.registerGraphicComponent("symbol",Mg),Xk(),qk(),yB(),wR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},mD),{appear:e$(e)}))),rj(),ej(),wR.registerSeries(r$.type,r$)},o$=Object.assign(Object.assign({},nF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),l$=`${qR}_CORRELATION_X`,h$=`${qR}_CORRELATION_Y`,c$=`${qR}_CORRELATION_SIZE`,d$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=u$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),p$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},p$=(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,[tO]:null==n?void 0:n[tO],[iO]:null==n?void 0:n[iO]}};class f$ extends $V{constructor(){super(...arguments),this.type=f$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}f$.type="ripple";const m$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class v$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class _$ extends TN{constructor(){super(...arguments),this.type=YL.correlation,this.transformerConstructor=v$,this._viewBox=new He}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;ZO(this._dataSet,"correlation",d$);const s=new Ta;JO(s,"dataview",Aa),ZO(s,"correlationCenter",g$);const n=new wa(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 tD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(_$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:tO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(_$.mark.ripplePoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(_$.mark.centerPoint,{key:tO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[l$],y:t=>t[h$],size:t=>t[c$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),pF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}_$.type=YL.correlation,_$.mark=o$,_$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},_$.transformerConstructor=v$;const y$=()=>{qF(),XV(),qk(),wR.registerMark(f$.type,f$),wR.registerGraphicComponent("symbol",(t=>Mg(t))),wR.registerSeries(_$.type,_$),wR.registerAnimation("correlation",((t,e)=>Object.assign({appear:m$(0,e)},fD)))},b$=Object.assign(Object.assign({},nF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class x$ extends $V{constructor(){super(...arguments),this.type=x$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}x$.type="liquid";const S$=(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 A$ extends YD{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 k$ extends xF{constructor(){super(...arguments),this.type=YL.liquid,this.transformerConstructor=ZF,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Lg({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=Mg({x:s,y:n,size:r,symbolType:S$(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=mR(this._spec.outlineMargin),this._paddingSpec=mR(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=Gt(...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(k$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(k$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(k$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(k$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new A$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(uF(null===(i=wR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),pF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(uF(null===(s=wR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),pF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=bM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}k$.type=YL.liquid,k$.mark=b$,k$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},k$.transformerConstructor=ZF;const M$=t=>Y(t).join(",");class T$ extends YD{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>M$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const w$=Object.assign(Object.assign({},nF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class C$ extends bF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const E$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?XW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class B$ extends xF{constructor(){super(...arguments),this.type=YL.venn,this.transformerConstructor=C$,this._viewBox=new He}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:eO)}initData(){var t;super.initData(),ZO(this._dataSet,"venn",E$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(B$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(B$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>M$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new T$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:M$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return M$(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[M$(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(M$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(uF(null===(e=wR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),pF(t.name,this._spec,this._markAttributeContext)))}))}}B$.type=YL.venn,B$.mark=w$,B$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},B$.transformerConstructor=C$;class P$ extends OH{constructor(){super(...arguments),this.type=YL.mosaic,this.transformerConstructor=RH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(mO),this.setFieldX2(fO)),this.setFieldY(_O),this.setFieldY2(vO)):(t&&(this.setFieldY(mO),this.setFieldY2(fO)),this.setFieldX(_O),this.setFieldX2(vO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}P$.type=YL.mosaic,P$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},P$.transformerConstructor=RH;class L$ extends Cj{_isValidSeries(t){return t===YL.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class R$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=L$,this.type="map",this.seriesType=YL.map}}R$.type="map",R$.seriesType=YL.map,R$.transformerConstructor=L$;class O$ extends Cj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 I$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=hz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,TR({},s,l)),n&&Object.assign(o,TR({},n,o))}}class D$ extends O${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class F$ extends O${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class z$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=F$}}z$.transformerConstructor=F$;class j$ extends z${constructor(){super(...arguments),this.transformerConstructor=F$,this.type="pie",this.seriesType=YL.pie}}j$.type="pie",j$.seriesType=YL.pie,j$.transformerConstructor=F$;class H$ extends D${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Mz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Mz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const V$=(t,e)=>{if(!t)return null;const i=zF(t,(t=>"angle"===t.getOrient()),e),s=zF(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&&zC(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=FL({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=zL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=DF(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&&zC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=zL(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 _=DF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class N$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=H$,this.type="rose",this.seriesType=YL.rose}_setModelOption(){this._modelOption.getDimensionInfo=V$}}N$.type="rose",N$.seriesType=YL.rose,N$.transformerConstructor=H$,G(N$,Rj);class U$ extends D${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=TR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>TR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class W$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="radar",this.seriesType=YL.radar}_setModelOption(){this._modelOption.getDimensionInfo=V$}}W$.type="radar",W$.seriesType=YL.radar,W$.transformerConstructor=U$,G(W$,Rj);class G$ extends Cj{_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=>{L(e,"trimPadding")&&TR(e,kI(this.type,t))})),this._transformAxisSpec(t)}}class Y$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Uj(t,e,i))&&void 0!==s?s:[],...null!==(n=V$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}Y$.type="common",Y$.transformerConstructor=G$,G(Y$,Rj);class $$ extends Ej{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class X$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=$$}}X$.transformerConstructor=$$,G(X$,Rj);class K$ extends $${transformSpec(t){super.transformSpec(t),xI(t)}}class q$ extends X${constructor(){super(...arguments),this.transformerConstructor=K$,this.type="histogram",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}q$.type="histogram",q$.seriesType=YL.bar,q$.transformerConstructor=K$;class Z$ extends I${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class J$ extends Tj{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="circularProgress",this.seriesType=YL.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=V$}}J$.type="circularProgress",J$.seriesType=YL.circularProgress,J$.transformerConstructor=Z$,G(J$,Rj);class Q$ extends I${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=YL.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===YL.gauge||t.type===YL.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===YL.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class tX extends Tj{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="gauge",this.seriesType=YL.gaugePointer}}tX.type="gauge",tX.seriesType=YL.gaugePointer,tX.transformerConstructor=Q$;class eX extends Cj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class iX extends Tj{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}iX.transformerConstructor=eX;class sX extends iX{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="wordCloud",this.seriesType=YL.wordCloud}}sX.type="wordCloud",sX.seriesType=YL.wordCloud,sX.transformerConstructor=eX;class nX extends Cj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class rX extends Tj{constructor(){super(...arguments),this.transformerConstructor=nX,this.type="funnel",this.seriesType=YL.funnel}}rX.type="funnel",rX.seriesType=YL.funnel,rX.transformerConstructor=nX;class aX extends Ej{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=hz(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=hz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class oX extends Tj{constructor(){super(...arguments),this.transformerConstructor=aX,this.type="linearProgress",this.seriesType=YL.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}oX.type="linearProgress",oX.seriesType=YL.linearProgress,oX.transformerConstructor=aX,G(oX,Rj);class lX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),xI(t)}}class hX extends Tj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rangeColumn",this.seriesType=YL.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}hX.type="rangeColumn",hX.seriesType=YL.rangeColumn,hX.transformerConstructor=lX;class cX extends Cj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dX extends Tj{constructor(){super(...arguments),this.transformerConstructor=cX,this.type="sunburst",this.seriesType=YL.sunburst}}dX.type="sunburst",dX.seriesType=YL.sunburst,dX.transformerConstructor=cX;class uX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class pX extends Tj{constructor(){super(...arguments),this.transformerConstructor=uX,this.type="circlePacking",this.seriesType=YL.circlePacking}}pX.type="circlePacking",pX.seriesType=YL.circlePacking,pX.transformerConstructor=uX;class gX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fX extends Tj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="treemap",this.seriesType=YL.treemap}}fX.type="treemap",fX.seriesType=YL.treemap,fX.transformerConstructor=gX;class mX extends DH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),xI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class vX extends FH{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="waterfall",this.seriesType=YL.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}vX.type="waterfall",vX.seriesType=YL.waterfall,vX.transformerConstructor=mX;class _X extends Ej{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),xI(t)}}class yX extends Tj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="boxPlot",this.seriesType=YL.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}yX.type="boxPlot",yX.seriesType=YL.boxPlot,yX.transformerConstructor=_X;class bX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class xX extends Tj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="sankey",this.seriesType=YL.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=jO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}xX.type="sankey",xX.seriesType=YL.sankey,xX.transformerConstructor=bX;class SX extends Ej{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),xI(t)}}class AX extends Tj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeArea",this.seriesType=YL.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Uj,this._modelOption.getDimensionInfoByValue=Gj,this._modelOption.getRectByDimensionData=Zj}}AX.type="rangeArea",AX.seriesType=YL.rangeArea,AX.transformerConstructor=SX;class kX extends Ej{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class MX extends Tj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="heatmap",this.seriesType=YL.heatmap}}MX.type="heatmap",MX.seriesType=YL.heatmap,MX.transformerConstructor=kX;class TX extends Cj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Tj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="correlation",this.seriesType=YL.correlation}}wX.type="correlation",wX.seriesType=YL.correlation,wX.transformerConstructor=TX;function CX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=FO(t.style)),P(t.textStyle)||TR(s.textStyle,FO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&FO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&FO(s.background.style),s}const EX=(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},BX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:iO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class PX extends Pz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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=cR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new tD(this._option,e),this._initSelectedData(),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(HL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(TR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(TR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}PX.specKey="legends";class LX extends PX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){ZO(this._option.dataSet,"discreteLegendFilter",BX),ZO(this._option.dataSet,"discreteLegendDataMake",EX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HL(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(!Xy(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=kO(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:f,regionIndex:m,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=CX(s):b.title={visible:!1},P(n.focusIconStyle)||FO(n.focusIconStyle),n.shape&&(n.shape=OO(n.shape)),n.label&&(n.label=OO(n.label)),n.value&&(n.value=OO(n.value)),n.background&&(n.background=OO(n.background)),dR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),dR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),dR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||FO(r.railStyle),P(r.sliderStyle)||FO(r.sliderStyle)):(P(r.textStyle)||FO(r.textStyle),r.handler&&OO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(TR(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 XP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(VP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(VP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(VP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=DD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=DD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}LX.specKey="legends",LX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},LX.type=r.discreteLegend;const RX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},OX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?RO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const IX={color:QP,size:eL},DX={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}},FX=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({},DX),{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"}}}})},zX={horizontal:FX(!0),vertical:FX(!1)},jX=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({},DX),{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"}}}})},HX={horizontal:jX(!0),vertical:jX(!1)},VX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],NX=[2,10];class UX extends PX{static getSpecInfo(t){const e=FD(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(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){ZO(this._option.dataSet,"continuousLegendFilter",OX),ZO(this._option.dataSet,"continuousLegendDataMake",RX);const t=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>VL(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=kO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=kO(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()),P(a)&&(a="color"===this._legendType?VX:NX);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=TR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=CX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=FO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=FO(r.style)),P(a.style)||(w.trackStyle=FO(a.style)),w.startText=OO(o),w.endText=OO(l),w.handlerText=OO(h),P(c)||(w.sizeBackground=FO(c)),d.visible&&!P(d.style)&&(TR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return IX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}UX.specKey="legends",UX.builtInTheme={colorLegend:zX,sizeLegend:HX},UX.type=r.continuousLegend;const WX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,GX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),YX=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function $X(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=XX(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=>GX(i,s)(t)&&GX(n,r)(t)&&(u(a)||GX([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: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:GO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.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:GO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return PD.globalConfig.uniqueTooltip&&PD.hideTooltip(l.id),c}return"none"}const XX=(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=WX(c,t);let _=WX(d,t);const y=YX(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(GX(c,v));if(!y&&(_=WX(d,i),!YX(_)))return;const n=e.type===YL.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=zC(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(GX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=WX(d,o),!YX(_))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(GX(c,n));if(!y&&(_=WX(d,r),!YX(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===YL.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(GX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=WX(d,i),!YX(_))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},KX=t=>p(t)&&!y(t),qX=t=>p(t)&&y(t);class ZX extends Bz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=TR({},this._theme,r.style),r.offset=TR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Wy(this._option.mode)||!Ny(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=b_.getElementById(t.parentElement)):Ny(this._option.mode)&&(t.parentElement=null==Vy?void 0:Vy.body)}}const JX={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class QX extends Pz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=ZX,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Ny(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&KX(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&&PD.globalConfig.uniqueTooltip&&l&&PD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:GO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:GO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?eH.canvas:eH.dom,n=wR.getComponentPluginInType(t);n||zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=wR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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)||Wy(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=$X(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(qX(t)){if(KX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>OF(t,e[i])))}if(qX(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}}QX.type=r.tooltip,QX.transformerConstructor=ZX,QX.builtInTheme={tooltip:JX},QX.specKey="tooltip";var tK,eK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(tK||(tK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eK||(eK={}));const iK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class sK extends Pz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{zC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:YO.chart}:{source:GO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Uy(e)||Wy(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(t.ChartEvent.tooltipHide,{source:GO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:GO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:GO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{iK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}sK.specKey="crosshair";const nK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class rK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=MF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){MF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:TF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"cartesian");e&&(Yj(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=Kj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new nT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new rT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}rK.specKey="crosshair",rK.builtInTheme={crosshair:nK},rK.type=r.cartesianCrosshair;class aK extends sK{static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=lz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=DD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new nT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new oT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new aT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}aK.specKey="crosshair",aK.builtInTheme={crosshair:nK},aK.type=r.polarCrosshair;const oK=(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},lK=(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)},hK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class cK extends Pz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this._start+f,0,1),_=vt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=CF(t),this._isHorizontal="horizontal"===EF(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=>!DC(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(DC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};HL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,DC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;DC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else HL(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:n}=this._option;JO(n,"dataview",Aa),ZO(n,"dataFilterComputeDomain",hK);const r=new wa(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new tD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(DC(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&&DC(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,DC(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=DC(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 rE,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||(ZO(this._option.dataSet,"dataFilterWithNewDomain",lK),ZO(this._option.dataSet,"lockStatisticsFilter",oK),HL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(DC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=St((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&zC(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,zC(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]}clear(){this._throttledHide=null}}G(cK,lV);class dK extends Bz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=TR({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}}}const uK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),pK={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:uK(!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:uK(!0)};class gK extends cK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=dK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new TE;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(!DC(t.type)||e[0]!==$(e))&&(!zC(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 NB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:FO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:FO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:FO(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:FO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:FO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:FO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:FO(g.style)},selectedBackgroundStyle:FO(this._spec.selectedBackground.style),dragMaskStyle:FO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:TR(FO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:TR(FO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},FO(null===(d=m.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}=DD(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()}}gK.type=r.dataZoom,gK.transformerConstructor=dK,gK.builtInTheme={dataZoom:pK},gK.specKey="dataZoom";const fK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class mK extends cK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 hM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=PL(this._start,e)&&PL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=FO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=FO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}mK.type=r.scrollBar,mK.builtInTheme={scrollBar:fK},mK.specKey="scrollBar";const vK=(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},_K=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),yK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:_K("l1FontSize","primaryFontColor")},content:{visible:!0,style:_K("l2FontSize","tertiaryFontColor")}};class bK extends Pz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return FD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(jO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){ZO(this._option.dataSet,"indicatorFilter",vK);const t=new wa(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 tD(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=TR({},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({},DO(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?_R(l,this._computeLayoutRadius()):0,dy:h?_R(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({},DO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}bK.type=r.indicator,bK.builtInTheme={indicator:yK},bK.specKey="indicator";const xK=["sum","average","min","max","variance","standardDeviation","median"];function SK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function AK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&SK(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=dR(t.x)?wK(t.x,n)+r.x:CK(l.getXAxisHelper(),[t.x])+r.x,h}function kK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&SK(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=dR(t.y)?wK(t.y,n)+r.y:CK(l.getYAxisHelper(),[t.y])+r.y,h}function MK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&SK(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)),CK(a.angleAxisHelper,[t.angle])}function TK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&SK(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)),CK(a.radiusAxisHelper,[t.radius])}function wK(t,e){return Number(t.substring(0,t.length-1))*e/100}function CK(t,e){const i=t.getScale(0);return DC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function EK(t){return xK.includes(t)}function BK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=AK(t,_,n,u,c,o),r=kK(t,y,n,u,d,o),PK(s,b,S,g.length),PK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=AK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);PK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=kK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);PK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function PK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=MK(t,l,n,r),i=TK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=MK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=TK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function RK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=dR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=dR(i)?Number(i.substring(0,i.length-1))*f/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])&&SK(_,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])&&SK(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:CK(d.getXAxisHelper(),b)+p.x+m,y:CK(d.getYAxisHelper(),x)+p.y+v})})),n}function OK(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])&&SK(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])&&SK(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:CK(l.angleAxisHelper,d),radius:CK(l.radiusAxisHelper,u)})})),s}function IK(t,e,i){let{x:s,y:n}=t;return dR(s)&&(s=wK(s,e)),dR(n)&&(n=wK(n,i)),{x:s,y:n}}function DK(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}=IK(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=>IK(t,n,r)))}function FK(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 zK(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},FO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},HK(FO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=HK(FO(r),i,s)),t}return{visible:!1}}function jK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function HK(t,e,i){return d(t)?t(e,i):t}function VK(t,e){return d(t)?t(e):t}function NK(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 UK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function WK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=UK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function GK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=UK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function YK(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function $K(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])&&EK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&EK(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])&&EK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&EK(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=>KK(i,t,e))):i.x=KK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>KK(i,t,e))):i.y=KK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>KK(i,t,e))):i.angle=KK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>KK(i,t,e))):i.radius=KK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=KK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const XK={min:(t,e)=>LL(t[0].latestData,e.field),max:(t,e)=>RL(t[0].latestData,e.field),sum:function(t,e){return OL(t[0].latestData,e.field)},average:function(t,e){return IL(t[0].latestData,e.field)},variance:function(t,e){return DL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DL(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 KK(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(m(t)){const{aggrType:i,field:s}=t;return XK[i](e,{field:s})}return t}function qK(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 ZK extends Pz{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 FD(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)&&EK(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 Ta;return e.registerParser("array",s),new wa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=NL(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){u(this._spec.offsetX)||(this._layoutOffsetX=pR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=pR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerFilter",qK);const i=new wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function JK(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=LL(t,e),r=RL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class QK extends ZK{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=WK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:HK(FO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{line:jK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return jK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return jK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:HK(FO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:HK(FO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=FK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=WK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;ZO(this._option.dataSet,"markerAggregation",$K),ZO(this._option.dataSet,"markerRegression",JK),ZO(this._option.dataSet,"markerFilter",qK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new wa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}QK.specKey="markLine";const tq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),eq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},iq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:tq(!1),endSymbol:tq(!0),label:eq};class sq extends QK{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new wP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=WK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=BK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=RK(i,r,d,e.coordinatesOffset):c&&(y=DK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(dR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=WK(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 wa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}sq.type=r.markLine,sq.coordinateType="cartesian",sq.builtInTheme={markLine:iq};class nq extends QK{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=WK(this._spec);return e||i?new BP(t):new wP(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}=WK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=LK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=OK(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=WK(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}}}nq.type=r.polarMarkLine,nq.coordinateType="polar",nq.builtInTheme={polarMarkLine:iq};class rq extends Pz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=cR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return FD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=pR(this._spec.width,l.width,null,l.width),c=pR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iL(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}}rq.type=r.title,rq.specKey=r.title,rq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class aq extends ZK{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=GK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:HK(FO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>zK(t,this._markerData,this._markAttributeContext))),state:{area:jK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>jK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return jK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=FK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=GK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}aq.specKey="markArea";const oq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class lq extends aq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=GK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=BK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=RK(s,a,u,i.coordinatesOffset):d&&(f=DK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=GK(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}}}lq.type=r.markArea,lq.coordinateType="cartesian",lq.builtInTheme={markArea:oq};class hq extends aq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=GK(this._spec);return i||e||s?new PP(t):new EP(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}=GK(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=LK(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=OK(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=GK(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}}}hq.type=r.polarMarkArea,hq.coordinateType="polar",hq.builtInTheme={polarMarkArea:oq};const cq=t=>FO(Object.assign({},t)),dq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},FO(t.style))}),uq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=cq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=cq(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:{},FO(Object.assign({},y)));var y;const b=dq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=dq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=dq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=dq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},pq=t=>"left"===t||"right"===t,gq=t=>"top"===t||"bottom"===t,fq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class mq extends Pz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},uq(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({},uq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _L(t):this._playerComponent=new xL(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=pq(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=pq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(uL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=pq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=gq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):pq(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))):gq(this._orient)?this._maxSize():t.height}_computeDx(t){return pq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return gq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}mq.builtInTheme={player:fq},mq.specKey="player",mq.type=r.player;class vq extends Pz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=tR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==CI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}vq.type=r.label;class _q extends cN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}_q.type="text",_q.constructorType="label";const yq=()=>{dN(),wR.registerMark(_q.constructorType,_q)};class bq extends Bz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class xq extends vq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=bq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(NO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(NO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=TR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},BV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[gO])):t=>t.filter((t=>t.data[pO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?PV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}xq.type=r.label,xq.specKey="label",xq.transformerConstructor=bq;class Sq extends vq{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[dO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return TR({textStyle:{pickable:!0===this._spec.interactive},position:Aq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[gO]:t.data[pO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>PV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Aq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Sq.type=r.totalLabel,Sq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Sq.specKey="totalLabel";class kq extends ZK{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=YK(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=zK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=HK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=FO(HK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=HK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=HK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:VK(R.offsetX,this._relativeSeries.getRegion()),offsetY:VK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:HK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:HK(I.style,this._markerData,this._markAttributeContext)},state:{line:jK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:jK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:jK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:jK(J,this._markerData,this._markAttributeContext),textBackground:jK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:jK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:FO(st.style)}):{visible:!1};return new RP(et)}_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}=FK([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:NK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:NK(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}=YK(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}kq.specKey="markPoint";const Mq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Tq extends kq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=BK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=RK(n,r,h,s.coordinatesOffset)[0]:l&&(c=DK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=YK(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}}}Tq.type=r.markPoint,Tq.coordinateType="cartesian",Tq.builtInTheme={markPoint:Mq};class wq extends kq{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=LK(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:he({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}])]}}}wq.type=r.polarMarkPoint,wq.coordinateType="polar",wq.builtInTheme={polarMarkPoint:Mq};class Cq extends kq{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}])]}}}Cq.type=r.geoMarkPoint,Cq.coordinateType="geo",Cq.builtInTheme={geoMarkPoint:Mq};const Eq="inBrush",Bq="outOfBrush";class Pq extends Pz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return FD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Eq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Bq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new ML(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:FO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(yL.brushActive,(s=>{this._initMarkBrushState(i,Bq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(yL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(yL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(yL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},FO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Eq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Eq),i.addState(Bq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Eq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Eq),i.addState(Bq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Eq),s.removeState(Bq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Pq.type=r.brush,Pq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Pq.specKey="brush";class Lq extends Pz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${qR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=uF({},pF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Lq.type=r.customMark,Lq.specKey="customMark";class Rq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Oq(t))),a=n.filter((t=>!Oq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Oq(t))),h=o.filter((t=>!Oq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Oq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Rq.type="grid";const Iq="vchart-tooltip",Dq=`${Iq}-container`,Fq=`${Iq}-title`,zq=`${Iq}-content-box`,jq={offsetX:10,offsetY:10},Hq="99999999999999";function Vq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Nq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Uq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Vq(t):"",Wq=(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},Gq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Yq=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Gq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class $q extends rz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=VD(null==T?void 0:T.position,b,e),C=null!==(r=VD(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:ZR,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:JR;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Ny(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Nq(e,F),V=Nq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(Yq(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Wq(t,_),W.top=Wq(i,_),W.right=Wq(e,_),W.bottom=Wq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Wq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=Yq(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Kq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Xq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Xq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},qq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?pR(e,t.fontSize):0},Zq=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ri(r),a.padding=Xq(o)),{panelStyle:a,panelPadding:o}};function Jq(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class Qq extends $q{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(Qq.type),this.type=eH.dom,this._tooltipContainer=null==Vy?void 0:Vy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Vy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=Zq(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Xq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Kq(h),x=Kq(d),S=Kq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Xq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Xq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Xq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(qq(p),qq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Fq))),l=a.find((t=>t.className.includes(zq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Fq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(Jq(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${Iq}-column`),e.classList.add(`${Iq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(zq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];Jq(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));Jq(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${Iq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Uq(e.key),e.keyStyle&&Kq(e.keyStyle,l)):"value"===i?(o.innerHTML=Uq(e.value),e.valueStyle&&Kq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Vq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Vq(c):m,y=p,b=t=>new kg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=ph.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Vq(u):"currentColor",`\n \n \n \n `;const w=T?ph.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),Jq(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(zq))),h=[...o.children].find((t=>t.className.includes(Fq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(Fq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=pR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,Jq(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},df||(df=hf.CreateGraphic("richtext",{})),df.setAttributes(a),df.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function iZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:tZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const sZ=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 nZ extends $q{constructor(){super(nZ.type),this.type=eH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new BL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=mR(d.padding),x=iZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=iZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=iZ(m,i),k={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},M={panel:sZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=TR({},S,iZ(b,void 0,{})),{width:s,height:n,text:r}=eZ(h,i);T.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(m)){const t=TR({},A,iZ(x,void 0,{})),{width:e,height:s,text:n}=eZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=TR({},x,iZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=eZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}nZ.type=eH.canvas;const rZ=/\{([^}]+)\}/,aZ=/\{([^}]+)\}/g,oZ=/:/;class lZ extends rz{constructor(){super(lZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[lZ.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)),wR.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=rZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(aZ,((t,i)=>{if(!oZ.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(bi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}lZ.pluginType="chart",lZ.specKey="formatter",lZ.type="formatterPlugin";PD.useRegisters([()=>{aH(),lH(),cH(),Fj(),Dj(),xj(),uj(),XF(),qF(),bD(),vD(),rj(),ej(),wR.registerSeries(Sj.type,Sj),wR.registerChart(dH.type,dH)},()=>{aH(),lH(),cH(),Dj(),xj(),uj(),XF(),gH(),qF(),vH(),rj(),ej(),wR.registerSeries(yH.type,yH),Fj(),wR.registerChart(xH.type,xH)},()=>{aH(),lH(),cH(),Dj(),IH(),Fj(),wR.registerChart(FH.type,FH)},()=>{aH(),lH(),Fj(),Dj(),$H(),wR.registerChart(KH.type,KH)},()=>{lH(),GN(),wR.registerChart(j$.type,j$)},()=>{aH(),lH(),Fj(),Dj(),cU(),wR.registerChart(N$.type,N$)},()=>{aH(),lH(),cH(),Fj(),Dj(),yU(),wR.registerChart(W$.type,W$)},()=>{aH(),lH(),cH(),Fj(),Dj(),IH(),wR.registerChart(q$.type,q$)},()=>{lH(),dV(),eV(),wR.registerSeries(pV.type,pV),wR.registerImplement("registerMap",iI),wR.registerImplement("unregisterMap",sI),_D(),wR.registerChart(R$.type,R$)},()=>{lH(),ZY(),wR.registerSeries(QY.type,QY),jN(),OU(),aU(),FU(),wR.registerChart(tX.type,tX)},()=>{lH(),kG(),wR.registerChart(sX.type,sX)},()=>{lH(),WG(),wR.registerChart(rX.type,rX)},()=>{aH(),lH(),cH(),Fj(),Dj(),NV(),wR.registerChart(vX.type,vX)},()=>{aH(),lH(),Fj(),Dj(),hN(),wR.registerChart(yX.type,yX)},()=>{aH(),lH(),Fj(),Dj(),FU(),wR.registerChart(J$.type,J$)},()=>{aH(),lH(),Fj(),Dj(),GU(),wR.registerChart(oX.type,oX)},()=>{aH(),lH(),Fj(),Dj(),bN(),wR.registerChart(hX.type,hX)},()=>{aH(),lH(),cH(),Fj(),Dj(),gH(),rj(),ej(),wR.registerSeries(MN.type,MN),wR.registerChart(AX.type,AX)},()=>{lH(),lY(),wR.registerChart(dX.type,dX)},()=>{lH(),gY(),wR.registerChart(pX.type,pX)},()=>{lH(),VY(),wR.registerChart(fX.type,fX)},()=>{lH(),vo.load(pM),RY(),wR.registerChart(xX.type,xX)},()=>{lH(),a$(),wR.registerChart(MX.type,MX)},()=>{lH(),y$(),wR.registerChart(wX.type,wX)},()=>{aH(),lH(),cH(),Fj(),wR.registerChart(Y$.type,Y$),Dj()},ej,rj,()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(aj.type,aj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(oj.type,oj)},()=>{wR.registerGraphicComponent(Lz.lineAxis,((t,e)=>new AC(t,e))),wR.registerGraphicComponent(Rz.lineAxisGrid,((t,e)=>new RB(t,e))),zz(),wR.registerComponent(lj.type,lj)},lU,aU,()=>{wR.registerComponent(LX.type,LX)},()=>{wR.registerComponent(UX.type,UX)},()=>{wR.registerComponent(QX.type,QX)},()=>{wR.registerComponent(rK.type,rK)},()=>{wR.registerComponent(aK.type,aK)},()=>{wR.registerComponent(gK.type,gK)},()=>{wR.registerComponent(mK.type,mK)},()=>{wR.registerComponent(bK.type,bK)},dV,()=>{wR.registerComponent(sq.type,sq),TP()},()=>{wR.registerComponent(lq.type,lq),CP()},()=>{wR.registerComponent(Tq.type,Tq),LP()},()=>{wR.registerComponent(nq.type,nq),BP._animate=oP,TP()},()=>{wR.registerComponent(hq.type,hq),PP._animate=hP,CP()},()=>{wR.registerComponent(wq.type,wq),LP()},()=>{wR.registerComponent(Cq.type,Cq),LP()},()=>{wR.registerComponent(rq.type,rq)},()=>{wR.registerComponent(mq.type,mq)},()=>{wR.registerGraphicComponent(xq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(xq.type,xq,!0,1/0)},()=>{wR.registerGraphicComponent(Sq.type,(t=>new EB(t))),yq(),Iz(),wR.registerComponent(Sq.type,Sq,!0)},()=>{wR.registerComponent(Pq.type,Pq)},()=>{wR.registerComponent(Lq.type,Lq)},()=>{vo.load(iT)},()=>{wR.registerLayout(Rq.type,Rq)},()=>{var t;t=nZ,wR.registerComponentPlugin(t.type,t)},()=>{var t;t=lZ,wR.registerChartPlugin(t.type,t)},TD,ED]),PD.useRegisters([()=>{VS(vo)}]),t.DEFAULT_CHART_HEIGHT=JR,t.DEFAULT_CHART_WIDTH=ZR,t.DEFAULT_CLOSE_STROKE_JOIN=OD,t.DEFAULT_DATA_INDEX=tO,t.DEFAULT_DATA_KEY=eO,t.DEFAULT_DATA_SERIES_FIELD=iO,t.DEFAULT_KEY=xO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=RD,t.DEFAULT_MEASURE_CANVAS_ID=QR,t.DEFAULT_SERIES_STYLE_NAME=sO,t.DEFAULT_SMOOTH_INTERPOLATE=LD,t.Factory=wR,t.MOSAIC_CAT_END_PERCENT=_O,t.MOSAIC_CAT_START_PERCENT=vO,t.MOSAIC_VALUE_END_PERCENT=mO,t.MOSAIC_VALUE_START_PERCENT=fO,t.ManualTicker=class extends rw{constructor(t){super(t),this.lastFrameTime=0,this.status=Eo.RUNNING}setupTickHandler(){const t=new aw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Eo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Eo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Eo.RUNNING,!0}},t.PREFIX=qR,t.SEGMENT_FIELD_END=bO,t.SEGMENT_FIELD_START=yO,t.STACK_FIELD_END=aO,t.STACK_FIELD_END_OffsetSilhouette=cO,t.STACK_FIELD_END_PERCENT=lO,t.STACK_FIELD_KEY=nO,t.STACK_FIELD_START=rO,t.STACK_FIELD_START_OffsetSilhouette=hO,t.STACK_FIELD_START_PERCENT=oO,t.STACK_FIELD_TOTAL=dO,t.STACK_FIELD_TOTAL_BOTTOM=gO,t.STACK_FIELD_TOTAL_PERCENT=uO,t.STACK_FIELD_TOTAL_TOP=pO,t.StreamLight=class extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=yo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Hl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=yo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Yo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=al(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=al(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;evoid>": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79020,14 +79038,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79035,14 +79053,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79050,14 +79068,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79065,14 +79083,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79080,14 +79098,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79095,14 +79113,14 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" }, "size": { @@ -79110,7 +79128,7 @@ } }, "required": [ - "__@toStringTag@12825", + "__@toStringTag@12849", "size" ], "type": "object" @@ -100603,34 +100621,34 @@ }, "Promise": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" } }, "required": [ - "__@toStringTag@12825" + "__@toStringTag@12849" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" } }, "required": [ - "__@toStringTag@12825" + "__@toStringTag@12849" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12825": { + "__@toStringTag@12849": { "type": "string" } }, "required": [ - "__@toStringTag@12825" + "__@toStringTag@12849" ], "type": "object" }, diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 250086d126..5e059131e3 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "2.0.5", + "version": "2.0.6", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/data/transforms/waterfall.d.ts b/packages/vchart-types/types/data/transforms/waterfall.d.ts index 97e5b43fae..dbac6f85cf 100644 --- a/packages/vchart-types/types/data/transforms/waterfall.d.ts +++ b/packages/vchart-types/types/data/transforms/waterfall.d.ts @@ -8,6 +8,7 @@ export interface IWaterfallOpt { startAs: string; endAs: string; total: IWaterfallSeriesSpec['total']; + calculationMode: 'increase' | 'decrease'; seriesFieldName: { total: string; increase: string; @@ -22,5 +23,6 @@ export interface IWaterfallFillEndOpt { valueField: string; seriesField?: string; total: IWaterfallSeriesSpec['total']; + calculationMode: IWaterfallSeriesSpec['calculationMode']; } export declare const waterfallFillTotal: (data: Array, op: IWaterfallFillEndOpt) => Datum[]; diff --git a/packages/vchart-types/types/plugin/chart/formatter/formatter.d.ts b/packages/vchart-types/types/plugin/chart/formatter/formatter.d.ts index a95a547f1d..ebf324202e 100644 --- a/packages/vchart-types/types/plugin/chart/formatter/formatter.d.ts +++ b/packages/vchart-types/types/plugin/chart/formatter/formatter.d.ts @@ -23,6 +23,9 @@ export declare class FormatterPlugin extends BasePlugin implements IChartPlugin protected _format(text: string | number | string[] | number[], datum: any, formatter: string | string[]): string | number | (string | number)[]; protected _formatSingleLine(text: string | number, datum: any, formatter: string): string | number; protected _formatSingleText(text: string | number, formatter: string): string | number; + private _calcFormatter; + private _calculateMathExpression; + private _isValidMathExpression; release(): void; } export declare const registerFormatPlugin: () => void; diff --git a/packages/vchart-types/types/series/waterfall/interface.d.ts b/packages/vchart-types/types/series/waterfall/interface.d.ts index a510c7ed72..4458c75fe7 100644 --- a/packages/vchart-types/types/series/waterfall/interface.d.ts +++ b/packages/vchart-types/types/series/waterfall/interface.d.ts @@ -49,6 +49,7 @@ export interface IWaterfallSeriesSpec extends Omit { + let canvasDom: HTMLCanvasElement; + + beforeEach(() => { + canvasDom = createCanvas(); + canvasDom.style.position = 'relative'; + canvasDom.style.width = '500px'; + canvasDom.style.height = '500px'; + canvasDom.width = 500; + canvasDom.height = 500; + }); + + afterEach(() => { + removeDom(canvasDom); + }); + + test('basic calc expressions', () => { + const spec = { + data: { + id: 'barData', + values: data + }, + type: 'bar', + xField: 'x', + yField: 'y', + label: { + visible: true + }, + animation: false + }; + + const chart = new VChart(spec as unknown as IBarChartSpec, { + renderCanvas: canvasDom, + onError: () => {} + }); + + chart.renderSync(); + + // 验证 calc 功能是否正确应用 + const formatter = (chart as any)._chartPlugin?._plugins?.find((p: any) => p.type === 'formatterPlugin'); + expect(formatter).toBeDefined(); + + // 测试基本的 calc 表达式 + expect(formatter._format(100, { value: 10000 }, '{value:calc(v/10000)}w')).toBe('1w'); + expect(formatter._format(1, { value: 1 }, '{value:calc(v+99)}')).toBe('100'); + expect(formatter._format(0.111, { value: 0.111 }, '{value:.2f}')).toBe('0.11'); + }); +}); diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 9829289451..a842aaa19e 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.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=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=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=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var w=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 k=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 B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=k(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.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&&P.call(t,e);function I(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){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,s=!1,n=!1){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 U(t){return Object.prototype.toString.call(t)}function z(t){return Object.keys(t)}function H(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(U(t)!==U(e))return!1;if(u(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(!H(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=z(t),n=z(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(!H(t[r],e[r],i))return!1}return!0}function V(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;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(t=et.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):tt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=et.Warn&&tt(this._method||"warn","WARN",t),this}info(...t){return this._level>=et.Info&&tt(this._method||"log","INFO",t),this}debug(...t){return this._level>=et.Debug&&tt(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Z(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,i=rt,s=nt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ct=function(t,e,i){return ti?i:t};var ut=(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 dt(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,u=!1,d=!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||u&&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 u?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,d&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function ft(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),gt(t,e,{leading:s,trailing:n,maxWait:e})}function mt(t,e){return i=>t*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=1e-12,_t=Math.PI,bt=_t/2,xt=2*_t,St=2*Math.PI,At=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Ct=Math.min,Mt=Math.sin,Bt=Math.sqrt,Et=Math.pow;function Rt(t){return t>=1?bt:t<=-1?-bt: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 Ot(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(It(t),It(e)))}class Dt{constructor(t=0,e=0,i,s){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 Bt(Et(t.x-e.x,2)+Et(t.y-e.y,2))}static distanceNN(t,e,i,s){return Bt(Et(t-i,2)+Et(e-s,2))}static distancePN(t,e,i){return Bt(Et(e-t.x,2)+Et(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 Nt=(t=0)=>{if(t<0)for(;t<-xt;)t+=xt;else if(t>0)for(;t>xt;)t-=xt;return t};function Ut(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 zt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ht(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=zt(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 Vt(t){return(t=zt(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 Wt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Gt(t,e,i,s){if(!function(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&h<=1&&[t[0]+n[0]*h,t[1]+n[1]*h]}var Yt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Yt||(Yt={}));const Xt=(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 $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.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 qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const i=e?jt(t.angle):t.angle,s=Jt(t);return[Zt({x:t.x1,y:t.y1},i,s),Zt({x:t.x2,y:t.y1},i,s),Zt({x:t.x2,y:t.y2},i,s),Zt({x:t.x1,y:t.y2},i,s)]}function te(t,e,i=!1){const s=Qt(t,i),n=Qt(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Jt(t),Jt(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),u=i?jt(t.angle):t.angle;let d=i?jt(90-t.angle):t.angle+bt;const p=i?jt(e.angle):e.angle;let g=i?jt(90-e.angle):e.angle+bt;d>St&&(d-=St),g>St&&(g-=St);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(qt(n,i)+qt(n,s))/2>qt(n,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ee(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const ie=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 se(t,e={},i){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 ne{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(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:u,textBaseline:d=(null!=u?u:"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:d,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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(ne.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ne.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ne.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(ne.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ne.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)}}ne.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ne.NUMBERS_CHAR_SET="0123456789",ne.FULL_SIZE_CHAR="字";const re=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ae=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=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 he extends le{}class ce extends le{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new ce(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 ue,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,u=s*this.e-n*this.f+r,d=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,u=o*t+h*e,d=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=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ue;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,u=-n/l,d=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ue(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 de{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 pe(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 ge(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 fe=/^#([0-9a-f]{3,8})$/,me={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 ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function _e(t){return S(t)?new we(t>>16,t>>8&255,255&t,1):_(t)?new we(t[0],t[1],t[2]):new we(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new we((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?_e(t):8===e?new we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t,e=1){return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ae?t:new Ae(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(me[t]))return function(t){return S(t)?new we(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new we(t[0],t[1],t[2],t[3]):new we(255,255,255,1)}(me[t]);if(p(ve[t]))return _e(ve[t]);const e=`${t}`.trim().toLowerCase(),i=Se(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 we(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=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new we(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new we(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=ge(this.color.r,this.color.g,this.color.b),r=pe(d(t)?n.h:ct(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new we(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Ae(this.color.toString())}copyGammaToLinear(t,e=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,e=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=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class we{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`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(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}=ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Te(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),u=Math.round(a*(1-t)+o*t);return new we(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ge});function Ce(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 Me(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}class Be{static getInstance(){return Be.instance||(Be.instance=new Be),Be.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 Re;function Pe(t,e){const i=Ee(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 Oe{constructor(t={}){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 Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){let e;if(e=Ie.exec(t))return new Oe({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 De=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Fe{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 Fe.instance||(Fe.instance=new Fe),Fe.instance}newFormat(t){const e=Le(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,u=e.type;"n"===u?(l=!0,u="g"):je[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=je[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?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=d,A=p,w=t;if("c"===u)A=g(w)+A,w="";else{w=+w;let t=w<0||1/w<0;if(w=isNaN(w)?m:g(Math.abs(w),h),c&&(w=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}(w)),t&&0==+w&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===u?De[8+Re/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=w.length;++ex||x>57){A=(46===x?y+w.slice(e+1):w.slice(e))+A,w=w.slice(0,e);break}}l&&!a&&(w=_(w,1/0));let T=S.length+w.length+A.length,k=T>1)+S+w+A+k.slice(T);break;default:w=k+S+w+A}return b(w)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Le(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Ee(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=De[8+n/3];return function(t){return s(r*t)+a}}}const je={"%":(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)=>Pe(100*t,e),r:Pe,s:function(t,e){const i=Ee(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Re=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")+Ee(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 Ne=function(t,...e){return function(t,...e){t||(t={});let i=-1;const s=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+$e(e,6):$e(e,4))+"-"+$e(t.getUTCMonth()+1,2)+"-"+$e(t.getUTCDate(),2)+(r?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"."+$e(r,3)+"Z":n?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"Z":s||i?"T"+$e(i,2)+":"+$e(s,2)+"Z":"")}function qe(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 Ge;if(h)return h=!1,We;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(;a{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 ei=0;function ii(t="dataset"){return ei>1e8&&(ei=0),t+"_"+ei++}class si{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:ii("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()}}class ni{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&H(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ii("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&H(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof ni||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ve),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ri{static GenAutoIncrementId(){return ri.auto_increment_id++}}ri.auto_increment_id=0;class ai{constructor(t){this.id=ri.GenAutoIncrementId(),this.registry=t}}const oi="named",li="inject",hi="multi_inject",ci="inversify:tagged",ui="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===oi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var pi=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 u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(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(u(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(!u(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=d(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(!u(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(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(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 gi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};pi.hasOwnMetadata(t,e)&&(r=pi.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,pi.defineMetadata(t,r,e)}(ci,t,i.toString(),s)}function fi(t){return(e,i,s)=>{gi(e,0,s,t)}}function mi(t){return e=>(i,s,n)=>fi(new di(t,e))(i,s,n)}const vi=mi(li),yi=mi(hi);function _i(){return function(t){return pi.defineMetadata(ui,null,t),t}}function bi(t){return fi(new di(oi,t))}const xi="Singleton",Si="Transient",Ai="ConstantValue",wi="DynamicValue",Ti="Factory",ki="Function",Ci="Instance",Mi="Invalid";class Bi{constructor(t,e){this.id=ri.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Mi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Bi(this.serviceIdentifier,this.scope);return t.activated=t.scope===xi&&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:pi.getMetadata(ui,t),userGeneratedMetadata:pi.getMetadata(ci,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ri=(Pi=oi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Pi&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Li=Symbol("ContributionProvider");class Di{constructor(t,e){this.serviceIdentifier=t,this.container=e,ji.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fi(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).inSingletonScope().whenTargetNamed(e)}class ji{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ji.store=new Map;class Ni{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 Ui extends Ni{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const zi=Symbol.for("EnvContribution"),Hi=Symbol.for("VGlobal");const Vi=new class{};let Wi=0;class Gi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Vi.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Wi,t),this.tryRunAnimationFrameNextFrame(),Wi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Yi{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Xi=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ki=function(t,e){return function(i,s){e(i,s,t)}},qi=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 Zi=class extends Yi{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ri.GenAutoIncrementId(),this.hooks={onSetEnv:new Ui(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Gi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return qi(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Ji,Qi;Zi=Xi([_i(),Ki(0,vi(Li)),Ki(0,bi(zi)),$i("design:paramtypes",[Object])],Zi),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Ji||(Ji={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Qi||(Qi={}));const ts=xt-1e-8;class es{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ts)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=xt)<0&&(s+=xt),(n%=xt)<0&&(n+=xt),nn;++o,a-=bt)g(a);else for(a=s-s%bt+bt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ss=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ns={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},rs={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let as,os,ls,hs,cs,us;var ds,ps,gs,fs,ms,vs;function ys(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,u=o*r,d=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,w=S+_*m,T=A-_*f;return[h*b+c*x,u*b+d*x,h*w+c*T,u*w+d*T,h*S+c*A,u*S+d*A]}function _s(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let g=d*d/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=u/i,m=c/i,v=-c/s,y=u/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 w=Math.sqrt(A);r===n&&(w=-w);const T=.5*(_+x)-w*(S-b),k=.5*(b+S)+w*(x-_),C=Math.atan2(b-k,_-T);let M=Math.atan2(S-k,x-T)-C;M<0&&1===r?M+=xt:M>0&&0===r&&(M-=xt);const B=Math.ceil(Math.abs(M/(bt+.001))),E=[];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 xs(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Ms(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Es(t,e){const{p0:i,p1:s}=t,n=Ft.pointAtPP(i,s,e);return[new Rs(i,n),new Rs(n,s)]}class Rs extends Ss{constructor(t,e){super(),this.type=ms.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===fs.ROW?At(this.p0.x-this.p1.x):t===fs.COLUMN?At(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Ps{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Bs(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Rs(new Dt(this._lastX,this._lastY),new Dt(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===fs.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return At(t.p0.y-s.y)}if(t===fs.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return At(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Os extends Ps{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 Is(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ls(t,e,i){const s=null!=e?e:At(i[i.length-1].x-i[0].x)>At(i[i.length-1].y-i[0].y)?fs.ROW:fs.COLUMN;return"monotoneY"===t?new Os(t,s):new Ps(t,s)}class Ds{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 Fs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ls("linear",i,t);return function(t,e){Is(t,e,1)}(new Ds(n,s),t),n}function js(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 Ns{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&&js(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:js(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 Us(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Fs(t,e);const n=Ls("basis",i,t);return function(t,e){Is(t,e,2)}(new Ns(n,s),t),n}function zs(t){return t<0?-1:1}function Hs(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(zs(r)+zs(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Vs(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ws(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 Gs{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:Ws(this,this._t0,Vs(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,Ws(this,Vs(this,e=Hs(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ws(this,this._t0,e=Hs(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 Ys extends Gs{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Xs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Fs(t,e);const n=Ls("monotoneX",i,t);return function(t,e){Is(t,e,2)}(new Gs(n,s),t),n}function $s(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Fs(t,e);const n=Ls("monotoneY",i,t);return function(t,e){Is(t,e,2)}(new Ys(n,s),t),n}let Ks=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class qs extends Ks{lineEnd(){this.context.closePath()}}function Zs(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ps("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?fs.ROW:fs.COLUMN);return Js(new Ks(r,e,n),t),r}function Js(t,e){return Is(t,e,1)}class Qs extends Ds{lineEnd(){this.context.closePath()}}function tn(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ls("linear",i,t);return function(t,e){Is(t,e,1)}(new Qs(n,s),t),n}function en(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>yt){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>yt){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 sn(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Fs(i,n);const o=Ls(t,r,i);return Is(new e(o,s,a),i,2),o}}const nn=sn("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:en(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 rn=sn("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:en(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class an extends Ss{constructor(t,e,i){super(),this.type=ms.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Cs(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,As([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===fs.ROW?At(this.p0.x-this.p2.x):t===fs.COLUMN?At(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Ct(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Cs(i,s,n,e),a=Ft.pointAtPP(i,s,e),o=Ft.pointAtPP(s,n,e);return[new an(i,a,r),new an(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class on{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Rs(new Dt(this._lastX,this._lastY),new Dt(t,e))}quadraticCurveTo(t,e,i,s){const n=new an(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Bs(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function ln(t,e,i){var s,n;switch(e){case"linear":default:return Fs(t,i);case"basis":return Us(t,i);case"monotoneX":return Xs(t,i);case"monotoneY":return $s(t,i);case"step":return Zs(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ps("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?fs.ROW:fs.COLUMN);return Js(new qs(r,e,n),t),r}(t,.5,i);case"stepBefore":return Zs(t,0,i);case"stepAfter":return Zs(t,1,i);case"catmullRom":return nn(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return rn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return tn(t,i)}}class hn extends is{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new es(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([rs.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([rs.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([rs.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([rs.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([rs.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([rs.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([rs.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([rs.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([rs.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new on(this);xs(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[rs.M]=t=>`M${t[1]} ${t[2]}`,t[rs.L]=t=>`L${t[1]} ${t[2]}`,t[rs.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[rs.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[rs.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[rs.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;tus){let t,e=ls;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),xs(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===fs.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.y-e.p1.y)}if(this.direction===fs.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{it.getInstance().warn("空函数")}}),Cn=Object.assign(Object.assign({},_n),{points:[],cornerRadius:0,closePath:!0}),Mn=Object.assign(Object.assign({},_n),{width:100,height:100,spikes:5,thickness:.5}),Bn=Object.assign(Object.assign({},_n),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},_n),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const En=Object.assign(Object.assign({},_n),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Rn=Object.assign(Object.assign(Object.assign({},_n),mn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Pn=Object.assign(Object.assign(Object.assign({},_n),mn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),On=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},_n),{fill:!0,cornerRadius:0,cornerType:"round"}),In=Object.assign(Object.assign({},On),{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}),Ln=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:d(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=u();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=u();return t||i("Missing positioning value"),t}}function u(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function d(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=d(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dn.IsGradientStr(t))try{const e=Ln(t)[0];if(e){if("linear"===e.type)return Dn.ParseLinear(e);if("radial"===e.type)return Dn.ParseRadial(e);if("conic"===e.type)return Dn.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2,n=parseFloat(e.value)/180*_t-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+St,stops:Dn.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Dn.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2;let n="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;n<0;)n+=St;for(;n>=St;)n-=St;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,u;const d=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!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}const Nn={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"}},Un=!0,zn=!1,Hn=/\w|\(|\)|-/,Vn=/[.?!,;:/,。?!、;:]/,Wn=/\S/,Gn=(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})};function Yn(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Vi.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=Xn(t,a)),a}function Xn(t,e,i=!1){let s=e;for(;Hn.test(t[s-1])&&Hn.test(t[s])||Vn.test(t[s]);)if(s--,s<=0)return i?$n(t,e):e;return s}function $n(t,e){let i=e;for(;Hn.test(t[i+1])&&Hn.test(t[i])||Vn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Kn(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Vi.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var qn=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Rn.fontSize}){let i=0,s=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=Xn(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),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,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,a=!1){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=Xn(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=qn([_i()],Zn);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};const Qn=Symbol.for("TextMeasureContribution");let tr=class extends Zn{};tr=Jn([_i()],tr);const er=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Si,this.options=e,this.id=ri.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,oi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Bi(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[li],multiInject:s[hi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ai:case ki:e=t.cache;break;case Ci: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===xi&&(t.cache=e,t.activated=!0)}},ir=Symbol.for("CanvasFactory"),sr=Symbol.for("Context2dFactory");function nr(t){return er.getNamed(ir,Vi.global.env)(t)}const rr=1e-4,ar=Math.sqrt(3),or=1/3;function lr(t){return t>-xr&&txr||t<-xr}const cr=[0,0],ur=[0,0],dr=[0,0];function pr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gr(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function fr(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 mr(t){return(t%=St)<0&&(t+=St),t}function vr(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+u&&c>s+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>n+u&&h>a+u||h=0&&pi||c+hn&&(n+=St);let u=Math.atan2(l,o);return u<0&&(u+=St),u>=s&&u<=n||u+St>=s&&u+St<=n}function br(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(lr(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 Ar=[-1,-1,-1],wr=[-1,-1];function Tr(){const t=wr[0];wr[0]=wr[1],wr[1]=t}function kr(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=u*u-4*c*d;if(lr(t)){const t=u/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*(-u+e),s=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,or):Math.pow(i,or),s=s<0?-Math.pow(-s,or):Math.pow(s,or);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*u)/(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+ar*Math.sin(e)))/(3*a),h=(-o+i*(s-ar*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,Ar);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&Tr(),p=fr(e,s,r,o,wr[0]),d>1&&(g=fr(e,s,r,o,wr[1]))),2===d?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lr(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,Ar);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=gr(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Ar[0]=-l,Ar[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=St-1e-4){s=0,n=St;const e=r?1:-1;return a>=Ar[0]+t&&a<=Ar[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=St,n+=St);let c=0;for(let e=0;e<2;e++){const i=Ar[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=St+t),(t>=s&&t<=n||t+St>=s&&t+St<=n)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function Br(t){return Math.round(t/_t*1e8)/1e8%2*_t}function Er(t,e){let i=Br(t[0]);i<0&&(i+=St);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=St?n=i+St:e&&i-n>=St?n=i-St:!e&&i>n?n=i+(St-Br(i-n)):e&&i1&&(i||(h+=ee(c,u,d,p,s,n))),g&&(c=a[1],u=a[2],d=c,p=u);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;Rr[0]=S,Rr[1]=A,Er(Rr,Boolean(a[6])),S=Rr[0],A=Rr[1];const w=S,T=A-S,k=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case rs.M:d=m,p=v,c=d,u=p;break;case rs.L:if(i){if(br(c,u,m,v,e,s,n))return!0}else h+=ee(c,u,m,v,s,n)||0;c=m,u=v;break;case rs.C:if(i){if(yr(c,u,m,v,y,_,b,x,e,s,n))return!0}else h+=kr(c,u,m,v,y,_,b,x,s,n)||0;c=b,u=x;break;case rs.Q:if(i){if(vr(c,u,m,v,y,_,e,s,n))return!0}else h+=Cr(c,u,m,v,y,_,s,n)||0;c=y,u=_;break;case rs.A:if(o=Math.cos(w)*y+m,l=Math.sin(w)*y+v,g?(d=o,p=l):h+=ee(c,u,o,l,s,n),i){if(_r(m,v,y,w,w+T,k,e,C,n))return!0}else h+=Mr(m,v,y,w,w+T,k,C,n);c=Math.cos(w+T)*y+m,u=Math.sin(w+T)*y+v;break;case rs.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(br(d,p,o,p,e,s,n)||br(o,p,o,l,e,s,n)||br(o,l,d,l,e,s,n)||br(d,l,d,p,e,s,n))return!0}else h+=ee(o,p,o,l,s,n),h+=ee(d,l,d,p,s,n);break;case rs.Z:if(i){if(br(c,u,d,p,e,s,n))return!0}else h+=ee(c,u,d,p,s,n);c=d,u=p}}return i||(g=u,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},Lr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dr=Symbol.for("VWindow"),Fr=Symbol.for("WindowHandlerContribution");let jr=class extends Yi{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(){super(),this.hooks={onChange:new Ui(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(er.getNamed(Fr,t.env).configure(this,t),this.actived=!0)},this._uid=ri.GenAutoIncrementId(),this.global=Vi.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};jr=Ir([_i(),Lr("design:paramtypes",[])],jr);var Nr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ur=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zr=function(t,e){return function(i,s){e(i,s,t)}};let Hr=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=Vi.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=Or.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:mn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ne(Object.assign({defaultFontParams:{fontFamily:mn.fontFamily,fontSize:mn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=er.get(Dr),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 Vr;Hr=Nr([_i(),zr(0,vi(Li)),zr(0,bi(Qn)),Ur("design:paramtypes",[Object])],Hr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Vr||(Vr={}));const Wr=new ue;let Gr=class{constructor(){this.matrix=new ue}init(t){return this.mode=Vr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Vr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wr.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(Wr.a,Wr.b,Wr.c,Wr.d,Wr.e,Wr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wr.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(Wr.a,Wr.b,Wr.c,Wr.d,Wr.e,Wr.f),this}scale(t,e,i){return this.mode===Vr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Vr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wr.a,Wr.b,Wr.c,Wr.d,Wr.e,Wr.f),this}translate(t,e){return this.mode===Vr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Vr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Gr=Nr([_i(),Ur("design:paramtypes",[])],Gr);const Yr={arc:bn,area:xn,circle:Sn,line:Tn,path:kn,symbol:En,text:Rn,rect:Bn,polygon:Cn,star:Mn,richtext:Pn,richtextIcon:In,image:On,group:An,glyph:wn},Xr=Object.keys(Yr);function $r(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kr={arc:Object.assign({},Yr.arc),area:Object.assign({},Yr.area),circle:Object.assign({},Yr.circle),line:Object.assign({},Yr.line),path:Object.assign({},Yr.path),symbol:Object.assign({},Yr.symbol),text:Object.assign({},Yr.text),rect:Object.assign({},Yr.rect),polygon:Object.assign({},Yr.polygon),star:Object.assign({},Yr.star),richtext:Object.assign({},Yr.richtext),richtextIcon:Object.assign({},Yr.richtextIcon),image:Object.assign({},Yr.image),group:Object.assign({},Yr.group),glyph:Object.assign({},Yr.glyph)};class qr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Xr.forEach((t=>{this._defaultTheme[t]=Object.create(Kr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Xr.forEach((s=>{const n=Object.create(Kr[s]);t&&t[s]&&$r(n,t[s]),i[s]&&$r(n,i[s]),e[s]&&$r(n,e[s]),this.combinedTheme[s]=n})),e.common&&Xr.forEach((t=>{$r(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 qr;function Jr(t,e){return t.glyphHost?Jr(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&&Jr(t.attachedThemeGraphic)||Zr.getTheme()}var Qr=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 ta 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=ri.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Qr(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof sa))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(oa(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 sa))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=oa(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 sa))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=oa(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 sa))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=oa(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 sa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=aa.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oa(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(oa(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,oa(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 sa))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"):oa(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 na))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=aa.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 la(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 sa,this.rootWheelEvent=new na,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)&&!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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class da{static GetImage(t,e){var i;const s=da.cache.get(t);s?"fail"===s.loadState?Vi.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):da.loadImage(t,e)}static GetSvg(t,e){var i;let s=da.cache.get(t);s?"fail"===s.loadState?Vi.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"},da.cache.set(t,s),s.dataPromise=Vi.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=da.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},da.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Vi.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Vi.global.loadBlob(t):"json"===e&&(i.dataPromise=Vi.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!da.isLoading&&da.toLoadAueue.length){da.isLoading=!0;const t=da.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(da.cache.set(i,n),n.dataPromise=Vi.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((()=>{da.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),da.loading()})).catch((t=>{console.error(t),da.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),da.loading()}))}}),0)}static loadImage(t,e){const i=pa(t,da.toLoadAueue);if(-1!==i)return da.toLoadAueue[i].marks.push(e),void da.loading();da.toLoadAueue.push({url:t,marks:[e]}),da.loading()}static improveImageLoading(t){const e=pa(t,da.toLoadAueue);if(-1!==e){const t=da.toLoadAueue.splice(e,1);da.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function pa(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ma[0]=t[0],ma[2]=t[0],ma[1]=t[1],ma[3]=t[1],ma):t:t:0,ya=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],_a=[1,2,3,0,1,2,3,0];function ba(t,e,i,s){for(;t>=St;)t-=St;for(;t<0;)t+=St;for(;t>e;)e+=St;ya[0].x=i,ya[1].y=i,ya[2].x=-i,ya[3].y=-i;const n=Math.ceil(t/bt)%4,r=Math.ceil(e/bt)%4;if(s.add(Tt(t)*i,Mt(t)*i),s.add(Tt(e)*i,Mt(e)*i),n!==r||e-t>_t){let t=!1;for(let e=0;e<_a.length;e++)if(t||n!==_a[e]){if(t&&r===_a[e])break;if(t){const t=ya[_a[e]];s.add(t.x,t.y)}}else{t=!0;const e=ya[n];s.add(e.x,e.y)}}}function xa(t,e,i){const{x:s,y:n}=Pt(t.x,t.y,e.x,e.y,i),{x:r,y:a}=Pt(t.x1,t.y1,e.x1,e.y1,i),o=new Dt(s,n,r,a);return o.defined=e.defined,o}function Sa(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let s=[];if(t.length>e.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;n{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)}}wa.TimeOut=1e3/60;const Ta=new wa,ka=(t,e)=>{const i=((t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class Ca{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 Ma(t,e,i,s,n){return n?t.arc(i,s,e,0,xt,!1,n):t.arc(i,s,e,0,xt),!1}var Ba=new class extends Ca{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 Ma(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ma(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 Ea=new class extends Ca{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 Ra(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 Pa=new class extends Ca{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 Ra(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ra(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ra(t,this.parseSize(e)/2+n,i,s,r)}};function Oa(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Ia=new class extends Ca{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Oa(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Oa(t,this.parseSize(e)/2+n,i,s)}};function La(t,e,i,s,n=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 Da extends Ca{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 La(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return La(t,this.parseSize(e)/2,i,s,n)}}var Fa=new Da;var ja=new class extends Da{constructor(){super(...arguments),this.type="triangle"}};const Na=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Ua=Math.sin(xt/10)*Na,za=-Math.cos(xt/10)*Na;function Ha(t,e,i,s){const n=Ua*e,r=za*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=xt*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 Va=new class extends Ca{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 Ha(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ha(t,this.parseSize(e)/2+n,i,s)}};const Wa=Bt(3);function Ga(t,e,i,s){const n=e,r=n/Wa,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 Ya=new class extends Ca{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 Ga(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ga(t,this.parseSize(e)/2+n,i,s)}};function Xa(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 $a=new class extends Ca{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Xa(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xa(t,this.parseSize(e)/2+n,i,s)}};function Ka(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var qa=new class extends Ca{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ka(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ka(t,this.parseSize(e)/2+n,i,s)}};const Za=-.5,Ja=Bt(3)/2,Qa=1/Bt(12);function to(t,e,i,s){const n=e/2,r=e*Qa,a=n,o=e*Qa+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(Za*n-Ja*r+i,Ja*n+Za*r+s),t.lineTo(Za*a-Ja*o+i,Ja*a+Za*o+s),t.lineTo(Za*l-Ja*h+i,Ja*l+Za*h+s),t.lineTo(Za*n+Ja*r+i,Za*r-Ja*n+s),t.lineTo(Za*a+Ja*o+i,Za*o-Ja*a+s),t.lineTo(Za*l+Ja*h+i,Za*h-Ja*l+s),t.closePath(),!1}var eo=new class extends Ca{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 to(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return to(t,this.parseSize(e)/2+n,i,s)}};function io(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 so=new class extends Ca{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 io(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return io(t,this.parseSize(e)/2,i,s,n)}};function no(t,e,i,s,n=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 ro=new class extends Ca{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 no(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return no(t,this.parseSize(e)/2,i,s,n)}};function ao(t,e,i,s,n=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 oo=new class extends Ca{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 ao(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ao(t,this.parseSize(e)/2,i,s,n)}};const lo=Bt(3);function ho(t,e,i,s){const n=e*lo;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var co=new class extends Ca{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return ho(t,this.parseSize(e)/2/lo,i,s)}drawOffset(t,e,i,s,n){return ho(t,this.parseSize(e)/2/lo+n,i,s)}};function uo(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 po=new class extends Ca{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 uo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uo(t,this.parseSize(e)/4+n,i,s)}};function go(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 fo=new class extends Ca{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 go(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return go(t,this.parseSize(e)/4+n,i,s)}};function mo(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 vo=new class extends Ca{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 mo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return mo(t,this.parseSize(e)/4+n,i,s)}};function yo(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 _o=new class extends Ca{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 yo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return yo(t,this.parseSize(e)/4+n,i,s)}};function bo(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var xo=new class extends Ca{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return bo(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return bo(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 So(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Ao=new class extends Ca{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return So(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return So(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 wo(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 To=new class extends Ca{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 wo(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return wo(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 ko(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Co(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Mo=new class extends Ca{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)?Co(t,e,i,s):ko(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Co(t,e+2*n,i,s):ko(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Bo=new he;class Eo{constructor(t,e,i=!1){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(),xs(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(xs(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Bo.x1=i.bounds.x1*t,Bo.y1=i.bounds.y1*t,Bo.x2=i.bounds.x2*t,Bo.y2=i.bounds.y2*t,e.union(Bo)}))}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 Ro={};[Ba,Ea,Pa,Ia,co,ja,Va,Ya,$a,qa,eo,so,ro,Fa,oo,po,fo,vo,_o,Mo,xo,Ao,To].forEach((t=>{Ro[t.type]=t}));const Po={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Oo{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 Io(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Lo(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=Lo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Io(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Lo(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 Oo(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 Oo(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 jo(t,e){return No(t)}function No(t,e){const i={};for(let e=0;e$o.set(t,!0)));const Ko=new Map;function qo(t){if($o.has(t))return!0;if(Ko.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Ko.set(t,!0)));const Zo=Yo(),Jo=Yo(),Qo=Yo(),tl=Yo(),el=Yo(),il=Yo(),sl=Yo(),nl=Yo(),rl=Yo(),al=Yo();Yo();const ol=Yo();Yo();const ll=Yo();Yo();const hl=Yo(),cl=Yo(),ul=Symbol.for("GraphicService"),dl=Symbol.for("GraphicCreator"),pl={"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"},gl=Object.keys(pl),fl={duration:200,easing:"cubicOut"};function ml(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 vl(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,u,d,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],u=e[5],d=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]=u,t[6]=d,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+u*n+f*r+e[13],t[14]=l*s+d*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function yl(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 _l(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],u=e[8],d=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*u+S*f,t[1]=_*n+b*l+x*d+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*u+S*f,t[5]=_*n+b*l+x*d+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*u+S*f,t[9]=_*n+b*l+x*d+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*u+S*f,t[13]=_*n+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function bl(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 xl{constructor(){this.pools=[]}static identity(t){return ml(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 xl.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},Tl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const kl=new ue(1,0,0,1,0,0),Cl={x:0,y:0};let Ml=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new hn,this._clearMatrix=new ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Sl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Sl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Sl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},Cl),function(t,e,i){return Pr(t,0,!1,e,i)}(this.path.commandList,Cl.x,Cl.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Cl);const i=Fn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Pr(t,e,!0,i,s)}(this.path.commandList,i,Cl.x,Cl.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(t=!0,e=this.dpr){this.setTransformFromMatrix(kl,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Sl.free(t))),this.stack.length=0}};Ml=wl([_i(),Tl("design:paramtypes",[Object,Number])],Ml);const Bl={WIDTH:500,HEIGHT:500,DPR:1};class El{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}set nativeCanvas(t){this._nativeCanvas=t}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=Bl.WIDTH,height:n=Bl.HEIGHT,dpr:r=Bl.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Rl;El.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Rl||(Rl={}));class Pl{static Get(t,e=Rl.Color1,i=[0,0,0,1]){if(e===Rl.Color1){const e=Pl.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ae.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Pl.store1[t]=e,Pl.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=Pl.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ae.parseColorString(t);return n&&(Pl.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Pl.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===Rl.Color1){if(Pl.store1[t])return;Pl.store1[t]=i,Pl.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Pl.store255[t])return;Pl.store255[t]=i,Pl.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ol(t,e=!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 Il(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)=>{var a,o;return Ll(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):Ll(t,e,i,s,n)}function Ll(t,e,i,s,n){if(!t||!e)return t&&Ol(t)||e&&Ol(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Pl.Get(t,Rl.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Pl.Get(e,Rl.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:Ol(a)})))});return o?Il(r,l,i,s,n):Il(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:Nl(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:Nl(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:Nl(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),Ol(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)}function Dl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Pl.store255={},Pl.store1={};const Fl=[0,0,0,0],jl=[0,0,0,0];function Nl(t,e,i){return Pl.Get(t,Rl.Color255,Fl),Pl.Get(e,Rl.Color255,jl),`rgba(${Math.round(Fl[0]+(jl[0]-Fl[0])*i)},${Math.round(Fl[1]+(jl[1]-Fl[1])*i)},${Math.round(Fl[2]+(jl[2]-Fl[2])*i)},${Fl[3]+(jl[3]-Fl[3])*i})`}class Ul{static GetCanvas(){try{return Ul.canvas||(Ul.canvas=Vi.global.createCanvas({})),Ul.canvas}catch(t){return null}}static GetCtx(){if(!Ul.ctx){const t=Ul.GetCanvas();Ul.ctx=t.getContext("2d")}return Ul.ctx}}class zl extends de{static getInstance(){return zl._instance||(zl._instance=new zl),zl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Ul.GetCanvas(),s=Ul.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new zl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Hl{static GetSize(t){for(let e=0;e=t)return Hl.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Hl.GenKey(t,e,i,s,n),l=Hl.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=Hl.GenKey(t,e,i,s,n);Hl.cache[l]?Hl.cache[l].push({width:a,height:o,pattern:r}):Hl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Hl.cache={},Hl.ImageSize=[20,40,80,160,320,640,1280,2560];const Vl=new he,Wl=new ue;new he;const Gl=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Yl=["x","y"],Xl=["scaleX","scaleY"],$l=["angle"],Kl=new Dt,ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Zl extends ta{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Ro[t];if(e)return e;if(e=Zl.userSymbolMap[t],e)return e;if(!0===((i=t=Po[t]||t).startsWith("{const e=(new hn).fromString(t.d),i={};gl.forEach((e=>{t[e]&&(i[pl[e]]=t[e])})),n.push({path:e,attribute:i}),Vl.union(e.bounds)}));const r=Vl.width(),a=Vl.height(),o=1/kt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Eo(t,n,!0);return Zl.userSymbolMap[t]=l,l}var i;const s=(new hn).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/kt(n,r);s.transform(0,0,a,a);const o=new Eo(t,s);return Zl.userSymbolMap[t]=o,o}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=va(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 es(t);return xs(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ds.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ds.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ds.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ds.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ds.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&ds.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ds.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===ps.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})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:fl;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:gs.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:gs.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:gs.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=ds.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ds.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ds.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ds.UPDATE_SHAPE_AND_BOUNDS)===ds.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ds.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ds.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ds.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ds.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ds.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ds.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ds.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ds.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=dn.x,y:e=dn.y,scaleX:i=dn.scaleX,scaleY:s=dn.scaleY,angle:n=dn.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Mt(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+u*f,S=c*g-l*f,A=u*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*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,!0),Vi.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(dn);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Wl.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:gs.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Vi.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new hn).fromString(t):this.pathProxy=new hn,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Vi.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new ra(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Vi.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Ml(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Jl;Zl.userSymbolMap={},Zl.mixin(ha),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Jl||(Jl={}));class Ql extends Zl{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=il,this._childUpdateTag=ds.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 qr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qr)}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===ps.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&ds.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=dn.x,y:e=dn.y,dx:i=dn.dx,dy:s=dn.dy,scaleX:n=dn.scaleX,scaleY:r=dn.scaleY,angle:a=dn.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 Jr(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Vi.graphicService.updateTempAABBBounds(i),Vi.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&=ds.CLEAR_BOUNDS,this._childUpdateTag&=ds.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ds.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ds.UPDATE_BOUNDS||(this._childUpdateTag|=ds.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ds.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=Vi.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new Ql(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ql.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function th(t){return new Ql(t)}Ql.NOWORK_ANIMATE_ATTR=ql;class eh extends Ql{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 qr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Vi.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=>{Vi.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 ih=Symbol.for("TransformUtil"),sh=Symbol.for("GraphicUtil"),nh=Symbol.for("LayerService"),rh=Symbol.for("StaticLayerHandlerContribution"),ah=Symbol.for("DynamicLayerHandlerContribution"),oh=Symbol.for("VirtualLayerHandlerContribution");var lh,hh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ch=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let uh=lh=class{static GenerateLayerId(){return`${lh.idprefix}_${lh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Vi.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?er.get(rh):"dynamic"===t?er.get(ah):er.get(oh),e}createLayer(t,e={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 eh(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:lh.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)}};uh.idprefix="visactor_layer",uh.prefix_count=0,uh=lh=hh([_i(),ch("design:paramtypes",[])],uh);var dh=new ai((t=>{t(Hi).to(Zi).inSingletonScope(),t(Dr).to(jr),t(sh).to(Hr).inSingletonScope(),t(ih).to(Gr).inSingletonScope(),t(nh).to(uh).inSingletonScope()}));function ph(t,e){return!(!t&&!e)}function gh(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function fh(t,e,i){return i&&t*e>0}function mh(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function vh(t,e){return t*e>0}function yh(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function _h(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,u=-h*o,d=t+c,p=e+u,g=i+c,f=s+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=n-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let w=(S*_-y*A)/b,T=(-S*y-_*A)/b;const k=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=w-m,B=T-v,E=k-m,R=C-v;return M*M+B*B>E*E+R*R&&(w=k,T=C),{cx:w,cy:T,x01:-c,y01:-u,x11:w*(n/x-1),y11:T*(n/x-1)}}function bh(t,e,i,s,n){const r=At(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,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*Tt(c),w=n*Mt(c),T=s*Tt(d),k=s*Mt(d);let C,M,B,E;if((b>yt||y>yt)&&(C=n*Tt(u),M=n*Mt(u),B=s*Tt(p),E=s*Mt(p),r<_t)){const t=function(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,u=o-r;let d=u*l-c*h;return d*d1?0:R<-1?_t:Math.acos(R))/2),l=Bt(t[0]*t[0]+t[1]*t[1]);S=Ct(b,(s-l)/(o-1)),x=Ct(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:w,xirs:B,yirs:E,xore:C,yore:M,xire:T,yire:k,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function xh(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=At(l-o),c=l>o;let u=!1;if(n=St-yt)e.moveTo(i+n*Tt(o),s+n*Mt(o)),e.arc(i,s,n,o,l,!c),r>yt&&(e.moveTo(i+r*Tt(l),s+r*Mt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:w,outerEndAngle:T,limitedIcr:k,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:R,maxInnerCornerRadius:P}=bh(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,s+p),u=!0;else if(m>yt){const t=Ct(v,m),r=Ct(y,m),o=_h(g,f,d,p,n,t,Number(c)),l=_h(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,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),s+o.cy+m*Mt(wt(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,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,n,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),s+l.cy+r*Mt(wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Mt(T))}else!a||a[0]?(e.moveTo(i+d,s+p),e.arc(i,s,n,w,T,!c)):e.moveTo(i+n*Tt(T),s+n*Mt(T));if(!(r>yt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),u=!0;else if(k>yt){const t=Ct(E,k),n=Ct(R,k),o=_h(S,A,b,x,r,-n,Number(c)),l=_h(d,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),k0&&e.arc(i+o.cx,s+o.cy,n,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),s+l.cy+t*Mt(wt(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,B,c):e.moveTo(i+r*Tt(B),s+r*Mt(B))}return a?a[3]&&e.lineTo(i+n*Tt(o),s+n*Mt(o)):e.closePath(),u}const Sh=Symbol.for("ArcRenderContribution"),Ah=Symbol.for("AreaRenderContribution"),wh=Symbol.for("GroupRenderContribution"),Th=Symbol.for("PathRenderContribution"),kh=Symbol.for("PolygonRenderContribution"),Ch=Symbol.for("RectRenderContribution"),Mh=Symbol.for("SymbolRenderContribution"),Bh=Symbol.for("TextRenderContribution"),Eh=Symbol.for("InteractiveSubRenderContribution");function Rh(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ph(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var Oh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ih=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lh=function(t,e){return function(i,s){e(i,s,t)}};function Dh(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:u=i.scaleY,scaleZ:d=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(ml(t),vl(t,t,[n+o,r+l,a+h]),vl(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],u=e[10],d=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+u*s,t[7]=l*n+d*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=u*n-o*s,t[11]=d*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],u=e[10],d=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-u*s,t[3]=l*n-d*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+u*n,t[11]=l*s+d*n}(t,t,p),vl(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,u,d]),f){const i=Al.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]}vl(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],u=e[6],d=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+u*s,t[3]=l*n+d*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=u*n-o*s,t[7]=d*n-l*s}(i,i,f),vl(i,i,[-s[0],-s[1],0]),_l(t,t,i)}}let Fh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ui(["graphic"]),onSetStage:new Ui(["graphic","stage"]),onRemove:new Ui(["graphic"]),onRelease:new Ui(["graphic"]),onAddIncremental:new Ui(["graphic","group","stage"]),onClearIncremental:new Ui(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ui(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ui(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ui(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new es(t);return xs(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=Ph(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=Rh(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,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){Wo(u,(l+h)/Math.abs(n+r),s,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Wo(u,o/Math.abs(n+r)*2,!1,c+1),u.translate(s,a),e.union(u)}}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||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Fh=Oh([_i(),Lh(0,vi(dl)),Ih("design:paramtypes",[Object])],Fh);const jh=(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 Nh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Ji.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;u.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=cl,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 Jr(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new zh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Zt(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=Vi.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Wo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Vi.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Vi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:u=i.stroke,wrap:d=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:y=i.keepCenterInLine}=s,_=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,_);if("normal"===f||d)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(g/2),this._AABBBounds}const x=Vi.graphicUtil.textMeasure,S=new Nh(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:y}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:u=n.stroke,lineWidth:d=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:y=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),A=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(d/2),this._AABBBounds}const w=Vi.graphicUtil.textMeasure,T={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:A},k=new Nh(r,T,w),C=_(t)?t.map((t=>t.toString())):[t.toString()],M=[],B=[0,0];let E=1/0;if(y>0&&(E=Math.max(Math.floor(y/A),1)),b&&(E=Math.min(E,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=kt(e,r)}));const t=Rh(v,r),e=this.cache.verticalList.length*m,i=Ph(y,e,c);return this._AABBBounds.set(i,t,i+e,t+r),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const _=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},o,i,!1,f);_[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:u,fontFamily:h},o,!1);_[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===Xo.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:u,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=_,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=kt(e,r)}));const b=Rh(v,r),x=this.cache.verticalList.length*m,S=Ph(y,x,c);return this._AABBBounds.set(S,b,S+x,b+r),d&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ka(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Uh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Uh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new zh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return zh.baselineMapAlign}getAlignMapBaseline(){return zh.alignMapBaseline}}function Hh(t){return new zh(t)}zh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ql),zh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},zh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Vh=["symbolType","size",...Gl];let Wh=class t extends Zl{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=hl}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Jr(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}=Vi.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;Wo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Vi.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,Vh)}needUpdateTag(t){return super.needUpdateTag(t,Vh)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new hn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Gh(t){return new Wh(t)}Wh.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ql);const Yh=["segments","points","curveType","curveTension",...Gl];let Xh=class t extends Zl{constructor(t={}){super(t),this.type="line",this.numberType=nl}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=Sa(i,s,e))}getGraphicTheme(){return Jr(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Vi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Vi.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Yh)}needUpdateTag(t){return super.needUpdateTag(t,Yh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new hn;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function $h(t){return new Xh(t)}Xh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const Kh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},qh=["width","x1","y1","height","cornerRadius",...Gl];class Zh extends Zl{constructor(t){super(t),this.type="rect",this.numberType=ol}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jr(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}=Vi.graphicService.updateTempAABBBounds(i);return jh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Vi.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,qh)}needUpdateTag(t){return super.needUpdateTag(t,qh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Kh(e);return t=new hn,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Zh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zh.NOWORK_ANIMATE_ATTR}}function Jh(t){return new Zh(t)}Zh.NOWORK_ANIMATE_ATTR=ql;class Qh{constructor(t,e,i,s,n,r,a,o,l,h,c,u,d,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=Nn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,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}}}function tc(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class ec{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ka(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Kn(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Kn(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yn(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Kn(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=tc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yn(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Kn(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=tc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=tc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=tc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=tc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&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=Yn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kn(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const ic=["width","height","image",...Gl];class sc extends Zl{constructor(t){super(t),this.type="image",this.numberType=sl,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Jr(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Vi.graphicService.updateTempAABBBounds(i);return jh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Vi.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return On[t]}needUpdateTags(t){return super.needUpdateTags(t,ic)}needUpdateTag(t){return super.needUpdateTag(t,ic)}clone(){return new sc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sc.NOWORK_ANIMATE_ATTR}}sc.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},ql);class nc extends sc{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=va(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=va(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=On.width,height:e=On.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 rc{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 nc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Nn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof ec){const e=Wn.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 nc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kn(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof nc)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof nc)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||zn;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,Gn(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Un;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jn(t,s,{AABBBounds:i}):s,Gn(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof nc)break;const{width:n}=Kn(t,s.character,s.ascentDescentMode),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 nc?t.width:t.getWidthWithEllips(this.direction)})),i}}class ac{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=Nn[this.direction]}store(t){if(t instanceof nc){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 rc(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,e=!1){t instanceof nc?"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||this.newLine)&&("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=Yn(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 ec(i,t.newLine,t.character,t.ascentDescentMode),new ec(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let oc=!1;try{oc=Intl&&"function"==typeof Intl.Segmenter}catch(t){oc=!1}const lc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Gl];class hc extends Zl{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ll,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:Pn.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:Pn.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:Pn.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:Pn.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:Pn.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:Pn.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:Pn.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:Pn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jr(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&hc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&hc.splitText(t.text).length>1)))}static splitText(t){if(oc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=hc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Vi.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Vi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Vi.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,lc)}needUpdateTag(t){return super.needUpdateTag(t,lc)}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;e0&&!hc.AllSingleCharacter(y)&&(y=hc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,w="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),T="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),k=new Qh(0,0,(w?n:x?i:0)||0,(T?r:A?s:0)||0,a,o,l,h,c,u||"horizontal",!w&&x,!T&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),C=new ac(k);if(C.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&k.lines[k.lines.length-1].paragraphs.push(s)):C.deal(s,!0),k.lines.length!==t&&(t=k.lines.length,C.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,k.lines[k.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,C.lineWidth=0),C.send()}}else for(let t=0;t<_.length;t++)C.deal(_[t]);if(C.send(),!("horizontal"===k.layoutDirection?w:T)){const t=k.getActualSizeWidthEllipsis();let e="horizontal"===k.layoutDirection?t.width:t.height;("horizontal"===k.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===k.layoutDirection?i:s)),k.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&k.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=k}clone(){return new hc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 hc.NOWORK_ANIMATE_ATTR}}function cc(t){return new hc(t)}hc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ql);const uc=["path","customPath",...Gl];class dc extends Zl{constructor(t){super(t),this.type="path",this.numberType=rl}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 hn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hn?this.cache:t.path)}getGraphicTheme(){return Jr(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Vi.graphicService.updateTempAABBBounds(i);jh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Vi.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 hn).fromString(t.path):t.customPath&&(this.cache=new hn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}toCustomPath(){return(new hn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new dc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ql);const gc=["segments","points","curveType","curveTension",...Gl];class fc extends Zl{constructor(t){super(t),this.type="area",this.numberType=Qo}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 Jr(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Vi.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Vi.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=Sa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new hn;const 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 fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ql);const vc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Gl];class yc extends Zl{constructor(t){super(t),this.type="arc",this.numberType=Zo}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=Nt(e),i=e+r,s&&At(r)yt&&o>yt)return{startAngle:e-n*d*r,endAngle:i+n*d*a,sc:n*d*r,ec:n*d*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=Bt(a*a+o*o)}=this.attribute,h=At(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>yt&&l>yt){const i=e>t?1:-1;let s=Rt(Number(l)/o*Mt(g)),n=Rt(Number(l)/a*Mt(g));return(f-=2*s)>yt?(s*=i,d+=s,p-=s):(f=0,d=p=(t+e)/2),(m-=2*n)>yt?(n*=i,c+=n,u-=n):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Jr(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}=Vi.graphicService.updateTempAABBBounds(i);jh(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Vi.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<=yt?i.set(0,0,0,0):Math.abs(o-l)>St-yt?i.set(-s,-s,s,s):(ba(l,o,s,i),ba(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=At(o-a),u=o>a;if(h=St-yt)n.moveTo(0+h*Tt(a),0+h*Mt(a)),n.arc(0,0,h,a,o,!u),l>yt&&(n.moveTo(0+l*Tt(o),0+l*Mt(o)),n.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Mt(a),i=l*Tt(o),s=l*Mt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!u),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,u),n.closePath()}return n}clone(){return new yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ql);const bc=["points","cornerRadius",...Gl];class xc extends Zl{constructor(t){super(t),this.type="polygon",this.numberType=al}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jr(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Vi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Vi.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=Sa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new hn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=ql;class Ac extends Ql{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function wc(t){return new Ac(t)}const Tc=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 kc,Cc;function Mc(t){return kc||(kc=Tc.CreateGraphic("text",{})),kc.initAttributes(t),kc.AABBBounds}var Bc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Rc=function(t,e){return function(i,s){e(i,s,t)}};class Pc{constructor(){this.time=vs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Jr(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),u=i.height();let d=c,p=u;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,u/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(d=i*(u/s),p=u):"repeat-y"===n&&(p=s*(c/i),d=c);const r=t.dpr,a=Or.allocate({width:d,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,d,p),o.drawImage(e,0,0,d,p),e=a.nativeCanvas),Or.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,u),t.translate(-i.x1,-i.y1)}}}const Oc=new Pc;let Ic=class{constructor(t){this.subRenderContribitions=t,this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,u,d)}))}};Ic=Bc([_i(),Rc(0,vi(Li)),Rc(0,bi(Eh)),Ec("design:paramtypes",[Object])],Ic);const Lc=new class{constructor(){this.time=vs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Dc=new class{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class Fc{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Or.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])),Or.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,St),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,u,d){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){var h;const{textureRatio:c=r.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(o,l,a,i);break;case"diamond":d=this.createDiamondPattern(o,l,a,i);break;case"rect":d=this.createRectPattern(o,l,a,i);break;case"vertical-line":d=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":d=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":d=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":d=this.createGridPattern(o,l,a,i)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=Or.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),y=g.height(),_=l,b=o,x=d.columns?d.columns:Math.ceil(v/b),S=d.rows?d.rows:Math.ceil(y/b),A=d.gutterColumn?d.gutterColumn:2*_,w=d.gutterRow?d.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=Gh({}));const T=d.columns?v/d.columns:b,k=d.rows?y/d.rows:b;this._tempSymbolGraphic.setAttributes({size:[T-A,k-w],symbolType:t});const C=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=T?o:Fn(e,o,e.dpr),c=o/C,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+d*h,innerRadius:k-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),xh(t,e,i,s,C+d*h,k-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:k,startAngle:y,endAngle:_})}},Uc=jc,zc=Oc;const Hc=new class extends Pc{constructor(){super(...arguments),this.time=vs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:y=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:y}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},Vc=_t/2;function Wc(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=At(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=At(t[0]),l=[e,e,e,e];break;case 2:case 3:e=At(t[0]),i=At(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=At(l[0]),l[1]=At(l[1]),l[2]=At(l[2]),l[3]=At(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,u,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Vc,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Vc,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!K(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Vc,_t,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],_t,_t+Vc,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Gc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Yc=class{constructor(){this.time=vs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};Yc=Gc([_i()],Yc);let Xc=class{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x: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 Wc(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{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,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Xc=Gc([_i()],Xc);const $c=new class{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:w,y1:T,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:C,height:M}=t.attribute;C=(null!=C?C:w-i)||0,M=(null!=M?M:T-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=k?h:Fn(e,h,e.dpr),d=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*g,M-o*g)):(e.beginPath(),Wc(e,d,p,C-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}},Kc=jc,qc=Oc;const Zc=new class{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)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,w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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&&w(p,"outerBorder"),m&&w(g,"innerBorder")}},Jc=new class{constructor(){this.time=vs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}},Qc=jc,tu=Oc;const eu={x:0,y:0,z:0,lastModelMatrix:null};class iu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Lc),this.builtinContributions.push(Dc),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===vs.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===vs.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jr(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=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=fh(u,d,h),_=vh(u,g),b=ph(h),x=gh(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return xs(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),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())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}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:u=e.visible}=t.attribute,d=fh(o,l,n),p=vh(o,c),g=ph(n,r),f=gh(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||s||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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,u=i.modelMatrix,d=i.camera;eu.x=n,eu.y=r,eu.z=a,eu.lastModelMatrix=u;const p=d&&(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=Al.allocate(),n=Al.allocate();Dh(n,t,e),_l(s,u||s,n),eu.x=0,eu.y=0,eu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Al.free(n)}if(g&&!u){const s=t.getOffsetXY(e);eu.x+=s.x,eu.y+=s.y,eu.z=a,i.setTransformForCurrent()}else if(p)eu.x=0,eu.y=0,eu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const s=t.getOffsetXY(e);eu.x+=s.x,eu.y+=s.y,this.transformWithoutTranslate(i,eu.x,eu.y,eu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),eu.x=0,eu.y=0,eu.z=0;return eu}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},u={x:n,y:r};s.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==d&&Al.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}var su=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ru=function(t,e){return function(i,s){e(i,s,t)}};let au=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Zo,this.builtinContributions=[Nc,zc,Uc],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(nyt){const t=Ct(b,_),r=Ct(x,_),a=_h(v,y,f,m,n,t,Number(d)),o=_h(A,w,T,k,n,r,Number(d));if(_0&&e.arc(i+o.cx,s+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,s+m);if(!(r>yt)||M<.001)e.lineTo(i+T,s+k),p=!0;else if(C>yt){const t=Ct(E,C),n=Ct(R,C),a=_h(T,k,A,w,r,-n,Number(d)),o=_h(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,s,r,t,o,d)}}else e.lineTo(i+r*Tt(B),s+r*Mt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Jr(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=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:w=l.outerRadius,innerRadius:T=l.innerRadius}=t.attribute;w+=b,T-=x;let k=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();At(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)fa[s]=t,i&&(i=!(null!==(e=fa[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)fa[e]=!!t[e],i&&(i=!!fa[e]);else fa[0]=!1,fa[1]=!1,fa[2]=!1,fa[3]=!1;return{isFullStroke:i,stroke:fa}})(u);if((y||B)&&(e.beginPath(),xh(t,e,i,s,w,T),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,_,B,v,o),this._runFill(t,e,i,s,l,y,m,d,p,a)):(this._runFill(t,e,i,s,l,y,m,d,p,a),this._runStroke(t,e,i,s,l,_,B,v,o))),!B&&_&&(e.beginPath(),xh(t,e,i,s,w,T,E),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(At(h-r)>=St-yt){e.beginPath();const r=Math.abs(w-T)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,s,w,T,u,u+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const d=()=>{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+=St;for(;i>St;)i-=St;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),Il(o.color,l.color,h,!1)}(0,0,h,n);a||fh&&(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()))};d(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=k,h.endAngle+=k)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Jr(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};function ou(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]=Ms(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 lu(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:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+n,o+r,a)}else d&&(h=!s,t.lineTo(d.x+n,d.y+r,a))}return h}function hu(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:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((s,n)=>{s.originP1!==s.originP2?(i=lu(t,s,e,i,r,a,o),e=s):e=s}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),ou(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===s?d=fs.ROW:"y"===s?d=fs.COLUMN:"auto"===s&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.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 uu=class extends iu{constructor(){super(...arguments),this.numberType=nl}draw(t,e,i,s){const n=Jr(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,u,d,p,g){var f;if(!e)return;t.beginPath();hu(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=ln(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){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,u,d,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*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,u,d,n[m],[l,t.attribute],Ct(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,s,t,a,o)}};function du(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),ou(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),ou(t,l,1,s),o=!1):o=!0}t.closePath()}uu=cu([_i()],uu);const pu=new class extends Fc{constructor(){super(...arguments),this.time=vs.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Aa(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Aa(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Aa(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Aa(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},gu=Oc;var fu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vu=function(t,e){return function(i,s){e(i,s,t)}};let yu=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Qo,this.builtinContributions=[pu,gu],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(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,u,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)}}d?d(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,u,d,p;const g=Jr(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,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,w=S.doStroke&&S.sVisible,{clipRange:T=g.clipRange,closePath:k,points:C,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(k&&"linear"===B&&(B="linearClosed"),1===T&&!M&&!C.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,w,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const s=M.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=ln(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[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=M[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(u=s.y1)&&void 0!==u?u:s.y})}i.length>1&&(n=ln(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!C||!C.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(C,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=ln(e,B,{curveTension:b}),n=ln(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===T){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,w,_,r[c],[g,t.attribute],T,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,w,_,r[d],[g,t.attribute],Ct(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,w,_,t.attribute,g,T,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Jr(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,u,d,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=fs.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=At(y.x-b.x),A=At(y.y-b.y);x=null==y.x1?fs.ROW:null==y.y1?fs.COLUMN:Number.isFinite(S+A)?S>A?fs.ROW:fs.COLUMN:fs.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;ou?fs.ROW:fs.COLUMN,Number.isFinite(c)||(o=fs.COLUMN),Number.isFinite(u)||(o=fs.ROW);const d=i*(o===fs.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),hu(t,i[0]?e.top:e.bottom,l,x===fs.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,w-h,T-c,o),t.stroke()}})(),!1}};yu=fu([_i(),vu(0,vi(Li)),vu(0,bi(Ah)),mu("design:paramtypes",[Object])],yu);const _u=jc,bu=Oc;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},Su=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Au=function(t,e){return function(i,s){e(i,s,t)}};let wu=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=rl,this.builtinContributions=[bu,_u],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:Jr(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)xs(t.pathShape.commandList,e,i,s,1,1,f);else{xs((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,_,b,v,y,u,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-s,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-s,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,u,n,a,o)}draw(t,e,i,s){const n=Jr(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};wu=xu([_i(),Au(0,vi(Li)),Au(0,bi(Th)),Su("design:paramtypes",[Object])],wu);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},ku=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cu=function(t,e){return function(i,s){e(i,s,t)}};let Mu=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ol,this.builtinContributions=[$c,qc,Kc],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Jr(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:w=l.fillStrokeOrder,drawStrokeWhenZeroWH:T=l.drawStrokeWhenZeroWH}=t.attribute;let{width:k,height:C}=t.attribute;k=(null!=k?k:b-S)||0,C=(null!=C?C:x-A)||0;const M=mh(g,f,k,C,h),B=yh(g,v,k,C,T),E=ph(h,c),R=gh(u,m);if(!t.valid||!y)return;if(!E&&!R)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,C)):(e.beginPath(),Wc(e,i,s,k,C,d,"bevel"!==p));const P={doFill:E,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,R,M,B,l,n,a,o,P),w?(this._runStroke(t,e,i,s,l,P,B,S,A,o),this._runFill(t,e,i,s,l,P,M,S,A,a)):(this._runFill(t,e,i,s,l,P,M,S,A,a),this._runStroke(t,e,i,s,l,P,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,R,M,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Jr(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Mu=Tu([_i(),Cu(0,vi(Li)),Cu(0,bi(Ch)),ku("design:paramtypes",[Object])],Mu);var Bu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ru=function(t,e){return function(i,s){e(i,s,t)}};let Pu=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hl,this.builtinContributions=[Zc,tu,Qc,Jc],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Jr(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:w=l.keepDirIn3d}=t.attribute,T=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let k=i,C=s,M=T;const B=e.camera;if(w&&B&&e.project){const t=e.project(i,s,T);e.camera=null,_(c)&&(c[0],c[1]),k=t.x,C=t.y,M=void 0}!1===A.draw(e,c,k,C,M,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,u,d,A,a)):(this._runFill(t,e,i,s,l,x,y,u,d,A,a),this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-s)/d,n),e.stroke()))}draw(t,e,i,s){const n=Jr(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Pu=Bu([_i(),Ru(0,vi(Li)),Ru(0,bi(Mh)),Eu("design:paramtypes",[Object])],Pu);const Ou=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,s){if(!this.pools.length)return(new he).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 he(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Iu=new class extends Pc{constructor(){super(...arguments),this.time=vs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:C}=t.attribute;if(!C)return;const M=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let B;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(C)&&C.background,R=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),s=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(m=C.dy)&&void 0!==m?m:0),n=null!==(v=C.width)&&void 0!==v?v:e.width(),r=null!==(y=C.height)&&void 0!==y?y:e.height();if(B=Ou.allocate(i,s,i+n,s+r),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(_=C.x)&&void 0!==_?_:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(S=C.dy)&&void 0!==S?S:0),t,e)}}else B=t.AABBBounds,R||(B=Mc(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(C);if("success"!==n.state||!n.data)return void M();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:A,backgroundFit:w,backgroundKeepAspectRatio:T}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=C,n?(Wc(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Ou.free(B),M()}};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 extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=cl,this.builtinContributions=[Iu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=Jr(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=ka(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:w,doFill:T,doStroke:k}=S,C=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,T,k,A,w,u,n,a,o),C&&this.transformUseContext2d(t,u,M,e);const B=(n,r,l,h)=>{let c=i+r;const d=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Sl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Sl.free(t)}k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),e.strokeText(n,c,d,M))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),e.fillText(n,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,M)})))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,M),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,M,u,e,{width:n.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:s=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===s?d=-a:"middle"===s&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+d,r,n),r+=s}))}))}C&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,s,T,k,A,w,u,n,a,o)}draw(t,e,i,s){const n=Jr(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Rh(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}};function Nu(t,e,i,s){if(e&&e.length){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},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yu=function(t,e){return function(i,s){e(i,s,t)}};let Xu=class extends iu{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=al,this.builtinContributions=[Vu,Hu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jr(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=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))?Nu(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Nu(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],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-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 _=Uu(u,d),b=Uu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=zu(h,y,_,u,d),A=zu(h,y,b,p,g),w=2*h.x-S.x-A.x,T=2*h.y-S.y-A.y,k=Uu(w,T),C=zu(h,Uu(y,v),k,w,T);let M=Math.atan2(S.y-C.y,S.x-C.x);const B=Math.atan2(A.y-C.y,A.x-C.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&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,u-i,d-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-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=Jr(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Xu=Wu([_i(),Yu(0,vi(Li)),Yu(0,bi(kh)),Gu("design:paramtypes",[Object])],Xu);var $u=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)}};let Zu=class{constructor(t){this.groupRenderContribitions=t,this.numberType=il}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hc)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:Jr(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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,cornerType:w=l.cornerType,x:T=l.x,y:k=l.y}=t.attribute,C=mh(p,m,g,f,c),M=yh(p,v,g,f),B=ph(c,d),E=gh(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(C||M||a||o||d))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,g,f)):(e.beginPath(),Wc(e,i,s,g,f,y,"bevel"!==w));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Hc));const R={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===vs.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o,R)})),h&&e.clip();const P=()=>{R.doFill&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,T-i,k-s,l),e.fill()))},O=()=>{R.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,T-i,k-s,l),e.stroke()))};A?(O(),P()):(P(),O()),this._groupRenderContribitions.forEach((r=>{r.time===vs.afterFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Vi.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Jr(t,null==s?void 0:s.theme).group,i=Al.allocate(),n=Al.allocate();Dh(n,t,e),_l(i,p||i,n),a.modelMatrix=i,Al.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Al.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Zu=$u([_i(),qu(0,vi(Li)),qu(0,bi(wh)),Ku("design:paramtypes",[Object])],Zu);const Ju=Symbol.for("IncrementalDrawContribution"),Qu=Symbol.for("ArcRender"),td=Symbol.for("AreaRender"),ed=Symbol.for("CircleRender"),id=Symbol.for("GraphicRender"),sd=Symbol.for("GroupRender"),nd=Symbol.for("LineRender"),rd=Symbol.for("PathRender"),ad=Symbol.for("PolygonRender"),od=Symbol.for("RectRender"),ld=Symbol.for("SymbolRender"),hd=Symbol.for("TextRender"),cd=Symbol.for("RichTextRender"),ud=Symbol.for("GlyphRender"),dd=Symbol.for("DrawContribution"),pd=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Jo,!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+=St;for(;o<0;)o+=St;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 gd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const md=Symbol.for("DrawItemInterceptor"),vd=new he,yd=new he;class _d{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){vd.copy(s.dirtyBounds),yd.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,Sl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(vd),s.backupDirtyBounds.copy(yd)),!0}}class bd{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 xd=class{constructor(){this.order=1,this.interceptors=[new _d,new Ad,new Sd,new bd]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Al.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Td=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kd=function(t,e){return function(i,s){e(i,s,t)}};const Cd=Symbol.for("RenderService");let Md=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Md=wd([_i(),kd(0,vi(dd)),Td("design:paramtypes",[Object])],Md);var Bd=new ai((t=>{t(Cd).to(Md)}));const Ed=Symbol.for("PickerService"),Rd=Symbol.for("GlobalPickerService"),Pd=Symbol.for("PickItemInterceptor"),Od=Symbol.for("PickServiceInterceptor");var Id=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ld=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Ld=Id([_i()],Ld);let Dd=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=Jr(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Sl.allocateByObj(a),d=new Dt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Dd=Id([_i()],Dd);let Fd=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}};Fd=Id([_i()],Fd);let jd=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=pd(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()}};jd=Id([_i()],jd);var Nd=new ai(((t,e,i)=>{i(Ed)||(t(Rd).toSelf(),t(Ed).toService(Rd)),t(jd).toSelf().inSingletonScope(),t(Pd).toService(jd),t(Dd).toSelf().inSingletonScope(),t(Pd).toService(Dd),t(Fd).toSelf().inSingletonScope(),t(Pd).toService(Fd),Fi(t,Pd),t(Ld).toSelf().inSingletonScope(),t(Od).toService(Ld),Fi(t,Od)})),Ud=new ai((t=>{t(ul).to(Fh),t(dl).toConstantValue(Tc)}));const zd=Symbol.for("AutoEnablePlugins"),Hd=Symbol.for("PluginService");var Vd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gd=function(t,e){return function(i,s){e(i,s,t)}};let Yd=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&&er.isBound(zd)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Yd=Vd([_i(),Gd(0,vi(Li)),Gd(0,bi(zd)),Wd("design:paramtypes",[Object])],Yd);var Xd=new ai((t=>{t(Hd).to(Yd),function(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).whenTargetNamed(e)}(t,zd)})),$d=new ai((t=>{Fi(t,zi)})),Kd=new ai((t=>{t(Qn).to(tr).inSingletonScope(),Fi(t,Qn)})),qd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Jd=class{constructor(){this.type="static",this.offscreen=!1,this.global=Vi.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=nr({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()}};Jd=qd([_i(),Zd("design:paramtypes",[])],Jd);var Qd=new ai((t=>{t(Jd).toSelf(),t(rh).toService(Jd)}));var tp=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 ep(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 ip(t,e,i,s=!1,n=!1){let 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}=ep(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;t{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}=ep(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var rp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},op=function(t,e){return function(i,s){e(i,s,t)}};let lp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):ip(e,_n.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new le,this.backupDirtyBounds=new le,this.global=Vi.global,this.layerService=Vi.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.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}=Xt(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)}}(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:_n.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_n.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Sl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=np(e,i,_n.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&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Ou.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Sl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Ou.free(n),Sl.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||er.get(Ju);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 cp=class extends uu{constructor(){super(...arguments),this.numberType=nl}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=Jr(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=fh(d,p,c),y=vh(d,g),_=ph(c),b=gh(u,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())}};cp=hp([_i()],cp);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};let dp=class extends yu{constructor(){super(...arguments),this.numberType=Qo}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=Jr(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=fh(d,u,c),f=ph(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())}};dp=up([_i()],dp);var pp,gp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fp=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)}},vp=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"}(pp||(pp={}));let yp=class extends lp{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=pp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ui([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return vp(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:_n.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_n.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 vp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return vp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>vp(this,void 0,void 0,(function*(){if(2!==t.count)yield sp(t,_n.zIndex,((i,s)=>{if(this.status===pp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return vp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return vp(this,void 0,void 0,(function*(){this.rendering&&(this.status=pp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=pp.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 vp(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:()=>vp(this,void 0,void 0,(function*(){yield sp(t,_n.zIndex,(t=>vp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};yp=gp([_i(),mp(0,yi(id)),mp(1,vi(cp)),mp(2,vi(dp)),mp(3,vi(Li)),mp(3,bi(md)),fp("design:paramtypes",[Array,Object,Object,Object])],yp);var _p=new ai((t=>{t(Pc).toSelf().inSingletonScope(),t(Fc).toSelf().inSingletonScope(),t(dd).to(lp),t(Ju).to(yp),t(sd).to(Zu).inSingletonScope(),t(id).toService(sd),Fi(t,wh),t(Ic).toSelf().inSingletonScope(),Fi(t,Eh),Fi(t,id),t(xd).toSelf().inSingletonScope(),t(md).toService(xd),Fi(t,md)}));function bp(){bp.__loaded||(bp.__loaded=!0,er.load(dh),er.load(Ud),er.load(Bd),er.load(Nd),er.load(Xd),function(t){t.load($d),t.load(Kd),t.load(Qd)}(er),function(t){t.load(_p)}(er))}bp.__loaded=!1,bp();const xp=er.get(Hi);Vi.global=xp;const Sp=er.get(sh);Vi.graphicUtil=Sp;const Ap=er.get(ih);Vi.transformUtil=Ap;const wp=er.get(ul);Vi.graphicService=wp;const Tp=er.get(Cd);Vi.renderService=Tp;const kp=er.get(nh);Vi.layerService=kp;class Cp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ri.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Mp{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ri.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=Vi.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Vi.global.getRequestAnimationFrame();this.rafId=t((()=>{Vi.global.devicePixelRatio!==this.dpr&&(this.dpr=Vi.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Vi.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Bp{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Vi.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 Ep=new he;class Rp{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ri.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()}));const e=this.pluginService.stage;e&&(e.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&&(Ep.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Ep,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Pp;function Op(){!function(){if(null==Pp)try{const t=document.createElement("canvas"),e=t.getContext("2d");Pp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Pp&&(Pp=!!document.createElement)}catch(t){Pp=!1}}();const t=Vi.global&&Vi.global.env;return t?"browser"===t:Pp}let Ip=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Ip._pluginClasses={};const Lp="white";class Dp extends Ql{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:Lp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new qr,this.hooks={beforeRender:new Ui(["stage"]),afterRender:new Ui(["stage"]),afterClearScreen:new Ui(["stage"]),afterClearRect:new Ui(["stage"])},this.global=Vi.global,!this.global.env&&Op()&&this.global.setEnv("browser"),this.window=er.get(Dr),this.renderService=er.get(Cd),this.pluginService=er.get(Hd),this.layerService=er.get(nh),this.graphicService=er.get(ul),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:Lp,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ua(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(t=!1){t&&(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:u,beta:d,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(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const w=Ip.getPlugin("DirectionalLight");w&&(this.light=new w(f,m,v));const T={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=T;else{const t=Ip.getPlugin("OrthoCamera");t&&(this.camera=new t(T))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Ip.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 Cp))}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 Mp))}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 le;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Rp,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=Ip.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=Ip.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=Ip.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=er.get(Dr),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=er.get(Ed)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var Fp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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,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 Np=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new he}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}}loadFont(t,e,i){return jp(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};Np=Fp([_i()],Np);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},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Hp=class{constructor(){this._uid=ri.GenAutoIncrementId(),this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};Hp=Up([_i(),zp("design:paramtypes",[])],Hp);var Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wp=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 Yp=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Vi.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 he).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 ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Dt(e.x,e.y),a=Jr(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=Jr(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,s);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Al.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!d||t.stage.camera||(n.group=t),Sl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function Xp(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,u=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=s}function $p(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=n.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function tg(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),rg=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},ag=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new le;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return rg(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return rg(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ag(n[0],s,i),ag(n[1],e-s,i)}};let og=!1;const lg=new ai((t=>{og||(og=!0,t(au).toSelf().inSingletonScope(),t(Qu).to(au).inSingletonScope(),t(id).toService(Qu),t(Sh).toService(Ic),Fi(t,Sh))}));let hg=!1;const cg=new ai((t=>{hg||(hg=!0,t(Mu).toSelf().inSingletonScope(),t(od).to(Mu).inSingletonScope(),t(id).toService(od),t(Xc).toSelf(),t(Yc).toSelf(),t(Ch).toService(Xc),t(Ch).toService(Yc),t(Ch).toService(Ic),Fi(t,Ch))}));let ug=!1;const dg=new ai((t=>{ug||(ug=!0,t(uu).toSelf().inSingletonScope(),t(cp).toSelf().inSingletonScope(),t(nd).to(uu).inSingletonScope(),t(id).toService(nd))}));let pg=!1;const gg=new ai((t=>{pg||(pg=!0,t(yu).toSelf().inSingletonScope(),t(td).to(yu).inSingletonScope(),t(id).toService(td),t(Ah).toService(Ic),Fi(t,Ah),t(dp).toSelf().inSingletonScope())}));let fg=!1;const mg=new ai((t=>{fg||(fg=!0,t(Pu).toSelf().inSingletonScope(),t(ld).to(Pu).inSingletonScope(),t(id).toService(ld),t(Mh).toService(Ic),Fi(t,Mh))}));let vg=!1;const yg=new ai((t=>{vg||(vg=!0,t(hd).to(ju).inSingletonScope(),t(id).toService(hd),t(Bh).toService(Ic),Fi(t,Bh))}));let _g=!1;const bg=new ai((t=>{_g||(_g=!0,t(wu).toSelf().inSingletonScope(),t(rd).to(wu).inSingletonScope(),t(id).toService(rd),t(Th).toService(Ic),Fi(t,Th))}));let xg=!1;const Sg=new ai((t=>{xg||(xg=!0,t(ad).to(Xu).inSingletonScope(),t(id).toService(ad),t(kh).toService(Ic),Fi(t,kh))}));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},wg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Tg=class extends iu{constructor(){super(),this.numberType=ll,this.builtinContributions=[Iu],this.init()}drawShape(t,e,i,s,n){const r=Jr(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=fh(o,l,!0),u=fh(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,u,c,u,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,u,c,u,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jr(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=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(),Wc(e,i-t,s-n,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,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=Jr(t).richtext;this._draw(t,s,!1,i)}};Tg=Ag([_i(),wg("design:paramtypes",[])],Tg);let kg=!1;const Cg=new ai((t=>{kg||(kg=!0,t(cd).to(Tg).inSingletonScope(),t(id).toService(cd))}));function Mg(t){const e=[];for(let i=0;iit.getInstance().info(`[VChart log]: ${t}`,...e),Eg=(t,e)=>(u(Pg.warnHandler)&&Pg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Rg=(t,e,i)=>{if(!u(Pg.errorHandler))throw new Error(t);Pg.errorHandler.call(null,t,e)},Pg={silent:!1,warnHandler:!1,errorHandler:!1},Og=Op(),Ig=Og&&globalThis?globalThis.document:void 0;function Lg(t){return("desktop-browser"===t||"mobile-browser"===t)&&Og}function Dg(t){return Fg(t)||"mobile-browser"===t}function Fg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let jg=0;function Ng(){return jg>=9999999&&(jg=0),jg++}function Ug(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function zg(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Hg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Vg extends Ql{constructor(t,e){super(t),this._skipRenderAttributes=Hg,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},ff=(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 mf extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=aa.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=aa.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||gf(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,u=ff(l[0],l[1]);s.scale=u/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=aa.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=ff(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=gf(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!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u: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("pointerleave",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("pointerleave",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=aa.now()-i>this.config.press.time&&ff(s[0],t){Vi.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){if(!this.element)return;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},yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _f=[0,0,0];let bf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},pn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},fn),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},mn),{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Sl.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&&(Sl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Sl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=St;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,u=ca);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Hl.Set(e,i,s,r,a,g,d,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&&(bl(_f,[t,e,i],this.modelMatrix),t=_f[0],e=_f[1],i=_f[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&&(bl(_f,[t,e,i],this.modelMatrix),t=_f[0],e=_f[1],i=_f[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(bl(_f,[e,i,s],this.modelMatrix),e=_f[0],i=_f[1],s=_f[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,e=Vi.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Vi.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:mn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:mn.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&&(bl(_f,[e,i,s],this.modelMatrix),e=_f[0],i=_f[1],s=_f[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=jn(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:u=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:Fn(this,a,this.dpr),r.strokeStyle=jn(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(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?this.font=t.font:this.font=se(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Sl.free(t))),this.stack.length=0}};bf.env="browser",bf=vf([_i(),yf("design:paramtypes",[Object,Number])],bf);var xf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Af=class extends El{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Vi.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new bf(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 wf(t,e){return new ai((i=>{i(ir).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sr).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Af.env="browser",Af=xf([_i(),Sf("design:paramtypes",[Object])],Af);const Tf=wf(Af,bf);var 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},Cf=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 Bf=class extends Yp{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=Or.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 Rf=class{constructor(){this.type="group",this.numberType=il}contains(t,e,i){return!1}};Rf=Ef([_i()],Rf);const Pf=new ai(((t,e,i,s)=>{Pf.__vloaded||(Pf.__vloaded=!0,t(df).to(Rf).inSingletonScope(),t(pf).toService(df),Fi(t,pf))}));Pf.__vloaded=!1;var Of=Pf;const If=new ai(((t,e,i,s)=>{i(Bf)||t(Bf).toSelf().inSingletonScope(),i(Ed)?s(Ed).toService(Bf):t(Ed).toService(Bf)}));var Lf,Df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let jf=Lf=class extends Hp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Lf.idprefix}_${Lf.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Vi.global,this.viewBox=new he,this.modelMatrix=new ue(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:Lf.GenerateCanvasId(),canvasControled:!0};this.canvas=new Af(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 Af({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)}};jf.env="browser",jf.idprefix="visactor_window",jf.prefix_count=0,jf=Lf=Df([_i(),Ff("design:paramtypes",[])],jf);const Nf=new ai((t=>{t(jf).toSelf(),t(Fr).toDynamicValue((t=>t.container.get(jf))).whenTargetNamed(jf.env)}));var Uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hf=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 Vf{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 Wf(t,e=!1){const i=document.createElement("img");if(Vi.global.isImageAnonymous&&(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 Gf=class extends Np{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 Vf(t)}return new he}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 Wf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Wf(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:ri.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(...t){}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}}loadFont(t,e,i){return Hf(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Gf=Uf([_i(),zf("design:paramtypes",[])],Gf);const Yf=new ai((t=>{Yf.isBrowserBound||(Yf.isBrowserBound=!0,t(Gf).toSelf().inSingletonScope(),t(zi).toService(Gf))}));function Xf(t,e=!0){Xf.__loaded||(Xf.__loaded=!0,t.load(Yf),t.load(Tf),t.load(Nf),e&&function(t){t.load(Of),t.load(If)}(t))}Yf.isBrowserBound=!1,Xf.__loaded=!1;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)},qf=function(t,e){return function(i,s){e(i,s,t)}};let Zf=class extends Yp{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 Ml(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}};Zf=$f([_i(),qf(0,vi(Li)),qf(0,bi(Wg)),qf(1,vi(Li)),qf(1,bi(Pd)),qf(2,vi(Li)),qf(2,bi(Od)),Kf("design:paramtypes",[Object,Object,Object])],Zf);const Jf=new ai((t=>{Jf.__vloaded||(Jf.__vloaded=!0,Fi(t,Wg))}));Jf.__vloaded=!1;var Qf=Jf;class tm{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:Fn(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}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},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Zo}};nm=em([_i(),sm(0,vi(Qu)),im("design:paramtypes",[Object])],nm);let rm=!1;const am=new ai(((t,e,i,s)=>{rm||(rm=!0,t(Gg).to(nm).inSingletonScope(),t(Wg).toService(Gg))}));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 tm{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Qo}};cm=om([_i(),hm(0,vi(td)),lm("design:paramtypes",[Object])],cm);let um=!1;const dm=new ai(((t,e,i,s)=>{um||(um=!0,t(Yg).to(cm).inSingletonScope(),t(Wg).toService(Yg))}));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},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=tl}};mm=pm([_i(),fm(0,vi(ed)),gm("design:paramtypes",[Object])],mm);let vm=!1;const ym=new ai(((t,e,i,s)=>{vm||(vm=!0,t(Xg).to(mm).inSingletonScope(),t(Wg).toService(Xg))}));class _m{constructor(){this.type="glyph",this.numberType=el}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 bm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sm=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends _m{constructor(t){super(),this.canvasRenderer=t}};Am=bm([_i(),Sm(0,vi(ud)),xm("design:paramtypes",[Object])],Am);let wm=!1;const Tm=new ai(((t,e,i,s)=>{wm||(wm=!0,t(ef).to(Am).inSingletonScope(),t(Am).toService(ef))}));var km=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Cm=class{constructor(){this.type="image",this.numberType=sl}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Cm=km([_i()],Cm);let Mm=!1;const Bm=new ai(((t,e,i,s)=>{Mm||(Mm=!0,t($g).to(Cm).inSingletonScope(),t(Cm).toService($g))}));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},Rm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=nl}};Om=Em([_i(),Pm(0,vi(nd)),Rm("design:paramtypes",[Object])],Om);let Im=!1;const Lm=new ai(((t,e,i,s)=>{Im||(Im=!0,t(Kg).to(Om).inSingletonScope(),t(Wg).toService(Kg))}));var Dm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=al}};Nm=Dm([_i(),jm(0,vi(ad)),Fm("design:paramtypes",[Object])],Nm);let Um=!1;const zm=new ai(((t,e,i,s)=>{Um||(Um=!0,t(tf).to(Nm).inSingletonScope(),t(Wg).toService(tf))}));var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=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 Gm=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=rl}};Gm=Hm([_i(),Wm(0,vi(rd)),Vm("design:paramtypes",[Object])],Gm);let Ym=!1;const Xm=new ai(((t,e,i,s)=>{Ym||(Ym=!0,t(qg).to(Gm).inSingletonScope(),t(Wg).toService(qg))})),$m=new he;class Km{constructor(){this.type="rect",this.numberType=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;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:Fn(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;$m.setValue(i.x1,i.y1,i.x2,i.y2),$m.expand(-r/2),h=!$m.containsPoint(e)}}return s.highPerformanceRestore(),h}}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},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};let Qm=class extends Km{constructor(t){super(),this.canvasRenderer=t}};Qm=qm([_i(),Jm(0,vi(od)),Zm("design:paramtypes",[Object])],Qm);let tv=!1;const ev=new ai(((t,e,i,s)=>{tv||(tv=!0,t(Zg).to(Qm).inSingletonScope(),t(Wg).toService(Zg))}));let iv=!1;const sv=new ai(((t,e,i,s)=>{iv||(iv=!0,t($g).to(Cm).inSingletonScope(),t(Cm).toService($g))}));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},rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},av=function(t,e){return function(i,s){e(i,s,t)}};let ov=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=hl}};ov=nv([_i(),av(0,vi(ld)),rv("design:paramtypes",[Object])],ov);let lv=!1;const hv=new ai(((t,e,i,s)=>{lv||(lv=!0,t(Jg).to(ov).inSingletonScope(),t(Wg).toService(Jg))}));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};let uv=class{constructor(){this.type="text",this.numberType=cl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};uv=cv([_i()],uv);let dv=!1;const pv=new ai(((t,e,i,s)=>{dv||(dv=!0,t(Qg).to(uv).inSingletonScope(),t(Wg).toService(Qg))})),gv=new ai(((t,e,i,s)=>{i(Zf)||t(Zf).toSelf().inSingletonScope(),i(Ed)?s(Ed).toService(Zf):t(Ed).toService(Zf)}));var fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let vv=class extends bf{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};vv.env="node",vv=fv([_i(),mv("design:paramtypes",[Object,Number])],vv);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},_v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let bv=class extends El{constructor(t){super(t)}init(){this._context=new vv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}};bv.env="node",bv=yv([_i(),_v("design:paramtypes",[Object])],bv);const xv=wf(bv,vv);var Sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},wv=function(t,e){return function(i,s){e(i,s,t)}};let Tv=class extends Hp{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:ri.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bv(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new bv({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};Tv.env="node",Tv=Sv([_i(),wv(0,vi(Hi)),Av("design:paramtypes",[Object])],Tv);const kv=new ai((t=>{t(Tv).toSelf(),t(Fr).toDynamicValue((t=>t.container.get(Tv))).whenTargetNamed(Tv.env)}));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};let Mv=class extends Np{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 Ta.call(t)}}getCancelAnimationFrame(){return t=>{Ta.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};Mv=Cv([_i()],Mv);const Bv=new ai((t=>{Bv.isNodeBound||(Bv.isNodeBound=!0,t(Mv).toSelf().inSingletonScope(),t(zi).toService(Mv))}));function Ev(t,e=!0){Ev.__loaded||(Ev.__loaded=!0,t.load(Bv),t.load(xv),t.load(kv))}Bv.isNodeBound=!1,Ev.__loaded=!1;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};let Pv=class extends bf{draw(){}createPattern(t,e){return null}};Pv.env="wx",Pv=Rv([_i()],Pv);var Ov=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lv=class extends El{constructor(t){super(t)}init(){this._context=new Pv(this,this._dpr)}release(...t){}};Lv.env="wx",Lv=Ov([_i(),Iv("design:paramtypes",[Object])],Lv);const Dv=wf(Lv,Pv);var Fv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nv=function(t,e){return function(i,s){e(i,s,t)}};class Uv{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 zv=class extends Hp{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Uv}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:ri.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Lv(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 Lv({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()}};zv.env="wx",zv=Fv([_i(),Nv(0,vi(Hi)),jv("design:paramtypes",[Object])],zv);const Hv=new ai((t=>{t(zv).toSelf(),t(Fr).toDynamicValue((t=>t.container.get(zv))).whenTargetNamed(zv.env)}));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},Wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gv=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 Yv=class extends Np{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,a){return Gv(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 Ta.call(t)}}getCancelAnimationFrame(){return t=>{Ta.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Yv=Vv([_i(),Wv("design:paramtypes",[])],Yv);const Xv=new ai((t=>{Xv._isWxBound||(Xv._isWxBound=!0,t(Yv).toSelf().inSingletonScope(),t(zi).toService(Yv))}));function $v(t,e=!0){$v.__loaded||($v.__loaded=!0,t.load(Xv),t.load(Dv),t.load(Hv),e&&function(t){t.load(Qf),t.load(gv),t.load(am),t.load(dm),t.load(ym),t.load(Tm),t.load(Bm),t.load(Lm),t.load(zm),t.load(Xm),t.load(ev),t.load(sv),t.load(hv),t.load(pv)}(t))}Xv._isWxBound=!1,$v.__loaded=!1;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},qv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zv=function(t,e){return function(i,s){e(i,s,t)}};let Jv=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Zo}};Jv=Kv([_i(),Zv(0,vi(Qu)),qv("design:paramtypes",[Object])],Jv);let Qv=!1;const ty=new ai(((t,e,i,s)=>{Qv||(Qv=!0,t(sf).to(Jv).inSingletonScope(),t(pf).toService(sf))}));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 Km{constructor(t){super(),this.canvasRenderer=t}};ny=ey([_i(),sy(0,vi(od)),iy("design:paramtypes",[Object])],ny);let ry=!1;const ay=new ai(((t,e,i,s)=>{ry||(ry=!0,t(of).to(ny).inSingletonScope(),t(pf).toService(of))}));class oy extends iu{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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.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:Fn(s,n+r,s.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Al.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}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 uy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=nl}};uy=ly([_i(),cy(0,vi(nd)),hy("design:paramtypes",[Object])],uy);let dy=!1;const py=new ai(((t,e,i,s)=>{dy||(dy=!0,t(rf).to(uy).inSingletonScope(),t(pf).toService(rf))}));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 tm{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Qo}};vy=gy([_i(),my(0,vi(td)),fy("design:paramtypes",[Object])],vy);let yy=!1;const _y=new ai(((t,e,i,s)=>{yy||(yy=!0,t(nf).to(vy).inSingletonScope(),t(pf).toService(nf))}));class by extends iu{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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Al.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}var xy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ay=function(t,e){return function(i,s){e(i,s,t)}};let wy=class extends by{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=hl}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 u=e;if(s.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.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:Fn(s,n+r,s.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Al.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),d}};wy=xy([_i(),Ay(0,vi(ld)),Sy("design:paramtypes",[Object])],wy);let Ty=!1;const ky=new ai(((t,e,i,s)=>{Ty||(Ty=!0,t(lf).to(wy).inSingletonScope(),t(pf).toService(lf))}));var Cy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},My=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},By=function(t,e){return function(i,s){e(i,s,t)}};let Ey=class extends by{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=cl}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:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=Ph(a,d,n),v=Rh(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==d&&Al.free(s.modelMatrix),s.modelMatrix=d,s.highPerformanceRestore(),g}};Ey=Cy([_i(),By(0,vi(hd)),My("design:paramtypes",[Object])],Ey);let Ry=!1;const Py=new ai(((t,e,i,s)=>{Ry||(Ry=!0,t(hf).to(Ey).inSingletonScope(),t(pf).toService(hf))}));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)},Ly=function(t,e){return function(i,s){e(i,s,t)}};let Dy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=rl}};Dy=Oy([_i(),Ly(0,vi(rd)),Iy("design:paramtypes",[Object])],Dy);let Fy=!1;const jy=new ai(((t,e,i,s)=>{Fy||(Fy=!0,t(af).to(Dy).inSingletonScope(),t(pf).toService(af))}));var Ny=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zy=function(t,e){return function(i,s){e(i,s,t)}};let Hy=class extends tm{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=al}};Hy=Ny([_i(),zy(0,vi(ad)),Uy("design:paramtypes",[Object])],Hy);let Vy=!1;const Wy=new ai(((t,e,i,s)=>{Vy||(Vy=!0,t(cf).to(Hy).inSingletonScope(),t(pf).toService(cf))}));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},Yy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xy=function(t,e){return function(i,s){e(i,s,t)}};let $y=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ll}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};$y=Gy([_i(),Xy(0,vi(cd)),Yy("design:paramtypes",[Object])],$y);let Ky=!1;const qy=new ai(((t,e,i,s)=>{Ky||(Ky=!0,t(uf).to($y).inSingletonScope(),t(pf).toService(uf))})),Zy=Op();function Jy(){Jy.__loaded||(Jy.__loaded=!0,Tc.RegisterGraphicCreator("arc",_c),er.load(lg),er.load(Zy?ty:am))}Jy.__loaded=!1;const Qy=Jy;function t_(){t_.__loaded||(t_.__loaded=!0,Tc.RegisterGraphicCreator("area",mc),er.load(gg),er.load(Zy?_y:dm))}t_.__loaded=!1;const e_=t_;function i_(){i_.__loaded||(i_.__loaded=!0,Tc.RegisterGraphicCreator("group",th))}i_.__loaded=!1;const s_=i_;function n_(){n_.__loaded||(n_.__loaded=!0,Tc.RegisterGraphicCreator("line",$h),er.load(dg),er.load(Zy?py:Lm))}n_.__loaded=!1;const r_=n_;function a_(){a_.__loaded||(a_.__loaded=!0,Tc.RegisterGraphicCreator("path",pc),er.load(bg),er.load(Zy?jy:Xm))}a_.__loaded=!1;const o_=a_;function l_(){l_.__loaded||(l_.__loaded=!0,Tc.RegisterGraphicCreator("polygon",Sc),er.load(Sg),er.load(Zy?Wy:zm))}l_.__loaded=!1;const h_=l_;function c_(){c_.__loaded||(c_.__loaded=!0,Tc.RegisterGraphicCreator("rect",Jh),er.load(cg),er.load(Zy?ay:ev))}c_.__loaded=!1;const u_=c_;function d_(){d_.__loaded||(d_.__loaded=!0,Tc.RegisterGraphicCreator("richtext",cc),er.load(Cg),er.load(Zy?qy:sv))}d_.__loaded=!1;const p_=d_;function g_(){g_.__loaded||(g_.__loaded=!0,Tc.RegisterGraphicCreator("shadowRoot",wc))}g_.__loaded=!1;const f_=g_;function m_(){m_.__loaded||(m_.__loaded=!0,Tc.RegisterGraphicCreator("symbol",Gh),er.load(mg),er.load(Zy?ky:hv))}m_.__loaded=!1;const v_=m_;function y_(){y_.__loaded||(y_.__loaded=!0,Tc.RegisterGraphicCreator("text",Hh),er.load(yg),er.load(Zy?Py:pv))}y_.__loaded=!1;const __=y_;function b_(){s_(),u_()}const x_=-.5*Math.PI,S_=1.5*Math.PI,A_="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 w_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(w_||(w_={}));const T_={[w_.selectedReverse]:{},[w_.selected]:{},[w_.hover]:{},[w_.hoverReverse]:{}},k_={container:"",width:30,height:30,style:{}};function C_(){return"browser"===xp.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const M_={debounce:gt,throttle:ft};b_();class B_ extends Vg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},B_.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=C_(),a="browser"===xp.env?xp:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:M_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:ut(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=ut(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",M_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===xp.env?xp:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(ut(s,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(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]=Ce(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]=ut(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?ut([a+i*n,a+s*n],a,n-l):ut([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=C_(),e="browser"===xp.env?xp:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===xp.env?xp:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}function E_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&E_(t,e)}))}B_.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 R_=t=>!d(t)&&!1!==t.visible;const P_=["#ffffff","#000000"];function O_(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ae(t).toHex(),o=new Ae(e).toHex();return I_(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(...P_);for(const n of a)if(t!==n&&I_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function I_(t,e,i,s,n){if("lightness"===n){const i=Ae.getColorBrightness(new Ae(e));return Ae.getColorBrightness(new Ae(t))<.5?i>=.5:i<.5}return s?L_(t,e)>s:"largeText"===i?L_(t,e)>3:L_(t,e)>4.5}function L_(t,e){const i=D_(t),s=D_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function D_(t){const e=Te(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 F_(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 j_(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 N_(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=Ot(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const U_=(t,e,i,s)=>new ne(Object.assign({defaultFontParams:Object.assign({fontFamily:A_,fontSize:14},s),getTextBounds:i?void 0:Mc,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function z_(t,e,i={}){if(!t)return{width:0,height:0};const s=Mc({text:t,fontFamily:e.fontFamily||i.fontFamily||A_,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 H_(t,e="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 V_(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 W_(t,e="type"){const i=H_(t,e);return"rich"===i?Tc.richtext(V_(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Tc.text(t))}function G_(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 Y_(){s_(),u_(),v_(),p_(),__()}var X_=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);nh&&(k=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),w=0,T=0;let U=0;"left"===j||"start"===j?U=1:"right"===j||"end"===j?U=-1:"center"===j&&(U=0),U?U<0?(w-=k,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):U>0&&x.setAttribute("x",b[3]):(w-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const z="right"===_||"end"===_,H="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&U){const t=k-b[1]-b[3],e=I+B,i=1===U?(t-e)/2+B+I/2:b[0]+B-(k/2+e/2-B)+I/2;if(V(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(H&&1!==U){const t=k-b[1]-b[3],e=0===U?-t/2+B/2:-k+b[3]+b[1]+B;if(V(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(z&&-1!==U){const t=k-b[1]-b[3],e=0===U?t/2+B/2:t;if(V(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(T-=C/2,A&&A.setAttribute("y",0)):"bottom"===N?(T-=C,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,Y=X_(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:W&&!!s,width:k,height:C,x:w,y:T}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new hn)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},$_.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,u,d,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===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.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))}}$_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const K_={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}},q_={poptip:j({},K_)};class Z_ extends Vg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}s_(),r_();class J_ extends Z_{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]}},s_(),u_();class Q_ extends Z_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Q_.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})}}Q_.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},s_(),r_(),h_(),v_();class tb extends Vg{getStartAngle(){return zt(this._startAngle)}getEndAngle(){return zt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tb.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(q(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=Tc.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),E(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=Tc.line;G(i)[0].cornerRadius&&(t=Tc.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"),E(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:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Tc.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+d:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:q(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}}var eb,ib;tb.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"}(eb||(eb={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(ib||(ib={}));const sb={[ib.selectedReverse]:{},[ib.selected]:{},[ib.hover]:{},[ib.hoverReverse]:{}},nb={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 ab=Math.sin(Math.PI/10);function ob(t,e=ab){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function lb(t,e=ab){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function hb(t){const e={};return E_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function cb(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function ub(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 db(t,e,i){var s;if(lb(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>re(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>re(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ae(n,r)}function pb(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&&!E(s.states)?(s.addState(w_.hover,!0),E_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(w_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(E_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(w_.hoverReverse),t.removeState(w_.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(w_.selected)?(E_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(w_.selectedReverse),t.removeState(w_.selected))})),null):s.name&&!E(s.states)?(s.addState(w_.selected,!0),E_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(w_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=Tc.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._prepare(),this._prevInnerView=this._innerView&&hb(this._innerView),this.removeAllChild(!0),this._innerView=Tc.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(fb)}_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=Tc.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=eb.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=Tc.group({x:0,y:0,pickable:!1});t.name=eb.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 u=r.width(),d=r.height();n&&(u=Math.abs(u*Math.cos(n)),d=Math.abs(d*Math.sin(n))),a=Math.max(a,u),o=Math.max(o,d),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=Tc.group({x:0,y:0,pickable:!1});i.name=eb.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Tc.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=eb.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=T_;else{const t=this.data[s],e=j({},T_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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=Tc.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=eb.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=T_;else{const i=j({},T_,s.state);Object.keys(i).forEach((s=>{u(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&&u(s)&&(e=s(e,i));const n=this._transformItems(e),r=Tc.group({x:0,y:0,pickable:!1});return r.name=`${eb.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=W_(this._getLabelAttribute(t,e,n,i));if(a.name=eb.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=T_;else{const s=j({},T_,this.attribute.label.state);Object.keys(s).forEach((r=>{u(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new $_(Object.assign({},e));i.name=eb.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return cb(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&&u(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;At(s[0])>At(s[1])?o=_t/2*(l.x>e.x?1:-1):h=_t/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]?d+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:d+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=u(y)?j({},nb.label.style,y(t,e,i,s)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),u(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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},E_(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&H(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const vb={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&&db(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yb(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function _b(t,e,i,s,n=!1){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({},Ab(t,e.attribute.angle)),{angle:Sb(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({},wb(t,e.attribute.angle)),{angle:Sb(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=Zt({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 Sb(t=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 Ab(t,e=0){let 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=Sb(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 wb(t,e=0){let 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=Sb(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 Tb(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(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=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=lb(h),m=ob(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/u,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(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);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 kb(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 Cb{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=j_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Mb{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-Mb.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Mb.bounceIn(2*t):.5*Mb.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*St/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/St*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*St/e)*.5+1}}static registerFunc(t,e){Mb[t]=e}}function Bb(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Mb.quadIn=Mb.getPowIn(2),Mb.quadOut=Mb.getPowOut(2),Mb.quadInOut=Mb.getPowInOut(2),Mb.cubicIn=Mb.getPowIn(3),Mb.cubicOut=Mb.getPowOut(3),Mb.cubicInOut=Mb.getPowInOut(3),Mb.quartIn=Mb.getPowIn(4),Mb.quartOut=Mb.getPowOut(4),Mb.quartInOut=Mb.getPowInOut(4),Mb.quintIn=Mb.getPowIn(5),Mb.quintOut=Mb.getPowOut(5),Mb.quintInOut=Mb.getPowInOut(5),Mb.backIn=Mb.getBackIn(1.7),Mb.backOut=Mb.getBackOut(1.7),Mb.backInOut=Mb.getBackInOut(1.7),Mb.elasticIn=Mb.getElasticIn(1,.3),Mb.elasticOut=Mb.getElasticOut(1,.3),Mb.elasticInOut=Mb.getElasticInOut(1,.3*1.5),Mb.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Mb.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Mb.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Mb[`flicker${t}`]=e=>Bb(e,t);for(let t=2;t<10;t++)Mb[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Eb(t,e,i){return t+(e-t)*i}const Rb=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Eb(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Eb(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Eb(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Eb(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Eb(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Eb(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Eb(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Eb(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Eb(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Il(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Dl(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Il(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Dl(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Eb(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Eb(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Eb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Eb(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Eb(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Eb(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Eb(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Eb(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Eb(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Eb(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Sa(e,i,s),r.addUpdateBoundTag()}}};function Pb(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Mb[s])&&void 0!==n?n:Mb.linear:Mb.linear,"wait"===t&&(this.onUpdate=Ob),this.id=ri.GenAutoIncrementId(),this.syncAttributeUpdate=Ob}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Pl.Get(i,Rl.Color255),r=Pl.Get(s,Rl.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Rb["fill"===e?"fillPure":"strokePure"])}else Rb[e]?t.push(Rb[e]):t.push(Pb)}else Rb[e]?t.push(Rb[e]):t.push(Pb)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}const Lb=new Gi;class Db{constructor(){this.released=!1}tick(t,e){Lb.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class Fb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Qi.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Qi.INITIAL,Vi.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),Vi.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Db;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Qi.INITIAL&&(this.status=Qi.PAUSE,!0)}resume(){return this.status!==Qi.INITIAL&&(this.status=Qi.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Qi.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Qi.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Qi.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Qi.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Qi.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Qi.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Nb.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&u(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:Nb.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&u(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+d*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=d*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,d;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:w=0,options:T,custom:k,customType:C,controlOptions:M}=t,B=e.animate();B.priority=w;const E=u(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,R=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],P=null===(l=e.context)||void 0===l?void 0:l.indexKey;R&&P&&(i=null!==(h=R[P])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,k,C,D,L,_,m,f,M,T,p,e);let F=0;x&&(F=x*(s-i-1));const j=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return j>0&&(F+=j),F>0&&B.wait(F),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,d){var p,g,f,m,v,y;if(e&&i){const c=Object.assign({width:(null===(p=d.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=d.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,d)),_=u(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(y=null===(v=d.context)||void 0===v?void 0:v.data)||void 0===y?void 0:y[0],d,c):h;c.options=_,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;d||(u||(u=this.createPropsFromChannel(a,i)),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i)),p=u.from);const g=null!==(n=t.custom)&&void 0!==n?n:Nb.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,d,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}Nb.builtInAnimateMap={};class Ub extends Ib{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class zb extends Ub{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Hb{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Nb(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Vb(t){return new Hb(t)}class Wb extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Gb=1e3,Yb="quadInOut",Xb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],$b=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Il(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Kb=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Qp(t):[],n=Qp(e);i&&s&&(i.fromTransform&&tg(s,i.fromTransform.clone().getInverse()),tg(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Zb=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Jb=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Zb.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Pl.Get(t,Rl.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Qb extends Ub{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Kb(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&$b(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const tx=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=qb(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Jb(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new Qb({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Gb,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Yb);return c.play(u),c};class ex extends Ub{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Kb(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&$b(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const ix=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Xb.includes(t))(i)||(e[i]=t[i])})),e},sx=(t,e,i)=>{const s=ix(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Vi.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},nx=(t,e,i)=>{const s=[],n=i?null:ix(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:ix(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Kh(t.attribute),n=ig(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Vi.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ig(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Vi.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ig(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Vi.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return sg(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return sg(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Vi.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ng(i)}];const s=[];return ag(i,e,s),s})(t,e).forEach((t=>{s.push(Vi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ag(l,e,h),h})(t,e).forEach((t=>{s.push(Vi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Qp(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Vi.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Vi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&sx(t,s,e),s};class ax extends Ub{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let u=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(u=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[u,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}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=xa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ox extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hx extends ox{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class cx extends lx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const ux=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class dx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class px extends dx{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=ux(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class gx extends dx{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class fx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const vx=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class yx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _x extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const bx=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class xx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>xa(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class Sx extends xx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:bx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ax extends xx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:bx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Tx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class kx extends xx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Tx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Cx extends xx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Tx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Mx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class Bx extends xx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Mx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ex extends xx{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Mx(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const Rx=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class Px extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ox extends Px{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Rx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class Ix extends Px{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const Lx=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class Dx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Lx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Fx extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jx extends zb{onBind(){var t;const e=Vb(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class Nx extends zb{onBind(){const t=Vb(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function Ux(){s_(),r_(),p_(),__(),Nb.registerBuiltInAnimate("axisEnter",jx),Nb.registerBuiltInAnimate("axisUpdate",Nx)}var zx=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=Tc.group({zIndex:999});e.name=eb.axisBreak,e.id=this._getNodeId(`${eb.axisBreak}-${i}`),e.data=a;const o=function(t={}){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=Tc.symbol(Object.assign({x:s.x,y:s.y},o));l.name=eb.axisBreakSymbol;const h=Tc.symbol(Object.assign({x:n.x,y:n.y},o));h.name=eb.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=Tc.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=eb.background,n.id=this._getNodeId("background"),n.states=j({},sb,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=zx(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];E(l)||(c.state={line:j({},sb,l),symbol:j({},sb,l)});const u=new tb(c);u.name=eb.line,u.id=this._getNodeId("line"),t.add(u)}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:u}=s,p=zx(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),w=this.getVerticalVector(x,!1,{x:0,y:0});let T,k,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=N_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else T=this.getTextAlign(w),k=this.getTextBaseline(w,!1);let M=u;if(d(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:M,textStyle:Object.assign({textAlign:T,textBaseline:k},a),state:{text:j({},sb,c.text),shape:j({},sb,c.shape),panel:j({},sb,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}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 Ab(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return wb(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),u=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-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=s.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-n}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,s,this);else{if(c)!function(t,e){if(E(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)})),xb(i,t),!bb(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=lb(a),l=ob(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=kb(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=Ct(c,i))}}else{if(l){const i=kb(e.attribute.y,null===(u=t[s+1])||void 0===u?void 0:u.attribute.y,null===(d=t[s-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Ct(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);Tb(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(E(t))return;const i=t.filter(yb);if(E(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=u(n)?n:vb[n]||vb.parity;if(s.length>=3&&pb(s,r)){do{s=a(s,r)}while(s.length>=3&&pb(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);db(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),_b(l,s,n,(t=>db(t,l,r))),_b(h,s,o,(t=>db(t,h,r)||!(!n||t===l)&&db(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=Tc.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=eb.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,u=null!==(i=o.space)&&void 0!==i?i:4;let d=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=z_(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=Ce(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}release(){super.release(),this._breaks=null}}Hx.defaultAttributes=nb,W(Hx,Cb);const Vx=t=>t.map(((t,e)=>({index:e,value:t}))),Wx=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(u+=jt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=U_(a),y=t.range();let _=[];for(let i=0;i{Xx[t]=!0}));const Jx=t=>-Math.log(-t),Qx=t=>-Math.exp(-t),tS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,eS=t=>10===t?tS:t===Math.E?Math.exp:e=>Math.pow(t,e),iS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),sS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),nS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function rS(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 aS(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function oS(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function lS(t,e,i,s){return 1===i&&(i=0),oS(t,i,s)*(e/(1-i))}function hS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function cS(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]{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 dS{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=hS(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 d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 pS=Symbol("implicit");class gS extends dS{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=Yx.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=pS}clone(){const t=(new gS).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!==pS)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 fS(t,e,r,n)}class vS extends gS{constructor(t){super(),this.type=Yx.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=lS(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:mS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return mS(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=dt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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 vS(!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:yS}=ke;function _S(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=Ae.parseColorString(e)){const e=yS(Ae.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof we?yS(t,e):e instanceof Ae?yS(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 bS extends dS{constructor(t=Zx,e=Zx){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Zx,this._piecewise=aS,this._interpolate=_S}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=dt(i[0],i[r-1])),this._piecewise=r>2?cS:aS,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:Zx),this.rescale(i)):this._clamp!==Zx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const xS=Math.sqrt(50),SS=Math.sqrt(10),AS=Math.sqrt(2),wS=[1,2,5,10],TS=(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=BS(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?CS(0,-(e-1)/s,s):CS((e-1)/s,0,s)},kS=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 TS(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return TS(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=CS(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=CS(t,e,l);return n&&r.reverse(),r})),BS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=wS[0];return i>=xS?s=wS[3]:i>=SS?s=wS[2]:i>=AS&&(s=wS[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function ES(t,e,i){const s=(e-t)/Math.max(0,i);return BS(s)}function RS(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;e0;){if(s=ES(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function OS(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 IS=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),LS=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=s-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}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})),DS=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=MS(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?IS(t,e,n):IS(t,e,uS(n)),h=IS(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),FS=ht(((t,e,i,s,n)=>RS(s(t),s(e),i).map((t=>uS(n(t))))));class jS extends bS{constructor(){super(...arguments),this.type=Yx.Linear}clone(){var t;const e=new jS;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return kS(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(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=MS(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(t=10){const e=this.calculateVisibleDomain(this._range);return RS(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 US(t){return e=>-t(-e)}function zS(t=Number.EPSILON){return e=>Math.max(e,t)}class HS extends bS{constructor(){super(iS(10),eS(10)),this.type=Yx.Log,this._limit=zS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new HS).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=iS(this._base),s=eS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=US(i),this._pows=US(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Jx,this.untransformer=Qx):(this._logs=i,this._pows=s,this._limit=zS(),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 Zx}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return LS(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return DS(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return FS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return FS(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(HS,NS);class VS extends jS{constructor(){super(sS(1),nS(1)),this.type=Yx.Symlog,this._const=1}clone(){return(new VS).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=sS(t),this.untransformer=nS(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return LS(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return DS(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return FS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return FS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(VS,NS);class WS{constructor(){this.type=Yx.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!d(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 WS).domain(this._domain).range(this._range).unknown(this._unknown)}}function GS(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 YS(t,e,i,s,n=!1){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,n,r;if(!$x(t.type))return Vx(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return Vx([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=GS(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=GS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(s=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=u(e.tickMode)?e.tickMode:void 0;m=GS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:n}):t.ticks(e,{noDecimals:d,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=Gx(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=Gx(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?$S.greedy:$S.parity;for(;l.length>=3&&pb(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;db(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),YS(t,l,a,(e=>db(e,t,i))),YS(n,l,o,(e=>db(e,n,i)||!(!a||e===t)&&db(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return Vx(m)},$S={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&db(i,t,e)||(i=t,0))))}},KS=(t,e,i,s)=>{const n=Gx(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},qS=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,ZS=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?Vx([s[s.length-1]]):Vx([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=u(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=KS(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=QS(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=KS(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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+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 d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!s){o=d;break}{const s=t.length-1;let n,r=0;n=t.length%d>0?t.length-t.length%d+d:t.length;do{if(n-=d,n!==s&&!qS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?ZS(e[n-d],e[n]):t,u=Math.abs(t-c);if(u~~(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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,u=a;for(;u>=n;--u)if(o=u*t+s,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&tA[31&o]&eA[1+(31&l)])return!0}else{if(i[h]&tA[31&o])return!0;if(i[c]&eA[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,u;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,tA[31&o]&eA[1+(31&l)]);else for(s(h,tA[31&o]),s(c,eA[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,eA[31&a]|tA[1+(31&o)]);else for(n(l,eA[31&a]),n(h,tA[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 sA(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ct(i,-o,t.width+l),u=ct(s,-o,t.width+l),d=ct(n,-a,t.height+h),p=ct(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function nA(t,e,i=!1){return i?sA(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function rA(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=nA(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=sA(t,r)),e.getRange(r)))}function aA(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return aA(t,e,n,o,h,c,l)}return!1}var d;if("moveY"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return aA(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return aA(t,e,n,s,h,c)}return!1}const lA=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],hA=["top","inside-top","inside"];function cA(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=s,d=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const uA={mode:"same-time",duration:300,easing:"linear"};function dA(t){return 3===t||4===t}function pA(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 gA=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 fA(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)}}var mA=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const _A=(t,e)=>Math.ceil(t)>Math.floor(e),bA=([t,e],[i,s])=>s>t&&e>i;function xA(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 SA=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||E(e.states)||(e.addState(w_.hover,!0),E_(this,(t=>{t===e||E(t.states)||t.addState(w_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(E_(this,(t=>{E(t.states)||(t.removeState(w_.hoverReverse),t.removeState(w_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void E_(this,(t=>{E(t.states)||(t.removeState(w_.selectedReverse),t.removeState(w_.selected))}));E(e.states)||(e.addState(w_.selected,!0),E_(this,(t=>{t===e||E(t.states)||t.addState(w_.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)===gs.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===gs.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($t(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,u=s+o,d=n+l,p=r+h,g=d-c,f=p-u;return[fA(g,f,c,u,a,o),fA(-g,-f,d,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Tc.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hn)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(u(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=u(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),u(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return W_(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=u(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=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&&_A(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&_A(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,u(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(xA([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:u=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])&&!bA([d(n),p(n)],[d(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),d=o-(t+s);if(di){const e=t-(a-d),i=l(n)-e;Math.abs(i)<=u&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(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)<=u&&Math.abs(h)<=u&&(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},h),{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(nA(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(nA(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(nA(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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,u=(null==n?void 0:n.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,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{wA[t]=e};var kA=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{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,u=(e.y1+e.y2)/2;let d=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":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(s+g)+Math.sign(d)*(l/2),y:u+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}CA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const MA=()=>{TA("symbol",CA),TA("line-data",CA)};var BA=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{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,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(e,i);let d=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")?d=g?1:-1:i.includes("right")&&(d=g?-1:1),i){case"top-right":case"bottom-right":d=-1;break;case"top-left":case"bottom-left":d=1}return{x:c+d*s+d*l/2,y:u+p*s+p*h/2}}}EA.tag="rect-label",EA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var RA=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};PA.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const OA=()=>{TA("line",PA),TA("area",PA)};var IA=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=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=Ut(c,h.outerRadius,o),f=Ut(c,a+e.line.line1MinLength,o),m=new LA(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=Ut(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):dA(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-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?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=Ut(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=dA(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=dA(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=dA(d)?-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):u.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?d(h)||"auto"===h?"edge"===c?dA(t.quadrant)?"left":"right":dA(t.quadrant)?"right":"left":h:d(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,d)}else if(-1!==u&&-1===d){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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(dA(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,d))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 NA(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Ft.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 UA(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=ub(t,!!n),o=ub(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=NA(e,t,!1,!!n),o=NA(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ub(t,!!n),o=ub(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}jA.defaultAttributes={pickable:!1};class zA extends Vg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&hb(this._innerView),this.removeAllChild(!0),this._innerView=Tc.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 cb(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?`${eb.grid}-sub`:`${eb.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ub(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=NA(t,o,!1,!!a)}const d=Tc.path(Object.assign({path:c,z:l},u(r)?j({},this.skipDefault?null:zA.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${n}`),e.add(d)})),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,d=n[1].y-n[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+d*g});const f=ub(o,!!a),m=At(o[0].x-o[1].x),v=At(o[0].y-o[1].y),y=Tc.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*_t/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?j({},this.skipDefault?null:zA.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),u=!at(a.value,1)&&!at(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.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}}zA.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},s_(),o_();class HA extends zA{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},zA.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=x_,endAngle:r=S_}=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 VA(){s_(),v_(),__()}W(HA,Cb);const WA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};VA();class GA extends Vg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GA.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(ZA.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(ZA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===ZA.focus||"focus"===o){const s=a.hasState(KA.focus);a.toggleState(KA.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[KA.unSelected,KA.unSelectedHover,KA.focus],t),this._setLegendItemState(e,KA.selected,t)})):(this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[KA.selected,KA.selectedHover,KA.focus],t),this._setLegendItemState(e,KA.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(KA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(KA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(qA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[KA.selected,KA.selectedHover],t),this._setLegendItemState(a,KA.unSelected,t)):(this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t))}else this._setLegendItemState(a,KA.selected,t),this._removeLegendItemState(a,[KA.unSelected,KA.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[KA.selected,KA.selectedHover],t),this._setLegendItemState(e,KA.unSelected,t))}))}this._dispatchLegendEvent(qA.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,KA.selected),this._removeLegendItemState(e,[KA.unSelected,KA.unSelectedHover])):(this._removeLegendItemState(e,[KA.selected,KA.selectedHover]),this._setLegendItemState(e,KA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=YA,spaceRow:l=XA,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:w}=this._itemContext,T=0,k=0;const C=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(s)&&(f&&a?(w=Math.ceil((S+g)/s),b=w>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||C.forEach((t=>{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),w+=1,S=0,A+=k+l,k=0,C.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,k=Math.max(k,m),C.push(i)):(p(v)&&(f&&a?(w=Math.ceil((A+m)/v),b=w>1):v<=m?(w+=1,b=!0,A=0,t>0&&(S+=T+o)):v{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=w,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=w),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=Tc.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._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(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:s.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-u)),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:u,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),w=this._handleStyle(b,t,e,i,s),T=this._handleStyle(x,t,e,i,s),k=Ce(c);let C;!1===x.visible?(C=Tc.group({x:0,y:0,cursor:null===(n=T.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,ZA.item,t,C)):(C=Tc.group(Object.assign({x:0,y:0},T.style)),this._appendDataToShape(C,ZA.item,t,C,T.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?KA.selected:KA.unSelected);const M=Tc.group({x:0,y:0,pickable:!1});C.add(M);let B,E=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=Tc.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,ZA.itemShape,t,C,S.state),s.addState(e?KA.selected:KA.unSelected),M.add(s)}let I=0;if(u){const e=R(g,"size",10);B=Tc.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:k},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,ZA.focus,t,C),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=W_(Object.assign(Object.assign({x:P/2+O,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,ZA.itemLabel,t,C,A.state),D.addState(e?KA.selected:KA.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",u?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=W_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,ZA.itemValue,t,C,w.state),r.addState(e?KA.selected:KA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-k[1]-k[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-k[1]-k[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));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-k[1]-k[3]-P-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const j=M.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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 U=j.height(),z=p(this.attribute.item.width)?this.attribute.item.width:N+k[1]+k[3],H=this._itemHeightByUser||U+k[0]+k[2];return C.attribute.width=z,C.attribute.height=H,B&&B.setAttribute("visible",!1),M.translateTo(-j.x1+k[3],-j.y1+k[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 GA(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 GA(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 B_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new B_(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=YA,spaceRow:o=XA}=n,l=this._itemsContainer,{space:h=$A,defaultCurrent:c=1}=r,u=QA(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(u),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(u),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&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Tc.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"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=YA,spaceRow:a=XA}=s,o=this._itemsContainer,{space:l=$A,defaultCurrent:h=1}=n,c=QA(n,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-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(u){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=Tc.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(u?g:f,u?"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=Tc.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(KA.selected)?this._setLegendItemState(t,KA.selectedHover,e):this._setLegendItemState(t,KA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===ZA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(qA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(KA.unSelectedHover)||t.hasState(KA.selectedHover))&&(i=!0),t.removeState(KA.unSelectedHover),t.removeState(KA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(KA.unSelectedHover)&&!t.hasState(KA.selectedHover)||(i=!0),t.removeState(KA.unSelectedHover),t.removeState(KA.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===ZA.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(qA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(qA.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!==ZA.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(qA.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!==ZA.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(qA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(KA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},tw,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(KA.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(u(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]&&(u(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()}};ew.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:YA,spaceRow:XA,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:$A,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const iw=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(d)?void 0:j({},...i),key:s.every(d)?void 0:j({},...s),value:n.every(d)?void 0:j({},...n)})},sw=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}},nw={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:A_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:A_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:A_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new he).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},rw=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];s_(),u_(),v_(),__(),p_();let aw=class t extends Vg{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 u=Ce(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},d.shape,{visible:R_(d)&&R_(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:R_(d)&&R_(d.value)},sw(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:R_(d)&&R_(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:R_(d)&&R_(d.value)},sw(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},k_),d.value),visible:R_(d)&&R_(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=R_(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=n.width-u[3]-u[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",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=R_(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!R_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=n.shape.size+n.shape.spacing;let d="right"===c?(o?u:0)+(R_(n.key)?r+n.key.spacing:0)+(R_(n.value)?a:0):0;this._createShape("right"===c?d-n.shape.size/2:d+n.shape.size/2,n,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(n,h,l);g&&(G_(c,g,n.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+n.key.spacing:d+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:R_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),G_(c,f,t,d,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(R_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ka(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(R_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},sw(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},sw(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},k_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(R_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},sw(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},sw(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=>rw.includes(t)))?(this._mergeAttributes(e,s),d(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,u=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?u-=i+n:"middle"===l?u-=i/2:u+=n,c+e>h.x2&&(c-=e+s),u+i>h.y2&&(u-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&R_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=R_(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=U_(u),y=U_(d);let _=0;if(R_(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(R_(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&Ro[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return iw({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return iw({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function ow(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function lw(t,e){const i=hw(t),s=hw(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 hw(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function cw(t,e,i){let s=!1;if(e&&u(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}aw.defaultAttributes=nw;function uw(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}}function dw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&dw(t[i],e)}}var pw,gw,fw;function mw(t){var e,i;const{type:s}=t;return s===gw.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(pw||(pw={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(gw||(gw={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(fw||(fw={}));const vw={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},yw={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function _w(t,e){var i;if(!t)return[];const s=kw(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?ww(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Aw(i)?xw(t,i,e):i)).filter(p)}))):i.map((i=>Aw(i)?xw(t,i,e):i)).filter(p):[]}return[]}function bw(t,e){var i,s;return ww(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?u(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 xw(t,e,i){var s;const n=kw(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=vw[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=yw[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new Ae(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ge(t,i,s),a=pe(n,r,e.l),l=new Ae(`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 Sw=(t,e)=>{if(e&&Aw(t)){const i=xw(e,t);if(i)return i}return t};function Aw(t){return t&&"palette"===t.type&&!!t.key}function ww(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function Tw(t){return _(t)?{dataScheme:t}:t}function kw(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=mw(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 Cw extends gS{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(!ww(this._range))return void super.range(this._range);const t=bw(this._range,this._domain);super.range(t)}}const Mw={linear:jS,band:vS,point:class extends vS{constructor(t){super(!1),this.type=Yx.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:gS,threshold:WS,colorOrdinal:Cw};function Bw(t){const e=Mw[t];return e?new e:null}function Ew(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 Rw(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Pw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Ow(t){return!!y(t)&&(!!t.endsWith("%")&&Ug(t.substring(0,t.length-1)))}function Iw(t){return!!g(t)&&("percent"in t||"offset"in t)}function Lw(t,e,i,s=0){var n,r;return S(t)?t:Ow(t)?Number(t.substring(0,t.length-1))*e/100:u(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 Dw(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]=Lw(t[s],e.size,i)}))})),o}function Fw(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}}function jw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||Ow(t)||u(t)||Iw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function Nw(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Uw=(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},zw=[{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"]}];function Hw(t,e){return t&&e.key in t?t[e.key]:e.default}function Vw(t){return t&&"token"===t.type&&!!t.key}const Ww={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%"},Gw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:zw,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"}}},token:Ww,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},Yw={name:"dark",colorScheme:{default:{dataScheme:zw,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}}}}}},Xw=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),Xw(t[s],e.slice(1),i))};function $w(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=Tw(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)})}Kw._charts={},Kw._series={},Kw._components={},Kw._graphicComponents={},Kw._marks={},Kw._regions={},Kw._animations={},Kw._implements={},Kw._chartPlugin={},Kw._vChartPlugin={},Kw._componentPlugin={},Kw.transforms={fields:Ve,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}},Kw.dataParser={csv:(t,e={},i)=>(i.type=He.DSV,Ze(t)),dsv:(t,e={},i)=>{i.type=He.DSV;const s=Ne(Qe,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return qe(n).parse(t)},tsv:(t,e={},i)=>(i.type=He.DSV,Je(t))},Kw._layout={},Kw._grammarTransforms={},Kw._stageEventPlugins={},Kw.registerStageEventPlugin=(t,e)=>{Kw._stageEventPlugins[t]=e},Kw.getStageEventPlugin=t=>Kw._stageEventPlugins[t],Kw._interactionTriggers={},Kw.registerInteractionTrigger=(t,e)=>{Kw._interactionTriggers[t]=e},Kw._composedEventMap={},Kw.registerComposedEvent=(t,e)=>{Kw._composedEventMap[t]=e},Kw._tooltipProcessors={},Kw.registerTooltipProcessor=(t,e)=>{Kw._tooltipProcessors[t]=e},Kw.createTooltipProcessor=(t,e)=>{const i=Kw._tooltipProcessors[t];return i?new i(e):null};const Jw=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};Jw();const Qw={[Gw.name]:Gw},tT=Gw.name,eT=new Map(Object.keys(Qw).map((t=>[t,Qw[t]]))),iT=new Map,sT=new Map(Object.keys(Qw).map((t=>[t,t===tT]))),nT=(t,e)=>{if(!t)return;const i=lT(e);eT.set(t,i),sT.set(t,!0)},rT=(t=tT)=>(sT.has(t)&&!sT.get(t)&&nT(t,eT.get(t)),eT.get(t)),aT=t=>eT.delete(t)&&iT.delete(t)&&sT.delete(t),oT=t=>!!y(t)&&eT.has(t),lT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:tT;return qw({},rT(i),t)};class hT{static registerInstance(t){hT.instances.set(t.id,t)}static unregisterInstance(t){hT.instances.delete(t.id)}static getInstance(t){return hT.instances.get(t)}static instanceExist(t){return hT.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return hT.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}hT.instances=new Map;class cT{static registerTheme(t,e){nT(t,e)}static getTheme(t,e=!1){return rT(t)}static removeTheme(t){return aT(t)}static themeExist(t){return oT(t)}static getDefaultTheme(){return cT.themes.get(tT)}static setCurrentTheme(t){cT.themeExist(t)&&(cT._currentThemeName=t,hT.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return cT.getTheme(cT._currentThemeName,t)}static getCurrentThemeName(){return cT._currentThemeName}}function uT(t){return y(t)?cT.themeExist(t)?cT.getTheme(t):{}:g(t)?t:{}}cT.themes=eT,cT._currentThemeName=tT;const dT=["animationThreshold","colorScheme","name","padding"];function pT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];dT.includes(n)?s[n]=r:m(r)?Aw(r)?s[n]=Sw(r,e):Vw(r)?s[n]=Hw(i,r):s[n]=pT(r,e,i):s[n]=r})),s}function gT(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]=gT(t[s],e)}return i}return _(t)?t.map((t=>gT(t,e))):t}function fT(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]=fT(t[s],e)}return i}return _(t)?t.map((t=>fT(t,e))):t}const mT=(t,e,i,s)=>((t,e,i)=>U_(t,e,i,{fontFamily:Ww.fontFamily,fontSize:Ww.fontSize}))(e,i,s).measure(t),vT="__VCHART",yT=500,_T=500,bT=`${vT}_MEASURE_CANVAS_ID`,xT=`${vT}_DEFAULT_DATA_INDEX`,ST=`${vT}_DEFAULT_DATA_KEY`,AT=`${vT}_DEFAULT_DATA_SERIES_FIELD`,wT=`${vT}_DEFAULT_SERIES_STYLE_NAME`,TT=`${vT}_STACK_KEY`,kT=`${vT}_STACK_START`,CT=`${vT}_STACK_END`,MT=`${vT}_STACK_START_PERCENT`,BT=`${vT}_STACK_END_PERCENT`,ET=`${vT}_STACK_START_OffsetSilhouette`,RT=`${vT}_STACK_END_OffsetSilhouette`,PT=`${vT}_STACK_TOTAL`,OT=`${vT}_STACK_TOTAL_PERCENT`,IT=`${vT}_STACK_TOTAL_TOP`,LT=`${vT}_STACK_TOTAL_BOTTOM`,DT=`${vT}_MOSAIC_VALUE_START_PERCENT`,FT=`${vT}_MOSAIC_VALUE_END_PERCENT`,jT=`${vT}_MOSAIC_CAT_START_PERCENT`,NT=`${vT}_MOSAIC_CAT_END_PERCENT`,UT=`${vT}_SEGMENT_START`,zT=`${vT}_SEGMENT_END`,HT=`${vT}_KEY`;function VT(t,e){for(let i=0;it.key===e))}function GT(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 YT(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:{}},ZT(t,a,n[o],l,e,r))})),s?XT(n):n}function XT(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))):XT(t[e].nodes);return t}function $T(t,e){if("values"in t&&t.values.length){const i=ow(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,BT);t.values.forEach((t=>{t[PT]=i,t[OT]=s}))}else for(const i in t.nodes)$T(t.nodes[i],e)}function KT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][CT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,u=null;const d=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],(!u||l[n.end]>u[n.end])&&(u=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)qT(t.nodes[r],e,i,s,n)}function ZT(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[CT]=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)),ZT(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function JT(t={}){const e=Object.assign({},t);if(u(t.style)?e.style=(e,i,s,n)=>tk(t.style(e,i,s,n)):E(t.style)||(e.style=tk(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])?i[e]=(i,s,n,r)=>tk(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=tk(t.state[e]))})),e.state=i}return e}function QT(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>tk(t[i](e,s,n,r)):E(t[i])||(e[i]=tk(t[i]))})),e}function tk(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:jt(t.angle)}):t}const ek=t=>"line"===t||"area"===t,ik=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ek(i)?e:null==e?void 0:e[0]},sk=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let nk=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},n=Kw.getComposedEvent(t);if(n){const e=new n(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(Kw.getComposedEvent(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()}};var rk;!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"}(rk||(rk={}));const ak=["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 ok,lk,hk;t.ChartEvent=void 0,(ok=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",ok.rendered="rendered",ok.renderFinished="renderFinished",ok.animationFinished="animationFinished",ok.regionSeriesDataFilterOver="regionSeriesDataFilterOver",ok.afterInitData="afterInitData",ok.afterInitEvent="afterInitEvent",ok.afterInitMark="afterInitMark",ok.rawDataUpdate="rawDataUpdate",ok.viewDataFilterOver="viewDataFilterOver",ok.viewDataUpdate="viewDataUpdate",ok.viewDataStatisticsUpdate="viewDataStatisticsUpdate",ok.markDeltaYUpdate="markDeltaYUpdate",ok.viewDataLabelUpdate="viewDataLabelUpdate",ok.scaleDomainUpdate="scaleDomainUpdate",ok.scaleUpdate="scaleUpdate",ok.dataZoomChange="dataZoomChange",ok.drill="drill",ok.layoutStart="layoutStart",ok.layoutEnd="layoutEnd",ok.layoutRectUpdate="layoutRectUpdate",ok.playerPlay="playerPlay",ok.playerPause="playerPause",ok.playerEnd="playerEnd",ok.playerChange="playerChange",ok.playerForward="playerForward",ok.playerBackward="playerBackward",ok.scrollBarChange="scrollBarChange",ok.brushStart="brushStart",ok.brushChange="brushChange",ok.brushEnd="brushEnd",ok.brushClear="brushClear",ok.brushActive="brushActive",ok.legendSelectedDataChange="legendSelectedDataChange",ok.legendFilter="legendFilter",ok.legendItemClick="legendItemClick",ok.legendItemHover="legendItemHover",ok.legendItemUnHover="legendItemUnHover",ok.tooltipShow="tooltipShow",ok.tooltipHide="tooltipHide",ok.tooltipRelease="tooltipRelease",ok.afterResize="afterResize",ok.afterRender="afterRender",ok.afterLayout="afterLayout",ok.afterMarkLayoutEnd="afterMarkLayoutEnd",ok.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(lk||(lk={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(hk||(hk={}));const ck=[hk.mark,hk.model,hk.chart,hk.vchart];class uk{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(hk.vchart,[]),this._levelNodes.set(hk.chart,[]),this._levelNodes.set(hk.model,[]),this._levelNodes.set(hk.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 dk={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 pk{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=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>ik(t)))};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)||lk.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||lk.chart);o.get(t)||o.set(t,new uk);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)||lk.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||lk.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)||lk.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||lk.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?ck.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[lk.chart,lk.window,lk.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(u(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 dk[a]&&(a=dk[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?hk.model:hk.vchart:hk.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=lk.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!==hk.model&&s!==hk.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=hk.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 lk.chart:return this._viewBubbles;case lk.window:return this._windowBubbles;case lk.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case lk.chart:return this._viewListeners;case lk.window:return this._windowListeners;case lk.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return ak.includes(t)||Object.values(rk).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Kw.hasInteractionTrigger(e)}}function gk(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function fk(t,e,i){t.getParser(e)||t.registerParser(e,i)}const mk=new Map;function vk(t,e=!1){let i=e;return t.latestData instanceof ni&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const yk=(t,e)=>0===t.length?[]:1===t.length?vk(t[0],null==e?void 0:e.deep):t.map((t=>vk(t,null==e?void 0:e.deep)));function _k(e,i,s){gk(i=i instanceof si?i:e.dataSet,"copyDataView",yk);const n=new ni(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function bk(t,e,i=[]){var s;if(t instanceof ni)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===n));if(d)u=d;else{const t={name:n};if(c&&(t.fields=c),u=new ni(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Eg(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Eg(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Eg("values should be array")):u.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function xk(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Sk,Ak,wk,Tk;t.TransformLevel=void 0,(Sk=t.TransformLevel||(t.TransformLevel={}))[Sk.copyDataView=-10]="copyDataView",Sk[Sk.treemapFilter=-8]="treemapFilter",Sk[Sk.treemapFlatten=-7]="treemapFlatten",Sk[Sk.dotObjFlat=-7]="dotObjFlat",Sk[Sk.linkDotInfo=-7]="linkDotInfo",Sk[Sk.sankeyLayout=-7]="sankeyLayout",Sk[Sk.dataZoomFilter=-6]="dataZoomFilter",Sk[Sk.legendFilter=-5]="legendFilter",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"}(Ak||(Ak={})),function(t){t.data="data",t.mark="mark"}(wk||(wk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(Tk||(Tk={}));const kk=["line","area","trail"];function Ck(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(HT,i?t.slice().sort(i):t.slice()),{keys:[HT],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const Mk=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function Bk(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{Bk(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function Rk(t,e,i,s){const n=Ck(t,(t=>i(t))),r=Ck(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 Pk{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option;xp.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new Dp(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=th({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Dg(o))&&!1!==c&&Kw.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=Tk.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(xp.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=xp.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>Bk(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>Bk(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{Bk(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Bg(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===Tk.before&&(this._layoutState=Tk.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=Tk.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Bg(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=Ek(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=Rk(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=Rk(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=Ck(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=Ck(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===lk.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:ik(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===lk.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===lk.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===lk.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===lk.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===lk.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{Bk(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=Ek(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Lg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Vo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Vi.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{Bk(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=xp.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){xp.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function Ok(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:Rg)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function Ik(t){t.crosshair=G(t.crosshair||{}).map((e=>$w({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function Lk(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}=Me(l,i.width,i.height);a=t,o=e}else if(h&&Lg(e.mode)){let t;t=y(h)?xp.getElementById(h):h;const{width:e,height:s}=Me(t,i.width,i.height);a=e,o=s}else if(Fg(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 Dk(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 Fk(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}}var jk,Nk,Uk,zk,Hk,Vk;t.LayoutZIndex=void 0,(jk=t.LayoutZIndex||(t.LayoutZIndex={}))[jk.SeriesGroup=0]="SeriesGroup",jk[jk.Axis_Grid=50]="Axis_Grid",jk[jk.CrossHair_Grid=100]="CrossHair_Grid",jk[jk.Region=450]="Region",jk[jk.Mark=300]="Mark",jk[jk.Node=400]="Node",jk[jk.Axis=100]="Axis",jk[jk.MarkLine=500]="MarkLine",jk[jk.MarkArea=100]="MarkArea",jk[jk.MarkPoint=500]="MarkPoint",jk[jk.DataZoom=500]="DataZoom",jk[jk.ScrollBar=500]="ScrollBar",jk[jk.Player=500]="Player",jk[jk.Legend=500]="Legend",jk[jk.CrossHair=500]="CrossHair",jk[jk.Indicator=500]="Indicator",jk[jk.Title=500]="Title",jk[jk.Label=500]="Label",jk[jk.Brush=500]="Brush",jk[jk.CustomMark=500]="CustomMark",jk[jk.Interaction=700]="Interaction",t.LayoutLevel=void 0,(Nk=t.LayoutLevel||(t.LayoutLevel={}))[Nk.Indicator=10]="Indicator",Nk[Nk.Region=20]="Region",Nk[Nk.Axis=30]="Axis",Nk[Nk.DataZoom=40]="DataZoom",Nk[Nk.Player=40]="Player",Nk[Nk.ScrollBar=40]="ScrollBar",Nk[Nk.Legend=50]="Legend",Nk[Nk.Title=70]="Title",Nk[Nk.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(Uk=t.AttributeLevel||(t.AttributeLevel={}))[Uk.Default=0]="Default",Uk[Uk.Theme=1]="Theme",Uk[Uk.Chart=2]="Chart",Uk[Uk.Base_Series=3]="Base_Series",Uk[Uk.Series=4]="Series",Uk[Uk.Mark=5]="Mark",Uk[Uk.User_Chart=6]="User_Chart",Uk[Uk.User_Series=7]="User_Series",Uk[Uk.User_Mark=8]="User_Mark",Uk[Uk.User_SeriesStyle=9]="User_SeriesStyle",Uk[Uk.Built_In=99]="Built_In";class Wk{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},Wk.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]))))}}Wk.defaultMarkInfo={};class Gk{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class Yk{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=>$w({},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 Xk extends Gk{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=Yk,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new Wk,this._lastLayoutRect=null,this.id=Ng(),this.userId=t.id,this._spec=t,this.effect={},this.event=new nk(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${vT}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=Kw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class $k{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=Dw(jw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:Lw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:Lw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:Lw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:Lw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Lw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Lw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=Lw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=Lw(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=Lw(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(Fw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class Kk extends Xk{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,this._transformLayoutPadding=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 $k(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&H(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 qk extends Yk{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Zk extends Kk{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(e,i){var s;super(e,i),this.transformerConstructor=qk,this.modelType="region",this.specKey="region",this.type=Zk.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return H(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function Jk(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 Qk(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 tC(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 eC(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:s}=rC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),tC(u,!0,p,l),s&&Qk(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function iC(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:s}=rC(t,e,n),d=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=rC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,n),d.push(t))})),p.push(l),u.push(d),tC(u,!1,p,o),s&&Qk(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function nC(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:s,layoutRect:u,rect:d}=rC(t,e,n),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=rC(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Jk(t);n.length&&eC(n,e,i,!1,"left",s),r.length&&eC(r,e,i,!0,"left",s),a.length&&iC(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Jk(t);n.length&&sC(n,e,i,!1,"top",s),r.length&&sC(r,e,i,!0,"top",s),a.length&&nC(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Jk(t);n.length&&eC(n,e,i,!1,"right",s),r.length&&eC(r,e,i,!0,"right",s),a.length&&iC(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Jk(t);n.length&&sC(n,e,i,!1,"bottom",s),r.length&&sC(r,e,i,!0,"bottom",s),a.length&&nC(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=rC(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{H(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=rC(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Rg)("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}}}aC.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(zk||(zk={})),t.STATE_VALUE_ENUM=void 0,(Hk=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",Hk.STATE_HOVER="hover",Hk.STATE_HOVER_REVERSE="hover_reverse",Hk.STATE_DIMENSION_HOVER="dimension_hover",Hk.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",Hk.STATE_SELECTED="selected",Hk.STATE_SELECTED_REVERSE="selected_reverse",Hk.STATE_SANKEY_EMPHASIS="selected",Hk.STATE_SANKEY_EMPHASIS_REVERSE="blur",Hk.STATE_HIGHLIGHT="highlight",Hk.STATE_BLUR="blur",Hk.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Vk||(Vk={}));const oC=["linear","radial","conical"],lC={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const hC={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{hC[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class cC extends Gk{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class uC extends cC{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,kk.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!hC[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(vT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(vT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if($x(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class dC extends Gk{constructor(){super(...arguments),this.id=Ng(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=Kw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class pC extends dC{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const gC=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,fC=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=gC(l.delay,n,a,o),u=gC(l.duration,n,a,o),d=gC(l.oneByOne,n,a,o),p=gC(l.splitPath,n,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?nx:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:rx)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);tx(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?nx:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:rx)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>qb(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Jb(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:gs.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new Qb({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Gb,null!==(l=i.easing)&&void 0!==l?l:Yb))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:gs.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new ex({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Gb,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Yb))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):tx(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:s})},mC=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},vC=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class yC extends dC{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new pC(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=th("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new hn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==zk.enter&&t.context.diffState!==zk.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new uC(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,jt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&$w(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Kx(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=Bw(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=u(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):oC.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Kx(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=u(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=bw(_w(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()),d=Object.assign(Object.assign({},lC[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(d).forEach((s=>{const n=d[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return u(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=Ae.SetOpacity(a,s)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):u(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)oC.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=bw(_w(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return Ck(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return Kw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[ST],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=Ck(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{vC(t),s.push(...t.getGraphics())})),e.forEach((t=>{vC(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);fC([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=mC(e,n),r=mC(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===Ak.exit?Ak.exit:i===Ak.update?Ak.update:Ak.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===zk.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===zk.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=zk.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=zk.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=zk.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=Ak.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=Ak.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return Mk(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=Mk(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!u(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=sk(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=Kw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=Kw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===Tk.before||(Bg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===zk.exit&&!e.isExiting)if(e.context.animationState===zk.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:zk.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=th({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var _C;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(_C||(_C={}));class bC extends yC{constructor(){super(...arguments),this.type=bC.type,this._marks=[],this._diffState=zk.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Eg("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?(Eg("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))}getMarkInUserId(t){let e;return Bk(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===zk.update){const t=this.hasAnimation(),e=sk(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=zk.update}render(){this._isCommited&&(Bg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}bC.type="group";const xC={measureText:mT};class SC{static instance(){return SC.instance_||(SC.instance_=new SC),SC.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 AC{constructor(){this.id=Ng(),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))?Eg("不要重复添加相同的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 wC extends AC{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}}const TC={type:"fadeIn"};function kC(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 TC;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const CC={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"}},MC={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},BC=()=>{Kw.registerAnimation("scaleInOut",(()=>MC))},EC=(t,e)=>({appear:kC(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:ax,duration:CC.update.duration,easing:CC.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),RC=()=>{Kw.registerAnimation("line",EC)},PC=()=>{Nb.registerBuiltInAnimate("growPointsIn",Sx),Nb.registerBuiltInAnimate("growPointsOut",Ax),Nb.registerBuiltInAnimate("growPointsXIn",kx),Nb.registerBuiltInAnimate("growPointsXOut",Cx),Nb.registerBuiltInAnimate("growPointsYIn",Bx),Nb.registerBuiltInAnimate("growPointsYOut",Ex),Nb.registerBuiltInAnimate("clipIn",hx),Nb.registerBuiltInAnimate("clipOut",cx)},OC=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class IC{constructor(t){this._markSet=new Wk,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 LC={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class DC extends IC{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},LC,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}DC.type="element-highlight",DC.defaultOptions=LC;const FC=()=>{Kw.registerInteractionTrigger(DC.type,DC)},jC={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class NC extends IC{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},jC,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}NC.type="element-select",NC.defaultOptions=jC;const UC=()=>{Kw.registerInteractionTrigger(NC.type,NC)};class zC extends AC{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class HC{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>Kw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>Kw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>Kw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return Kw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>Kw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){Kw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&SC.instance().registerFunction(t,e)}static unregisterFunction(t){t&&SC.instance().unregisterFunction(t)}static getFunction(t){return t?SC.instance().getFunction(t):null}static getFunctionList(){return SC.instance().getFunctionNameList()}static registerMap(t,e,i){const s=Kw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=Kw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,mk.get(e);var e}static registerSVG(t,e,i){const s=Kw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=Kw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){hT.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,u,d;this.id=Ng(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;H(n.theme,this._spec.theme)?H(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=Dk(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?Kw.getSeriesBuiltInTheme(e):Kw.getComponentBuiltInTheme(e);i=i?$w({},s,i[e]):s}s===t.length-1&&p(i)&&(i=pT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},dw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Lg(v);if(S?Xf(er):"node"===v&&Ev(er),S&&f&&(this._container=y(f)?xp.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=cT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const w=new it(null!==(a=this._option.logLevel)&&void 0!==a?a:et.Error);it.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.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._compiler=new Pk({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new pk(this,this._compiler),this._event=new nk(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),hT.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=$w({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=gT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;HC.getFunctionList()&&HC.getFunctionList().length&&(t=fT(t,HC)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=Kw.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=Kw.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=Kw.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 Lk(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:yT,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:_T})}_initDataSet(t){this._dataSet=t instanceof si?t:new si,fk(this._dataSet,"dataview",ti),fk(this._dataSet,"array",s),gk(this._dataSet,"copyDataView",yk);for(const t in Kw.transforms)gk(this._dataSet,t,Kw.transforms[t]);for(const t in Kw.dataParser)fk(this._dataSet,t,Kw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?Ak.none:Ak.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,hT.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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 ni?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=bk(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?$w({},t[n][e.index],i):i):t[n]=s?$w({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?$w({},t[n][r],i):i)}else t.id===e&&(t[n]=s?$w({},t[n],i):i)}))}(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=$w({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=qw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=uT(this._currentThemeName),this._currentTheme=o(a,l);else if(y(n)&&(!r||y(r))||y(r)&&(!n||y(n))){const t=qw({},uT(this._currentThemeName),uT(n),uT(r));this._currentTheme=o(a,t)}else{const t=qw({},uT(this._currentThemeName),uT(n),uT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(q_.poptip,K_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Lg(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.getTheme("background")||this._option.background}getCurrentTheme(){return uT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!cT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 Ok(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(!Lg(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;this._chart.resetLayoutItemTag(),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)?xp.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(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?Nw(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(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 Eg("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?Nw(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Eg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return SC.instance().getFunction(t)}registerFunction(t,e){t&&e&&SC.instance().registerFunction(t,e)}unregisterFunction(t){t&&SC.instance().unregisterFunction(t)}getFunctionList(){return SC.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=Kw.getChartPlugins();t.length>0&&(this._chartPlugin=new wC(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=Kw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new zC(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}HC.InstanceManager=hT,HC.ThemeManager=cT,HC.globalConfig={uniqueTooltip:!0},HC.Utils=xC,HC.vglobal=xp;Kw.registerRegion("region",Zk),Kw.registerLayout("base",aC),f_(),s_(),Kw.registerMark(bC.type,bC),Kw.registerStageEventPlugin("gesture",mf),FC(),UC(),nT(Yw.name,Yw);const VC="monotone",WC="linear",GC="bevel";function YC(t,e){return e("component",t)}function XC(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=Kw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const $C=(t,e,i,s)=>{if(d(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},KC=(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},qC=(t,e,i,s)=>{let n;if(n=u(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=XC(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ZC=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const JC=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function QC(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=eM(qC(h,r,a,c),u,g),o.value=eM(qC(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=qC(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function tM(t,e,i,s,n,r,a){if(u(e)){QC(t,e(n,a),i,s,r,a)}else e&&QC(t,e,i,s,r,a)}const eM=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=Be.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class iM{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,u,d,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!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,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=>{tM(a,t,e,i,s,n,r)})):u(t)?tM(a,t,e,i,s,n,r):t&&QC(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=u(e)?e(s,n):e;if(r?d(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:qC(r.visible,t,n),value:eM(qC(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:qC(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=qC(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&JC(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 sM={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}},nM=(t,e)=>{var i,s;let n=e.fields;if(u(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=VT([],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 rM(a,n,o)},rM=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ug(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ug(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=sM[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},aM=(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=>{Ug(t[e])||(t[e]=0)}))})),t};function oM(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function lM(t,e,i){t&&(i.needDefaultSeriesField&&(t[AT]=i.defaultSeriesField),t[xT]=e,t[ST]=i.getKey(t,e,i))}const hM={label:{name:"label",type:"text"}},cM=`${vT}_rect_x`,uM=`${vT}_rect_x1`,dM=`${vT}_rect_y`,pM=`${vT}_rect_y1`,gM={data:!0},fM={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},mM=[...Object.keys(CC),"normal"];function vM(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 SM(n)&&delete n.type,n.oneByOne&&(n=_M(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bM,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=$w({},o[e],a);return SM(n)&&delete n.type,n.oneByOne&&(n=_M(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:bM,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function yM(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;const i=["custom","customParameters"];return t=I(t,null,i),AM(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function _M(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=u(n)?n(t,i,a):A(n)?n:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(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=u(n)?n(t,r,o):A(n)?n:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(s)?s(t,r,o):s;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function bM(t,e){var i;return null!==(i=null==t?void 0:t[xT])&&void 0!==i?i:e.context.graphicIndex}function xM(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 SM(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function AM(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),AM(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),AM(t[s],e,i))}function wM(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class TM extends Yk{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=mw(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=Kw.getSeriesMarkMap(o)?function(t,e,i){const s=Kw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=$w({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return $w({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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),d(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:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&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=$w({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>$w({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class kM extends Xk{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:`${vT}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=TM,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=wM(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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 d(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)&&(gk(this._rawData.dataSet,"invalidTravel",aM),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=bk(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=_k(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=_k(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new pC(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=rM(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(){gk(this._dataSet,"dimensionStatistics",nM);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ni(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&&VT(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){gk(this._dataSet,"dimensionStatistics",nM);const s=new ni(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=VT(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&VT(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ni(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 d(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("-"):u(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)&&(gk(this._rawData.dataSet,"addVChartProperty",KC),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:oM.bind(this),call:lM}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=vM({},yM(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Dg(s)||Fg(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=$w(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=$w(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=OC(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=OC(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=OC(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:AT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:wT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,wT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new iM(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)=>!H(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!H(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},gM),fM),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=>fM[i]&&!H(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!H(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ni||xk(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();wM(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){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:AT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Cw).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return _w(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:AT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(l),this.initMarkStyleWithSpec(_,$w({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:ST}_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!==CT&&t!==BT&&t!==kT&&t!==MT||(t=this.getStackValueField()),null!==(e=GT(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=>Ug(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:AT]}}function CM(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();$x(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 MM(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}}}kM.mark=hM,kM.transformerConstructor=TM;class BM extends kM{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);$x(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:`${vT}_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(CT),this.setFieldX2(kT)):(this.setFieldY(CT),this.setFieldY2(kT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(BT),this.setFieldX2(MT)):(this.setFieldY(BT),this.setFieldY2(MT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RT),this.setFieldX2(ET)):(this.setFieldY(RT),this.setFieldY2(ET))}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(t.ChartEvent.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)&&(CM("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)}}function EM(t){return"bottom"===t||"top"===t}function RM(t){return"left"===t||"right"===t}function PM(t){return"z"===t}function OM(t,e){return Pw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function IM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?EM(t)?"linear":"band":EM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const LM=(t,e,i)=>{var s;const n=null!==(s="band"===e?YC("axisBand",i):["linear","log","symlog"].includes(e)?YC("axisLinear",i):{})&&void 0!==s?s:{},r=EM(t)?YC("axisX",i):RM(t)?YC("axisY",i):YC("axisZ",i);return $w({},YC("axis",i),n,r)};class DM{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:Rg)("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:Rg)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>qx(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return EM(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class FM extends DM{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:lk.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const jM=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},NM=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},UM=(t,e,i,s)=>{var n;const r=e.getScale(),a=qx(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:zM(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,HM=(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};class VM extends DM{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)=>!jM(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:lk.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:lk.canvas}),callback:this.onMouseOut}),Dg(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:lk.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Dg(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var WM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(WM||(WM={}));const GM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class YM{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(GM.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:GC,curveType:WC,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===VC?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(GM.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:xM(this._spec,GM.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new ni(this._option.dataSet,{name:`${vT}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(WM.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[GM.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(WM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,$w({},this._spec[GM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const XM=Object.assign(Object.assign({},hM),GM),$M=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>$M(t,e[i])));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]))},KM=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class qM extends yC{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return KM}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(Kx(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?$M(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,u=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!u||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),u?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:zk.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[ST]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class ZM extends qM{constructor(){super(...arguments),this.type=ZM.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)===gw.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}ZM.type="line";const JM=()=>{Kw.registerMark(ZM.type,ZM),f_(),r_(),OA(),MA(),PC(),Kw.registerGraphicComponent("line",$h)};class QM extends yC{constructor(){super(...arguments),this.type=QM.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}QM.type="symbol";const tB=()=>{Kw.registerMark(QM.type,QM),f_(),v_(),MA(),Kw.registerGraphicComponent("symbol",Gh)};class eB extends TM{_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 iB(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function sB(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 nB(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:u}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[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),u[1]=-u[0]*t}return!0}function rB(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 aB(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 oB(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 lB=(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 u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.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=u.map((t=>function(t,e,i,s,n){const r=Lt(t,e),a=Math.max(It(i),It(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return Vx(v)};class hB{constructor(t){this.id=Ng(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class cB extends hB{constructor(){super(cB.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!$x(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&iB(c)&&iB(u)))return;const d=sB(t,c),p=sB(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!rB(d,p))return}else if(0===_&&0===b){if(!rB(p,d))return}else if(y||A)if(y&&!A){if(!nB(d,p))return}else if(A&&!y){if(!nB(p,d))return}else{if(f===b)return;if(f>b){if(!aB(d,p))return}else if(!aB(p,d))return}else{if(0===f&&0===_){if(!oB(d,p))return}else if(0===b&&0===g&&!oB(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){gk(e.getOption().dataSet,"tickAlign",lB);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}cB.pluginType="component",cB.type="AxisSyncPlugin";const uB={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function dB(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 pB(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const gB=t=>"band"===t||"ordinal"===t||"point"===t;function fB(t,e){return{id:t,label:t,value:e,rawValue:t}}function mB(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class vB extends AC{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const yB=`${vT}_ARC_TRANSFORM_VALUE`,_B=`${vT}_ARC_RATIO`,bB=`${vT}_ARC_START_ANGLE`,xB=`${vT}_ARC_END_ANGLE`,SB=`${vT}_ARC_K`,AB=`${vT}_ARC_MIDDLE_ANGLE`,wB=`${vT}_ARC_QUADRANT`,TB=`${vT}_ARC_RADIAN`,kB=-Math.PI/2,CB=3*Math.PI/2,MB=(t,e,i)=>{var s;const n=null!==(s="band"===e?YC("axisBand",i):"linear"===e?YC("axisLinear",i):{})&&void 0!==s?s:{},r=YC("angle"===t?"axisAngle":"axisRadius",i);return $w({},YC("axis",i),n,r)};function BB(t,e,i,s){switch(t){case r.cartesianBandAxis:return LM(OM(i,["z"]),"band",e);case r.cartesianLinearAxis:return LM(OM(i,["z"]),"linear",e);case r.cartesianLogAxis:return LM(OM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return LM(OM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return LM(OM(i),void 0,e);case r.polarBandAxis:return MB(i.orient,"band",e);case r.polarLinearAxis:return MB(i.orient,"linear",e);case r.polarAxis:return MB(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,trigger:c,triggerOff:u}=null!==(s=YC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>EM(t.orient)));let g;g=p(d)?$w({},gB(d.type)?a:o,l):l;const f=n.find((t=>RM(t.orient)));let m;return m=p(f)?$w({},qx(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(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,trigger:c,triggerOff:u}=null!==(s=YC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>"angle"===t.orient));let g;g=p(d)?$w({},gB(d.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?$w({},qx(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return EB(i,YC(t,e));default:return YC(t,e)}}const EB=(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=$w({},e,s);return delete n.horizontal,delete n.vertical,n};class RB extends Yk{getTheme(t,e){return BB(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({},jw(e)),{[s]:0}))}}class PB extends Kk{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=RB,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof ra||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:lk.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 vB(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!H(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}}getDatum(t){}}var OB,IB;PB.transformerConstructor=RB,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(OB||(OB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(IB||(IB={}));class LB extends yC{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=Kw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(rk.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}LB.type="component";const DB=()=>{Kw.registerMark(LB.type,LB)},FB=t=>t;class jB extends PB{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?OB.circleAxis:OB.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?IB.circleAxisGrid:IB.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=vM(null===(h=Kw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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()),e=new pC(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return cw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?$x(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 cw(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=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));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),cw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&H(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):cw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(cw(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=JT(s=t.domainLine)).startSymbol=JT(s.startSymbol),s.endSymbol=JT(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return tk($w({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:tk(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>tk(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=tk(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return tk($w({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:tk(t.tick.style)),t.tick.state&&(i.tick.state=QT(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=u(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return tk($w({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:tk(t.subTick.style)),t.subTick.state&&(i.subTick.state=QT(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 u,p=r;"left"!==t.orient&&"right"!==t.orient||n&&d(p)&&(p="left"===t.orient?-90:90,u=uB[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:$w({},u,tk(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:tk(h.style)}),h.state&&(i.title.state.shape=QT(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:tk(o.style)}),o.state&&(i.title.state.background=QT(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=QT(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=tk(t.background.style)),t.background.state&&(i.panel.state=QT(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:u(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 tk($w({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:tk(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:tk(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=XC(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){fk(this._option.dataSet,"scale",FB);const i=this.registerTicksTransform();return new ni(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)}getDatum(t){var e;return t&&t.name===eb.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}jB.specKey="axes";const NB=()=>{DB(),Kw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},UB=[cB];class zB extends jB{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),cw(this._regions,(t=>{const e=this.getOrient();EM(e)?mB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):RM(e)?mB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):PM(e)&&mB(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=$w({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle($w({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=EM(this.getOrient()),n=t=>{var e;return(s?!EM(t.getOrient()):EM(t.getOrient()))&&$x(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=OM(i,["z"]),PM(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!pB(e))return null;const{axisType:t,componentName:s}=IM(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=>RM(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(!pB(t))return;const{axisType:s,componentName:n}=IM(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=Kw.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return EM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):PM(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(UB.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){EM(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&&!EM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!PM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;RM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=Lw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=Lw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=EM(this.getOrient())?t.fieldX:PM(this.getOrient())?t.fieldZ:t.fieldY,$x(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:$x(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(rk.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(EM(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=EM(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)}))}collectScale(){const t=[];return cw(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]:EM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:PM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();cw(this._regions,(e=>{EM(t)?mB(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):RM(t)?mB(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):PM(t)&&mB(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=EM(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=EM(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=$w(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new le).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=EM(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;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return fB(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:$x(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}zB.type=r.cartesianAxis,zB.specKey="axes";const HB=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function VB(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,GB=(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 YB(t,e,i="count"){const s=GB(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const XB=Math.sqrt(50),$B=Math.sqrt(10),KB=Math.sqrt(2);class qB{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=dB(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(u(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=EM(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(WB),e.sort(WB),{domain:VB(t,e),scope:YB(t,e,i)}}(r,Mg(t),this._spec.breaks[0].scopeType);e=Mg(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}=dB(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>=XB?10:n>=$B?5:n>=KB?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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}}const ZB={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},JB={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}}},QB={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}}},tE={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}}};class eE extends zB{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new jS}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!PM(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=EM(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=Ow(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=Mg(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 gk(this._option.dataSet,t,XS),t}}eE.type=r.cartesianLinearAxis,eE.specKey="axes",eE.builtInTheme={axis:tE,axisLinear:ZB,axisX:JB,axisY:QB},W(eE,qB);const iE=()=>{Kw.registerGraphicComponent(OB.lineAxis,((t,e)=>new Hx(t,e))),Kw.registerGraphicComponent(IB.lineAxisGrid,((t,e)=>new HA(t,e))),NB(),Kw.registerComponent(eE.type,eE)};class sE extends zB{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new vS}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 gk(this._option.dataSet,t,JS),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=lS(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(),u=e=>{const i=t===n?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new pC(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=fB(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=>fB(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 nE=()=>{Kw.registerGraphicComponent(OB.lineAxis,((t,e)=>new Hx(t,e))),Kw.registerGraphicComponent(IB.lineAxisGrid,((t,e)=>new HA(t,e))),NB(),Kw.registerComponent(sE.type,sE,!1)};class rE extends eE{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cw(this._regions,(t=>{EM(this.getOrient())?mB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):mB(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=$w({},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 ni(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 pC(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=Be.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,u=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="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?d(u,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=>fB(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=>fB(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return gk(this._option.dataSet,t,XS),t}transformScaleDomain(){}}rE.type=r.cartesianTimeAxis,rE.specKey="axes",rE.builtInTheme={axis:tE,axisX:JB,axisY:QB};class aE extends eE{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new HS}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 gk(this._option.dataSet,t,XS),t}transformScaleDomain(){}}aE.type=r.cartesianLogAxis,aE.specKey="axes",aE.builtInTheme={axis:tE,axisLinear:ZB,axisX:JB,axisY:QB},W(aE,qB);class oE extends eE{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new VS}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 gk(this._option.dataSet,t,XS),t}transformScaleDomain(){}}oE.type=r.cartesianSymlogAxis,oE.specKey="axes",oE.builtInTheme={axis:tE,axisLinear:ZB,axisX:JB,axisY:QB},W(oE,qB);const lE=`${vT}_hide_`;function hE(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const cE=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[lE]&&(hE(t,!0),t[lE]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[lE]=!0,hE(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},uE=()=>{Kw.registerGrammarTransform("symbolOverlap",{transform:cE,runType:"afterEncode"})},dE={min:$,max:X,average:function(t,e){let i=0,s=0;return t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)})),i/s},sum:ow};function pE(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function gE(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 fE(t,e,i,s){return gE(t,e,i,"min",s)}function mE(t,e,i,s){return gE(t,e,i,"max",s)}function vE(t,e,i,s){return gE(t,e,i,"average",s)}function yE(t,e,i,s){return gE(t,e,i,"sum",s)}const _E=(t,e)=>{let i=u(t.size)?t.size():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=pE;if("min"===n?l=fE:"max"===n?l=mE:"average"===n?l=vE:"sum"===n&&(l=yE),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[]},bE=()=>{Kw.registerGrammarTransform("dataSampling",{transform:_E})};class xE extends BM{constructor(){super(...arguments),this.type=gw.line,this.transformerConstructor=eB,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(vM(null===(i=Kw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),yM("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=MM(this);this._symbolMark.setAnimationConfig(vM(null===(s=Kw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yM("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}xE.type=gw.line,xE.mark=XM,xE.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},xE.transformerConstructor=eB,W(xE,YM);class SE{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)=>{xk(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ni)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];Eg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Eg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class AE{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)=>{zg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{VT(e,[{key:t,operations:$x(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&&VT(e,[{key:i.field,operations:$x(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?Bw("colorOrdinal"):Bw(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(zg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(H(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(!H(r.specified,s.specified))return e.reMake=!0,e;s.range&&!H(s.range,n.range())&&(n.range(s.range),e.reRender=!0),zg(s.domain)?e.reRender=!0:H(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(!zg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=$x(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=$x(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;$x(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void($x(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=$x(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));$x(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class wE{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class TE extends Gk{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Ng(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:yT,height:_T},this._viewRect={width:yT,height:_T},this._viewBox={x1:0,y1:0,x2:yT,y2:_T},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=jw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new nk(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new SE(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new wE;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=Kw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=Kw.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=Kw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof Xk)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 yC))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof yC)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&xk(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=Lk(this._spec,this._option,{width:yT,height:_T})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=_w(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new AE(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){Dk(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=_w(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(!H(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{Dk(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,Dk(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):Dk(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()];Dk(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=Dw(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=u(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(rk.AFTER_MARK_RENDER_END,e)};this._event.on(rk.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:ik;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(ek(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));u&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===WM.dimensionHover||s===WM.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=d(t)||!n||n.every((t=>qx(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const kE=(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 CE{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),u=Object.assign(Object.assign({},s),c);e?u.theme=h.getTheme(r,t):Xw(t,a,c.spec),Xw(n,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=kE(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=kE(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(Kw.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(Kw.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=Kw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=Kw.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=Kw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return u&&!g&&(null===(n=u.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):$C(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),d&&(null===(a=$C(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,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"];return 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}))}_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 ME extends CE{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&$w(i,Fk(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 BE extends ME{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),Ik(t)}}const EE=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=YT(t,!0);for(const e in o)for(const i in o[e].nodes)qT(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)KT(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&$T(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class PE{_beforeInit(){this._dataSet&&gk(this._dataSet,"stackSplit",EE)}_initStack(){this._stack=new RE(this),this._stack.init()}}const OE={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:WM.dimensionHover};class IE extends IC{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},OE,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=ik(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}IE.type="dimension-hover",IE.defaultOptions=OE;const LE=()=>{Kw.registerInteractionTrigger(IE.type,IE)},DE=()=>{Kw.registerComposedEvent(WM.dimensionHover,VM),Kw.registerComposedEvent(WM.dimensionClick,FM)},FE=t=>t.fieldX[0],jE=t=>t.fieldY[0],NE=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},UE=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},zE=(t,e)=>t?e?FE:NE:e?jE:UE,HE=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=HM(t,(t=>EM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=HM(t,(t=>RM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{qx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const s=VE(t,i,zE(e,qx(t.getScale().type)));s&&d.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=VE(t,i,zE(e,s));n&&d.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},VE=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:WE(t,s,i)},WE=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=UM(e,t,"cartesian",null!=i?i:EM(t.getOrient())?FE:jE);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},GE=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let w=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(qx(m.type))A=m.bandwidth(),0===A&&m.step&&(w=m.step());else if($x(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=function(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};XE(t,u),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&YE(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=w,t[n].cacheInfo=S})),t),YE=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=XC(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},XE=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},$E=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=KE(i,s,n,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},KE=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},qE=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return GE(c,r,e),c.xField.cacheInfo?$E(c.xField):c.yField.cacheInfo?$E(c.yField):void 0},ZE=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],JE=(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])&&ZE.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(QE(s).every((t=>{var e;return!JC("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},QE=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},tR={dom:`${vT}_TOOLTIP_HANDLER_DOM`,canvas:`${vT}_TOOLTIP_HANDLER_CANVAS`},eR={key:"其他",value:"..."};var iR;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(iR||(iR={}));class sR{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=JE(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[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({},eR),t):eR;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!d(e)&&JC(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 nR extends sR{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!qx(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const rR=()=>{Kw.registerTooltipProcessor("dimension",nR)};class aR extends sR{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,u=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,d=null===(n=null==u?void 0:u.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,ps.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(ik(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const oR=()=>{Kw.registerTooltipProcessor("mark",aR)};class lR extends sR{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 hR=()=>{Kw.registerTooltipProcessor("group",lR)};class cR extends TE{constructor(){super(...arguments),this.transformerConstructor=BE,this.type="line",this.seriesType=gw.line}_setModelOption(){this._modelOption.getDimensionInfo=HE,this._modelOption.getDimensionInfoByValue=WE,this._modelOption.getRectByDimensionData=qE}}cR.type="line",cR.seriesType=gw.line,cR.transformerConstructor=BE,W(cR,PE);function uR(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 dR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:uR(t,e)}),pR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:uR(t,e)}),gR={type:"fadeIn"},fR={type:"growCenterIn"};function mR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return gR;case"scaleIn":return fR;default:return dR(t)}}class vR extends yC{constructor(){super(...arguments),this.type=vR.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}vR.type="rect";const yR=()=>{f_(),u_(),TA("rect",EA),Kw.registerMark(vR.type,vR),Nb.registerBuiltInAnimate("growHeightIn",yx),Nb.registerBuiltInAnimate("growHeightOut",_x),Nb.registerBuiltInAnimate("growWidthIn",Dx),Nb.registerBuiltInAnimate("growWidthOut",Fx),Nb.registerBuiltInAnimate("growCenterIn",fx),Nb.registerBuiltInAnimate("growCenterOut",mx),Kw.registerGraphicComponent("rect",Jh)},_R=Object.assign(Object.assign({},hM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function bR(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=Uw(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[cM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Ew(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[uM]):Ew(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=Ew(this._dataToPosX(t),e,i),n=Ew(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[dM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Ew(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[pM]):Ew(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=Ew(this._dataToPosY(t),e,i),n=Ew(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},AR.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:xM(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(AR.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(gk(this._option.dataSet,"addVChartProperty",KC),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};gk(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ni(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:oM.bind(this),call:lM}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new pC(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=pM,s=dM,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=uM,s=cM,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=YT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)bR(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,u=Ew(this[r](t),l,i),d=Ew(this[a](t),l,i);let p=Math.abs(u-d);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[kT],n=t[CT],r=t[MT],h=t[BT];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]),{[kT]:i,[CT]:s}),a?{[MT]:o,[BT]: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(Jh(Object.assign(Object.assign({},c),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Ew(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Ew(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=MM(this);this._barMark.setAnimationConfig(vM(null===(e=Kw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),yM(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=Uw(this._spec.barWidth,a)),l&&(c=Math.max(c,Uw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,Uw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=Uw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(s+=d*y+(d-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=$x(g.type||"band");return u(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}AR.type=gw.bar,AR.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},AR.mark=_R,AR.transformerConstructor=SR;const wR=()=>{bE(),yR(),Kw.registerAnimation("bar",((t,e)=>({appear:mR(t,e),enter:dR(t,!1),exit:pR(t,!1),disappear:pR(t)}))),nE(),iE(),Kw.registerSeries(AR.type,AR)};class TR extends ME{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Ik(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 kR extends TE{constructor(){super(...arguments),this.transformerConstructor=TR,this.type="bar",this.seriesType=gw.bar}_setModelOption(){this._modelOption.getDimensionInfo=HE,this._modelOption.getDimensionInfoByValue=WE,this._modelOption.getRectByDimensionData=qE}}kR.type="bar",kR.seriesType=gw.bar,kR.transformerConstructor=TR,W(kR,PE);const CR=[...KM,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class MR extends qM{constructor(){super(...arguments),this.type=MR.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return CR}_getIgnoreAttributes(){return[]}}MR.type="area";class BR extends iM{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 ER=Object.assign(Object.assign(Object.assign({},hM),GM),{area:{name:"area",type:"area"}}),RR=()=>{Kw.registerAnimation("area",EC),RC(),BC()};class PR extends eB{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),d=!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||d&&!u)&&(g=h,f=l),l.style=$w({},f.style,g.style),l.state=$w({},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 OR extends BM{constructor(){super(...arguments),this.type=gw.area,this.transformerConstructor=PR,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OR.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===VC?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Ew(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Ew(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[CT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(vM(null===(e=Kw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),yM("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(vM(null===(i=Kw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),yM("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=MM(this);this._symbolMark.setAnimationConfig(vM(null===(s=Kw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),yM("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 BR(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(){super.onLayoutEnd(),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}}}OR.type=gw.area,OR.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},OR.mark=ER,OR.transformerConstructor=PR,W(OR,YM);const IR=()=>{bE(),uE(),JM(),Kw.registerMark(MR.type,MR),f_(),e_(),OA(),MA(),PC(),Kw.registerGraphicComponent("area",mc),tB(),RR(),nE(),iE(),Kw.registerSeries(OR.type,OR)};class LR extends ME{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Ik(t)}}class DR extends TE{constructor(){super(...arguments),this.transformerConstructor=LR,this.type="area",this.seriesType=gw.area}_setModelOption(){this._modelOption.getDimensionInfo=HE,this._modelOption.getDimensionInfoByValue=WE,this._modelOption.getRectByDimensionData=qE}}DR.type="area",DR.seriesType=gw.area,DR.transformerConstructor=LR,W(DR,PE);class FR extends kM{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(d(t)||d(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:[]};$x(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:[]};$x(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(t.ChartEvent.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)&&CM(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 jR(t){return Ug(t)?Number.parseFloat(t):0}const NR=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=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&&u&&UR(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,w=S,T=0;const k=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[yB],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=w/T;A=p,m.forEach((e=>{const i=e[r]===f?f:e[yB]*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},UR=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===jR(t[e])))||!i&&0===t.reduce(((t,i)=>t+jR(i[e])),0)));function zR(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const HR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:zR(t,!0,Ak.appear)}),VR={type:"fadeIn"},WR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:zR(t,!0,Ak.enter)}),GR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:zR(t,!0,Ak.exit)}),YR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:zR(t,!0,Ak.exit)});function XR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return VR;case"growRadius":return HR(Object.assign(Object.assign({},t),{growField:"radius"}));default:return HR(Object.assign(Object.assign({},t),{growField:"angle"}))}}class $R extends yC{constructor(t,e){super(t,e),this.type=KR.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i),e[AB])[t]+s,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 KR extends $R{constructor(){super(...arguments),this.type=KR.type}}KR.type="arc";const qR=()=>{f_(),Qy(),TA("arc",DA),Nb.registerBuiltInAnimate("growRadiusIn",Ox),Nb.registerBuiltInAnimate("growRadiusOut",Ix),Nb.registerBuiltInAnimate("growAngleIn",px),Nb.registerBuiltInAnimate("growAngleOut",gx),Kw.registerGraphicComponent("arc",_c),Kw.registerMark(KR.type,KR)},ZR=Object.assign(Object.assign({},hM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class JR extends TM{_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=$w({},this._theme,i,t);const n=(t,e)=>$w({},"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 QR=`${vT}_LABEL_VISIBLE`;class tP extends FR{constructor(){super(...arguments),this.transformerConstructor=JR,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Lw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Lw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=kB,this._endAngle=CB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[AB];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Ut(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;gk(this._dataSet,"pie",NR),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:bB,asEndAngle:xB,asRatio:_B,asMiddleAngle:AB,asRadian:TB,asQuadrant:wB,asK:SB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ni(this._dataSet,{name:`${vT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new pC(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},tP.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:ST,groupKey:this._seriesField,isSeriesMark:!0},{morph:xM(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return uw(bB)(t)}endAngleScale(t){return uw(xB)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(u(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 Ht(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 e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Rw(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Rw(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:uw(QR).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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*(d(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[AB];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Ut(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===Ak.appear)return this._startAngle;if(i===Ak.disappear)return this._endAngle;const r=[Ak.disappear,Ak.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[xT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[xT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[xT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[xT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[AB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[AB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[AB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[AB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=vM(null===(i=Kw.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]}}tP.transformerConstructor=JR,tP.mark=ZR,tP.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class eP extends tP{constructor(){super(...arguments),this.type=gw.pie}}eP.type=gw.pie;const iP=()=>{qR(),Kw.registerAnimation("pie",((t,e)=>({appear:XR(t,e),enter:WR(t),exit:GR(t),disappear:YR(t)}))),Kw.registerAnimation("emptyCircle",((t,e)=>({appear:XR(t,e)}))),Kw.registerSeries(eP.type,eP)};class sP extends CE{_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=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(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 nP extends sP{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class rP extends TE{constructor(){super(...arguments),this.transformerConstructor=nP}}rP.transformerConstructor=nP;class aP extends rP{constructor(){super(...arguments),this.transformerConstructor=nP,this.type="pie",this.seriesType=gw.pie}}aP.type="pie",aP.seriesType=gw.pie,aP.transformerConstructor=nP;class oP extends CE{_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")&&$w(e,Fk(this.type,t))})),this._transformAxisSpec(t)}}const lP=(t,e)=>{if(!t)return null;const i=HM(t,(t=>"angle"===t.getOrient()),e),s=HM(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&&qx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=lw({x:1,y:0},u);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=hw(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=UM(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&&qx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=lw({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=hw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=UM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class hP extends TE{constructor(){super(...arguments),this.transformerConstructor=oP,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=HE(t,e,i))&&void 0!==s?s:[],...null!==(n=lP(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=WE,this._modelOption.getRectByDimensionData=qE}}hP.type="common",hP.transformerConstructor=oP,W(hP,PE);const cP={rect:mP,symbol:gP,arc:yP,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=gP(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!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=dP(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),Hh(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:_P,area:_P,rect3d:mP,arc3d:yP,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function uP(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=cP[t])&&void 0!==i?i:cP.point;return e.series.type===gw.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=pP(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:bP(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function dP(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==gw.sankey){const{formatFunc:t,args:n}=XC(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function pP(t){return u(t)?e=>t(e.data):t}function gP(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=pP(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:fP(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function fP(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function mP(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=pP(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="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 d,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&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][s]}return s},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:vP(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function vP(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 yP(t){var e;const{labelSpec:i}=t,s=null!==(e=pP(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 _P(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}))):[{index:0,[AT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function bP(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class xP extends PB{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,H(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=Sw({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==zk.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}xP.type=r.label;class SP extends yC{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=SP.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?cc(t):Hh(t)}}SP.type="text";class AP extends SP{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}AP.type="text",AP.constructorType="label";const wP=()=>{Kw.registerMark(SP.type,SP),f_(),__(),p_(),Kw.registerGraphicComponent("text",Hh),Kw.registerGraphicComponent("richtext",cc),Kw.registerMark(AP.constructorType,AP)};class TP extends RB{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kP extends xP{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=TP,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(rk.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(rk.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),cw(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=$w({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},uP(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[LT])):t=>t.filter((t=>t.data[IT]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?dP(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}kP.type=r.label,kP.specKey="label",kP.transformerConstructor=TP;var CP;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(CP||(CP={}));const MP={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class BP extends PB{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{qx(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||H(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:hk.chart}:{source:lk.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Dg(e)||Fg(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(t.ChartEvent.tooltipHide,{source:lk.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:lk.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:lk.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)=>{MP[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return n.forEach((t=>{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-u),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-u)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}BP.specKey="crosshair";const EP={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class RP extends BP{static getSpecInfo(t){return $C(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=EM(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){EM(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:RM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=$E(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new J_(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new Q_(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}RP.specKey="crosshair",RP.builtInTheme={crosshair:EP},RP.type=r.cartesianCrosshair;const PP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,OP=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),IP=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function LP(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=DP(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",u=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=>OP(i,s)(t)&&OP(n,r)(t)&&(d(a)||OP([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:u.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:u.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:lk.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return HC.globalConfig.uniqueTooltip&&HC.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:lk.chart,event:y(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return HC.globalConfig.uniqueTooltip&&HC.hideTooltip(l.id),c}return"none"}const DP=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),u=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=PP(c,t);let y=PP(u,t);const _=IP(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(OP(c,v));if(!_&&(y=PP(u,i),!IP(y)))return;const n=e.type===gw.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=qx(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])=>d(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(OP(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=PP(u,o),!IP(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:u,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(OP(c,n));if(!_&&(y=PP(u,r),!IP(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===gw.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(OP(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=PP(u,i),!IP(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},FP=t=>p(t)&&!_(t),jP=t=>p(t)&&_(t);class NP extends RB{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=$w({},this._theme,r.style),r.offset=$w({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Fg(this._option.mode)||!Lg(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=xp.getElementById(t.parentElement)):Lg(this._option.mode)&&(t.parentElement=null==Ig?void 0:Ig.body)}}const UP={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class zP extends PB{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=NP,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Lg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&FP(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&&!d(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&&HC.globalConfig.uniqueTooltip&&l&&HC.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:lk.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:lk.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?tR.canvas:tR.dom,n=Kw.getComponentPluginInType(t);n||Rg("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=Kw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Dg(s)||Fg(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=LP(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(d(this._cacheInfo)||d(t))return!1;if(jP(t)){if(FP(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>jM(t,e[i])))}if(jP(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}zP.type=r.tooltip,zP.transformerConstructor=NP,zP.builtInTheme={tooltip:UP},zP.specKey="tooltip";function HP(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:u,data:d,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 E(t.style)||(s.textStyle=tk(t.style)),E(t.textStyle)||$w(s.textStyle,tk(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&tk(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&tk(s.background.style),s}(s):b.title={visible:!1},E(n.focusIconStyle)||tk(n.focusIconStyle),n.shape&&(n.shape=JT(n.shape)),n.label&&(n.label=JT(n.label)),n.value&&(n.value=JT(n.value)),n.background&&(n.background=JT(n.background)),Ow(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),Ow(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),Ow(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(E(r.railStyle)||tk(r.railStyle),E(r.sliderStyle)||tk(r.sliderStyle)):(E(r.textStyle)||tk(r.textStyle),r.handler&&JT(r.handler)),b.pager=r,a.visible&&!E(a.style)&&($w(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const VP=(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},WP=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:AT;return h?h(t,c,g):(_(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(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)};class GP extends PB{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{cw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cw(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=Pw(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()}_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):(H(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new pC(this._option,e),this._initSelectedData(),cw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(cw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;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)H(s,this._cacheAttrs)||this._legendComponent.setAttributes($w({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())($w({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());H(t,this._cacheAttrs)||this._legendComponent.setAttributes($w({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}GP.specKey="legends";class YP extends GP{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return $C(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),cw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){gk(this._option.dataSet,"discreteLegendFilter",WP),gk(this._option.dataSet,"discreteLegendDataMake",VP);const t=new ni(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return cw(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!zg(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=GT(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},HP(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return ew}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(qA.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(qA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(qA.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity: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 u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=XC(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=XC(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YP.specKey="legends",YP.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},YP.type=r.discreteLegend;const XP="vchart-tooltip",$P=`${XP}-container`,KP=`${XP}-title`,qP=`${XP}-content-box`,ZP={offsetX:10,offsetY:10},JP="99999999999999";function QP(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const tO=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,eO=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?QP(t):"",iO=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const s=t(e);S(s)&&(i=s)}return i},sO={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},nO=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=sO[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class rO extends hB{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:w,offsetY:T}=this._option,k=m[_],C=ZC(null==k?void 0:k.position,b,e),M=null!==(r=ZC(null==k?void 0:k.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},R="canvas"===m.renderMode,P=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==P?void 0:P.width)&&void 0!==o?o:yT,I=null!==(l=null==P?void 0:P.height)&&void 0!==l?l:_T;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},N={x:0,y:0},U=1,z=1;const H=Lg(this._env);if(H&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),H&&!R){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-N.x,y:F.y-N.y},U=tO(e,F),z=tO(t,N)}const V=z/U,W={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?w:T;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(nO(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;W.left=iO(t,y),W.top=iO(i,y),W.right=iO(e,y),W.bottom=iO(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&$.forEach((t=>{const e=C[t];S(e)||u(e)?W[Y[t][0]]=iO(e,y):X(e,t)}));else p(C)&&(X({orient:C,mode:M},"x"),X({orient:C,mode:M},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?w:T,r=nO(G[t],t);if(A(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(A(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=U,H&&(q[t]+=j[t]),q[t]/=z;const a="x"===t?D.width:D.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/U)/z:-N[t]/z,l=a/z+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",oO=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=aO(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=aO(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},lO=(t={})=>{const{lineHeight:e}=t;return t.fontSize?Lw(e,t.fontSize):0},hO=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),r&&(o=Ce(r),a.padding=aO(o)),{panelStyle:a,panelPadding:o}};function cO(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class uO extends rO{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(uO.type),this.type=tR.dom,this._tooltipContainer=null==Ig?void 0:Ig.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Ig&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=hO(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:aO(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=oO(h),x=oO(u),S=oO(p),w="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[w]=aO(null!==(i=c.spacing)&&void 0!==i?i:8),x[w]=aO(null!==(s=u.spacing)&&void 0!==s?s:26),S[w]=aO(null!==(n=p.spacing)&&void 0!==n?n:0);const T=Math.max(lO(p),lO(u));return y.lineHeight=T>0?`${T}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(KP))),l=a.find((t=>t.className.includes(qP)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(KP),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(cO(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${XP}-column`),e.classList.add(`${XP}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(qP),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];cO(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));cO(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${XP}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=eO(e.key),e.keyStyle&&oO(e.keyStyle,l)):"value"===i?(o.innerHTML=eO(e.value),e.valueStyle&&oO(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?QP(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?QP(c):m,_=p,b=t=>new Wh({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,w;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;w=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(w=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new le));let T=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const k=Dn.IsGradientStr(d);if(!d||y(d)&&!k||u)return m=u?"none":d?QP(d):"currentColor",`\n \n \n \n `;const C=k?Dn.Parse(d):g(d)?d:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===C.gradient?t=`\n ${i}\n `:"linear"===C.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),cO(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(qP))),h=[...o.children].find((t=>t.className.includes(KP)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(KP)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=Lw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,cO(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{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},Cc||(Cc=Tc.CreateGraphic("richtext",{})),Cc.setAttributes(a),Cc.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function gO(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:dO),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const fO=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 mO extends rO{constructor(){super(mO.type),this.type=tR.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new aw({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Ce(u.padding),b=jw(u.padding),x=gO(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=gO(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=gO(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:fO(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:w,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:k={},content:C=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const R=!!C.length;let P=0,O=0,I=0,L=0;if(R){const t=[],e=[],i=[],s=[];let n=0;T.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:T}=r,k={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=$w({},S,gO(b,void 0,{})),{width:s,height:n,text:r}=pO(h,i);k.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=$w({},A,gO(x,void 0,{})),{width:e,height:s,text:n}=pO(m,t);k.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};T?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,k.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else k.shape={visible:!1};return k.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(N){V=$w({},x,gO(z,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:R?Math.ceil(E):void 0);const{text:t,width:e,height:i}=pO(U,V);T.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=T.title.value.width,F=T.title.value.height,j=F+(R?T.title.spaceRow:0)}return B+=j,T.title.width=D,T.title.height=F,W()?M+=E||D:M+=Math.max(D,E),R&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-L-P-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=M,T.panel.height=B,T})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}mO.type=tR.canvas;const vO=/\{([^}]+)\}/,yO=/\{([^}]+)\}/g,_O=/:/;class bO extends hB{constructor(){super(bO.type),this.type="formatterPlugin",this._timeModeFormat={utc:Be.getInstance().timeUTCFormat,local:Be.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Fe.getInstance().format,this._numericSpecifier=Fe.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[bO.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),Kw.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=vO.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(yO,((t,i)=>{if(!_O.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(Ie.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}}bO.pluginType="chart",bO.specKey="formatter",bO.type="formatterPlugin";HC.useRegisters([()=>{rR(),oR(),hR(),DE(),LE(),bE(),uE(),JM(),tB(),RC(),BC(),nE(),iE(),Kw.registerSeries(xE.type,xE),Kw.registerChart(cR.type,cR)},()=>{rR(),oR(),hR(),LE(),IR(),DE(),Kw.registerChart(DR.type,DR)},()=>{rR(),oR(),hR(),LE(),wR(),DE(),Kw.registerChart(kR.type,kR)},()=>{oR(),iP(),Kw.registerChart(aP.type,aP)},()=>{rR(),oR(),hR(),DE(),Kw.registerChart(hP.type,hP),LE()},iE,nE,()=>{Kw.registerComponent(YP.type,YP)},()=>{Kw.registerComponent(zP.type,zP)},()=>{Kw.registerComponent(RP.type,RP)},()=>{Kw.registerGraphicComponent(kP.type,(t=>new jA(t))),wP(),DB(),Kw.registerComponent(kP.type,kP,!0,1/0)},()=>{var t;t=mO,Kw.registerComponentPlugin(t.type,t)},()=>{var t;t=bO,Kw.registerChartPlugin(t.type,t)},FC,UC]),HC.useRegisters([()=>{$v(er)}]),t.DEFAULT_CHART_HEIGHT=_T,t.DEFAULT_CHART_WIDTH=yT,t.DEFAULT_CLOSE_STROKE_JOIN=GC,t.DEFAULT_DATA_INDEX=xT,t.DEFAULT_DATA_KEY=ST,t.DEFAULT_DATA_SERIES_FIELD=AT,t.DEFAULT_KEY=HT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=WC,t.DEFAULT_MEASURE_CANVAS_ID=bT,t.DEFAULT_SERIES_STYLE_NAME=wT,t.DEFAULT_SMOOTH_INTERPOLATE=VC,t.Factory=Kw,t.MOSAIC_CAT_END_PERCENT=NT,t.MOSAIC_CAT_START_PERCENT=jT,t.MOSAIC_VALUE_END_PERCENT=FT,t.MOSAIC_VALUE_START_PERCENT=DT,t.ManualTicker=class extends Fb{constructor(t){super(t),this.lastFrameTime=0,this.status=Qi.RUNNING}setupTickHandler(){const t=new jb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Qi.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Qi.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Qi.RUNNING,!0}},t.PREFIX=vT,t.SEGMENT_FIELD_END=zT,t.SEGMENT_FIELD_START=UT,t.STACK_FIELD_END=CT,t.STACK_FIELD_END_OffsetSilhouette=RT,t.STACK_FIELD_END_PERCENT=BT,t.STACK_FIELD_KEY=TT,t.STACK_FIELD_START=kT,t.STACK_FIELD_START_OffsetSilhouette=ET,t.STACK_FIELD_START_PERCENT=MT,t.STACK_FIELD_TOTAL=PT,t.STACK_FIELD_TOTAL_BOTTOM=LT,t.STACK_FIELD_TOTAL_PERCENT=OT,t.STACK_FIELD_TOTAL_TOP=IT,t.StreamLight=class extends Ub{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Vi.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new hn,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Vi.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-n,p=d+(s-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:gs.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:gs.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Ms(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(u=(o-a)/c.getLength());const[e]=Ms(c||s,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;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(u(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(d(i))for(let i=0;i(l(t),t)))},t.measureText=mT,t.normalizeLayoutPaddingSpec=jw,t.queryColorFromColorScheme=xw,t.queryToken=Hw,t.registerDataSetInstanceParser=fk,t.registerDataSetInstanceTransform=gk,t.registerTheme=nT,t.removeTheme=aT,t.themeExist=oT,t.themes=eT,t.token=Ww,t.transformColorSchemeToStandardStruct=Tw,t.transformToGraphic=tk,t.version="2.0.5",t.vglobal=xp,t.warn=Eg,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.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=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=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=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var w=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 k=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 B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=k(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.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&&P.call(t,e);function I(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]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){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,s=!1,n=!1){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 U(t){return Object.prototype.toString.call(t)}function z(t){return Object.keys(t)}function H(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(U(t)!==U(e))return!1;if(u(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(!H(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=z(t),n=z(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(!H(t[r],e[r],i))return!1}return!0}function V(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;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(t=et.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):tt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=et.Warn&&tt(this._method||"warn","WARN",t),this}info(...t){return this._level>=et.Info&&tt(this._method||"log","INFO",t),this}debug(...t){return this._level>=et.Debug&&tt(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Z(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,i=rt,s=nt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ct=function(t,e,i){return ti?i:t};var ut=(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 dt(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,u=!1,d=!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||u&&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 u?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,d&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function ft(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),gt(t,e,{leading:s,trailing:n,maxWait:e})}function mt(t,e){return i=>t*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=1e-12,_t=Math.PI,bt=_t/2,xt=2*_t,St=2*Math.PI,At=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Ct=Math.min,Mt=Math.sin,Bt=Math.sqrt,Et=Math.pow;function Rt(t){return t>=1?bt:t<=-1?-bt: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 Ot(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(It(t),It(e)))}class Dt{constructor(t=0,e=0,i,s){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 Bt(Et(t.x-e.x,2)+Et(t.y-e.y,2))}static distanceNN(t,e,i,s){return Bt(Et(t-i,2)+Et(e-s,2))}static distancePN(t,e,i){return Bt(Et(e-t.x,2)+Et(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 Nt=(t=0)=>{if(t<0)for(;t<-xt;)t+=xt;else if(t>0)for(;t>xt;)t-=xt;return t};function Ut(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 zt(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Ht(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=zt(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 Vt(t){return(t=zt(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 Wt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Gt(t,e,i,s){if(!function(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&h<=1&&[t[0]+n[0]*h,t[1]+n[1]*h]}var Yt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Yt||(Yt={}));const Xt=(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 $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.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 qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const i=e?jt(t.angle):t.angle,s=Jt(t);return[Zt({x:t.x1,y:t.y1},i,s),Zt({x:t.x2,y:t.y1},i,s),Zt({x:t.x2,y:t.y2},i,s),Zt({x:t.x1,y:t.y2},i,s)]}function te(t,e,i=!1){const s=Qt(t,i),n=Qt(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Jt(t),Jt(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),u=i?jt(t.angle):t.angle;let d=i?jt(90-t.angle):t.angle+bt;const p=i?jt(e.angle):e.angle;let g=i?jt(90-e.angle):e.angle+bt;d>St&&(d-=St),g>St&&(g-=St);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(qt(n,i)+qt(n,s))/2>qt(n,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ee(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const ie=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 se(t,e={},i){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 ne{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(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:u,textBaseline:d=(null!=u?u:"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:d,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(d(t))return{width:0,height:0};if(d(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(d(this._numberCharSize)){const t=this._standardMethod(ne.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ne.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ne.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(ne.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ne.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)}}ne.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ne.NUMBERS_CHAR_SET="0123456789",ne.FULL_SIZE_CHAR="字";const re=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ae=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=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 he extends le{}class ce extends le{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new ce(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 ue,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,u=s*this.e-n*this.f+r,d=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,u=o*t+h*e,d=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=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ue;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,u=-n/l,d=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ue(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 de{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 pe(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 ge(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 fe=/^#([0-9a-f]{3,8})$/,me={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 ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function _e(t){return S(t)?new we(t>>16,t>>8&255,255&t,1):_(t)?new we(t[0],t[1],t[2]):new we(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new we((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?_e(t):8===e?new we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t,e=1){return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ae?t:new Ae(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(me[t]))return function(t){return S(t)?new we(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new we(t[0],t[1],t[2],t[3]):new we(255,255,255,1)}(me[t]);if(p(ve[t]))return _e(ve[t]);const e=`${t}`.trim().toLowerCase(),i=Se(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 we(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=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new we(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new we(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=ge(this.color.r,this.color.g,this.color.b),r=pe(d(t)?n.h:ct(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new we(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Ae(this.color.toString())}copyGammaToLinear(t,e=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,e=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=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class we{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`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(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}=ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Te(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),u=Math.round(a*(1-t)+o*t);return new we(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ge});function Ce(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 Me(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}class Be{static getInstance(){return Be.instance||(Be.instance=new Be),Be.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 Re;function Pe(t,e){const i=Ee(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 Oe{constructor(t={}){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 Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){let e;if(e=Ie.exec(t))return new Oe({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 De=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Fe{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 Fe.instance||(Fe.instance=new Fe),Fe.instance}newFormat(t){const e=Le(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,u=e.type;"n"===u?(l=!0,u="g"):je[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=je[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?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=d,A=p,w=t;if("c"===u)A=g(w)+A,w="";else{w=+w;let t=w<0||1/w<0;if(w=isNaN(w)?m:g(Math.abs(w),h),c&&(w=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}(w)),t&&0==+w&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===u?De[8+Re/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=w.length;++ex||x>57){A=(46===x?y+w.slice(e+1):w.slice(e))+A,w=w.slice(0,e);break}}l&&!a&&(w=_(w,1/0));let T=S.length+w.length+A.length,k=T>1)+S+w+A+k.slice(T);break;default:w=k+S+w+A}return b(w)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Le(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Ee(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=De[8+n/3];return function(t){return s(r*t)+a}}}const je={"%":(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)=>Pe(100*t,e),r:Pe,s:function(t,e){const i=Ee(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Re=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")+Ee(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 Ne=function(t,...e){return function(t,...e){t||(t={});let i=-1;const s=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+$e(e,6):$e(e,4))+"-"+$e(t.getUTCMonth()+1,2)+"-"+$e(t.getUTCDate(),2)+(r?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"."+$e(r,3)+"Z":n?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"Z":s||i?"T"+$e(i,2)+":"+$e(s,2)+"Z":"")}function qe(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 Ge;if(h)return h=!1,We;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(;a{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 ei=0;function ii(t="dataset"){return ei>1e8&&(ei=0),t+"_"+ei++}class si{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:ii("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()}}class ni{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&H(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ii("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&H(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof ni||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ve),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ri{static GenAutoIncrementId(){return ri.auto_increment_id++}}ri.auto_increment_id=0;class ai{constructor(t){this.id=ri.GenAutoIncrementId(),this.registry=t}}const oi="named",li="inject",hi="multi_inject",ci="inversify:tagged",ui="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===oi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var pi=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 u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(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(u(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(!u(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=d(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(!u(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(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(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 gi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};pi.hasOwnMetadata(t,e)&&(r=pi.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,pi.defineMetadata(t,r,e)}(ci,t,i.toString(),s)}function fi(t){return(e,i,s)=>{gi(e,0,s,t)}}function mi(t){return e=>(i,s,n)=>fi(new di(t,e))(i,s,n)}const vi=mi(li),yi=mi(hi);function _i(){return function(t){return pi.defineMetadata(ui,null,t),t}}function bi(t){return fi(new di(oi,t))}const xi="Singleton",Si="Transient",Ai="ConstantValue",wi="DynamicValue",Ti="Factory",ki="Function",Ci="Instance",Mi="Invalid";class Bi{constructor(t,e){this.id=ri.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Mi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Bi(this.serviceIdentifier,this.scope);return t.activated=t.scope===xi&&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:pi.getMetadata(ui,t),userGeneratedMetadata:pi.getMetadata(ci,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ri=(Pi=oi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Pi&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Li=Symbol("ContributionProvider");class Di{constructor(t,e){this.serviceIdentifier=t,this.container=e,ji.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fi(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).inSingletonScope().whenTargetNamed(e)}class ji{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ji.store=new Map;class Ni{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 Ui extends Ni{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const zi=Symbol.for("EnvContribution"),Hi=Symbol.for("VGlobal"),Vi=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Si,this.options=e,this.id=ri.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,oi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Bi(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[li],multiInject:s[hi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ai:case ki:e=t.cache;break;case Ci: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===xi&&(t.cache=e,t.activated=!0)}},Wi=Symbol.for("RenderService");const Gi=new class{get renderService(){return this._renderService||(this._renderService=Vi.get(Wi)),this._renderService}};let Yi=0;class Xi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Gi.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Yi,t),this.tryRunAnimationFrameNextFrame(),Yi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class $i{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ki=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zi=function(t,e){return function(i,s){e(i,s,t)}},Ji=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 Qi=class extends $i{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ri.GenAutoIncrementId(),this.hooks={onSetEnv:new Ui(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Xi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ji(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var ts,es,is,ss;Qi=Ki([_i(),Zi(0,vi(Li)),Zi(0,bi(zi)),qi("design:paramtypes",[Object])],Qi),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ts||(ts={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(es||(es={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(is||(is={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(ss||(ss={}));const ns=xt-1e-8;class rs{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ns)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=xt)<0&&(s+=xt),(n%=xt)<0&&(n+=xt),nn;++o,a-=bt)g(a);else for(a=s-s%bt+bt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const os=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ls={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},hs={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let cs,us,ds,ps,gs,fs;var ms,vs,ys,_s,bs,xs;function Ss(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,u=o*r,d=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,w=S+_*m,T=A-_*f;return[h*b+c*x,u*b+d*x,h*w+c*T,u*w+d*T,h*S+c*A,u*S+d*A]}function As(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let g=d*d/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=u/i,m=c/i,v=-c/s,y=u/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 w=Math.sqrt(A);r===n&&(w=-w);const T=.5*(_+x)-w*(S-b),k=.5*(b+S)+w*(x-_),C=Math.atan2(b-k,_-T);let M=Math.atan2(S-k,x-T)-C;M<0&&1===r?M+=xt:M>0&&0===r&&(M-=xt);const B=Math.ceil(Math.abs(M/(bt+.001))),E=[];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 Ts(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Ps(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Is(t,e){const{p0:i,p1:s}=t,n=Ft.pointAtPP(i,s,e);return[new Ls(i,n),new Ls(n,s)]}class Ls extends ks{constructor(t,e){super(),this.type=bs.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p1.x):t===_s.COLUMN?At(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Ds{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Os(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_s.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return At(t.p0.y-s.y)}if(t===_s.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return At(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Fs extends Ds{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 js(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ns(t,e,i){const s=null!=e?e:At(i[i.length-1].x-i[0].x)>At(i[i.length-1].y-i[0].y)?_s.ROW:_s.COLUMN;return"monotoneY"===t?new Fs(t,s):new Ds(t,s)}class Us{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 zs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new Us(n,s),t),n}function Hs(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 Vs{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&&Hs(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:Hs(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 Ws(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return zs(t,e);const n=Ns("basis",i,t);return function(t,e){js(t,e,2)}(new Vs(n,s),t),n}function Gs(t){return t<0?-1:1}function Ys(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(Gs(r)+Gs(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xs(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function $s(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 Ks{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:$s(this,this._t0,Xs(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,$s(this,Xs(this,e=Ys(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:$s(this,this._t0,e=Ys(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 qs extends Ks{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Zs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return zs(t,e);const n=Ns("monotoneX",i,t);return function(t,e){js(t,e,2)}(new Ks(n,s),t),n}function Js(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return zs(t,e);const n=Ns("monotoneY",i,t);return function(t,e){js(t,e,2)}(new qs(n,s),t),n}let Qs=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class tn extends Qs{lineEnd(){this.context.closePath()}}function en(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new Qs(r,e,n),t),r}function sn(t,e){return js(t,e,1)}class nn extends Us{lineEnd(){this.context.closePath()}}function rn(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new nn(n,s),t),n}function an(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>yt){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>yt){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 on(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return zs(i,n);const o=Ns(t,r,i);return js(new e(o,s,a),i,2),o}}const ln=on("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:an(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 hn=on("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:an(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class cn extends ks{constructor(t,e,i){super(),this.type=bs.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Rs(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Cs([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p2.x):t===_s.COLUMN?At(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Ct(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Rs(i,s,n,e),a=Ft.pointAtPP(i,s,e),o=Ft.pointAtPP(s,n,e);return[new cn(i,a,r),new cn(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class un{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e))}quadraticCurveTo(t,e,i,s){const n=new cn(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Os(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function dn(t,e,i){var s,n;switch(e){case"linear":default:return zs(t,i);case"basis":return Ws(t,i);case"monotoneX":return Zs(t,i);case"monotoneY":return Js(t,i);case"step":return en(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new tn(r,e,n),t),r}(t,.5,i);case"stepBefore":return en(t,0,i);case"stepAfter":return en(t,1,i);case"catmullRom":return ln(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return hn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return rn(t,i)}}class pn extends as{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new rs(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([hs.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([hs.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([hs.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([hs.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([hs.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([hs.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([hs.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([hs.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([hs.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new un(this);Ts(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[hs.M]=t=>`M${t[1]} ${t[2]}`,t[hs.L]=t=>`L${t[1]} ${t[2]}`,t[hs.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[hs.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[hs.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[hs.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;tfs){let t,e=ds;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ts(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_s.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.y-e.p1.y)}if(this.direction===_s.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{it.getInstance().warn("空函数")}}),Rn=Object.assign(Object.assign({},An),{points:[],cornerRadius:0,closePath:!0}),Pn=Object.assign(Object.assign({},An),{width:100,height:100,spikes:5,thickness:.5}),On=Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const In=Object.assign(Object.assign({},An),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ln=Object.assign(Object.assign(Object.assign({},An),bn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dn=Object.assign(Object.assign(Object.assign({},An),bn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Fn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},An),{fill:!0,cornerRadius:0,cornerType:"round"}),jn=Object.assign(Object.assign({},Fn),{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}),Nn=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:d(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=u();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=u();return t||i("Missing positioning value"),t}}function u(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function d(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=d(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Un{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Un.IsGradientStr(t))try{const e=Nn(t)[0];if(e){if("linear"===e.type)return Un.ParseLinear(e);if("radial"===e.type)return Un.ParseRadial(e);if("conic"===e.type)return Un.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2,n=parseFloat(e.value)/180*_t-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+St,stops:Un.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Un.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2;let n="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;n<0;)n+=St;for(;n>=St;)n-=St;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,u;const d=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!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}const Vn={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"}},Wn=!0,Gn=!1,Yn=/\w|\(|\)|-/,Xn=/[.?!,;:/,。?!、;:]/,$n=/\S/,Kn=(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})};function qn(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Gi.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=Zn(t,a)),a}function Zn(t,e,i=!1){let s=e;for(;Yn.test(t[s-1])&&Yn.test(t[s])||Xn.test(t[s]);)if(s--,s<=0)return i?Jn(t,e):e;return s}function Jn(t,e){let i=e;for(;Yn.test(t[i+1])&&Yn.test(t[i])||Xn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Qn(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Gi.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var tr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 er=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ln.fontSize}){let i=0,s=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=Zn(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),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,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,a=!1){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=Zn(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}};er=tr([_i()],er);var ir=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sr=Symbol.for("TextMeasureContribution");let nr=class extends er{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};nr=ir([_i()],nr);const rr=Symbol.for("CanvasFactory"),ar=Symbol.for("Context2dFactory");function or(t){return Vi.getNamed(rr,Gi.global.env)(t)}const lr=1e-4,hr=Math.sqrt(3),cr=1/3;function ur(t){return t>-wr&&twr||t<-wr}const pr=[0,0],gr=[0,0],fr=[0,0];function mr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function vr(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function yr(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 _r(t){return(t%=St)<0&&(t+=St),t}function br(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+u&&c>s+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>n+u&&h>a+u||h=0&&pi||c+hn&&(n+=St);let u=Math.atan2(l,o);return u<0&&(u+=St),u>=s&&u<=n||u+St>=s&&u+St<=n}function Ar(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(ur(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 kr=[-1,-1,-1],Cr=[-1,-1];function Mr(){const t=Cr[0];Cr[0]=Cr[1],Cr[1]=t}function Br(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=u*u-4*c*d;if(ur(t)){const t=u/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*(-u+e),s=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,cr):Math.pow(i,cr),s=s<0?-Math.pow(-s,cr):Math.pow(s,cr);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*u)/(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+hr*Math.sin(e)))/(3*a),h=(-o+i*(s-hr*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,kr);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&Mr(),p=yr(e,s,r,o,Cr[0]),d>1&&(g=yr(e,s,r,o,Cr[1]))),2===d?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ur(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,kr);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=vr(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kr[0]=-l,kr[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=St-1e-4){s=0,n=St;const e=r?1:-1;return a>=kr[0]+t&&a<=kr[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=St,n+=St);let c=0;for(let e=0;e<2;e++){const i=kr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=St+t),(t>=s&&t<=n||t+St>=s&&t+St<=n)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function Pr(t){return Math.round(t/_t*1e8)/1e8%2*_t}function Or(t,e){let i=Pr(t[0]);i<0&&(i+=St);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=St?n=i+St:e&&i-n>=St?n=i-St:!e&&i>n?n=i+(St-Pr(i-n)):e&&i1&&(i||(h+=ee(c,u,d,p,s,n))),g&&(c=a[1],u=a[2],d=c,p=u);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;Ir[0]=S,Ir[1]=A,Or(Ir,Boolean(a[6])),S=Ir[0],A=Ir[1];const w=S,T=A-S,k=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case hs.M:d=m,p=v,c=d,u=p;break;case hs.L:if(i){if(Ar(c,u,m,v,e,s,n))return!0}else h+=ee(c,u,m,v,s,n)||0;c=m,u=v;break;case hs.C:if(i){if(xr(c,u,m,v,y,_,b,x,e,s,n))return!0}else h+=Br(c,u,m,v,y,_,b,x,s,n)||0;c=b,u=x;break;case hs.Q:if(i){if(br(c,u,m,v,y,_,e,s,n))return!0}else h+=Er(c,u,m,v,y,_,s,n)||0;c=y,u=_;break;case hs.A:if(o=Math.cos(w)*y+m,l=Math.sin(w)*y+v,g?(d=o,p=l):h+=ee(c,u,o,l,s,n),i){if(Sr(m,v,y,w,w+T,k,e,C,n))return!0}else h+=Rr(m,v,y,w,w+T,k,C,n);c=Math.cos(w+T)*y+m,u=Math.sin(w+T)*y+v;break;case hs.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(Ar(d,p,o,p,e,s,n)||Ar(o,p,o,l,e,s,n)||Ar(o,l,d,l,e,s,n)||Ar(d,l,d,p,e,s,n))return!0}else h+=ee(o,p,o,l,s,n),h+=ee(d,l,d,p,s,n);break;case hs.Z:if(i){if(Ar(c,u,d,p,e,s,n))return!0}else h+=ee(c,u,d,p,s,n);c=d,u=p}}return i||(g=u,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},jr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nr=Symbol.for("VWindow"),Ur=Symbol.for("WindowHandlerContribution");let zr=class extends $i{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(){super(),this.hooks={onChange:new Ui(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Vi.getNamed(Ur,t.env).configure(this,t),this.actived=!0)},this._uid=ri.GenAutoIncrementId(),this.global=Gi.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};zr=Fr([_i(),jr("design:paramtypes",[])],zr);var Hr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wr=function(t,e){return function(i,s){e(i,s,t)}};let Gr=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=Gi.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Dr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:bn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ne(Object.assign({defaultFontParams:{fontFamily:bn.fontFamily,fontSize:bn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Vi.get(Nr),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 Yr;Gr=Hr([_i(),Wr(0,vi(Li)),Wr(0,bi(sr)),Vr("design:paramtypes",[Object])],Gr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Yr||(Yr={}));const Xr=new ue;let $r=class{constructor(){this.matrix=new ue}init(t){return this.mode=Yr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Yr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}scale(t,e,i){return this.mode===Yr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Yr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Xr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}translate(t,e){return this.mode===Yr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Yr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};$r=Hr([_i(),Vr("design:paramtypes",[])],$r);const Kr={arc:wn,area:Tn,circle:kn,line:Bn,path:En,symbol:In,text:Ln,rect:On,polygon:Rn,star:Pn,richtext:Dn,richtextIcon:jn,image:Fn,group:Cn,glyph:Mn},qr=Object.keys(Kr);function Zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Jr={arc:Object.assign({},Kr.arc),area:Object.assign({},Kr.area),circle:Object.assign({},Kr.circle),line:Object.assign({},Kr.line),path:Object.assign({},Kr.path),symbol:Object.assign({},Kr.symbol),text:Object.assign({},Kr.text),rect:Object.assign({},Kr.rect),polygon:Object.assign({},Kr.polygon),star:Object.assign({},Kr.star),richtext:Object.assign({},Kr.richtext),richtextIcon:Object.assign({},Kr.richtextIcon),image:Object.assign({},Kr.image),group:Object.assign({},Kr.group),glyph:Object.assign({},Kr.glyph)};class Qr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},qr.forEach((t=>{this._defaultTheme[t]=Object.create(Jr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;qr.forEach((s=>{const n=Object.create(Jr[s]);t&&t[s]&&Zr(n,t[s]),i[s]&&Zr(n,i[s]),e[s]&&Zr(n,e[s]),this.combinedTheme[s]=n})),e.common&&qr.forEach((t=>{Zr(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 ta=new Qr;function ea(t,e){return t.glyphHost?ea(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)):ta.getTheme()}return null}(t)||t.attachedThemeGraphic&&ea(t.attachedThemeGraphic)||ta.getTheme()}var ia=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 sa 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=ri.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return ia(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof aa))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(ca(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 aa))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=ca(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 aa))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=ca(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 aa))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=ca(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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ha.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ca(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(ca(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,ca(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 aa))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"):ca(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 oa))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=ha.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 ua(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 aa,this.rootWheelEvent=new oa,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)&&!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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class fa{static GetImage(t,e){var i;const s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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):fa.loadImage(t,e)}static GetSvg(t,e){var i;let s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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"},fa.cache.set(t,s),s.dataPromise=Gi.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=fa.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},fa.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gi.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gi.global.loadBlob(t):"json"===e&&(i.dataPromise=Gi.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!fa.isLoading&&fa.toLoadAueue.length){fa.isLoading=!0;const t=fa.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(fa.cache.set(i,n),n.dataPromise=Gi.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((()=>{fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()})).catch((t=>{console.error(t),fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()}))}}),0)}static loadImage(t,e){const i=ma(t,fa.toLoadAueue);if(-1!==i)return fa.toLoadAueue[i].marks.push(e),void fa.loading();fa.toLoadAueue.push({url:t,marks:[e]}),fa.loading()}static improveImageLoading(t){const e=ma(t,fa.toLoadAueue);if(-1!==e){const t=fa.toLoadAueue.splice(e,1);fa.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ma(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_a[0]=t[0],_a[2]=t[0],_a[1]=t[1],_a[3]=t[1],_a):t:t:0,xa=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Sa=[1,2,3,0,1,2,3,0];function Aa(t,e,i,s){for(;t>=St;)t-=St;for(;t<0;)t+=St;for(;t>e;)e+=St;xa[0].x=i,xa[1].y=i,xa[2].x=-i,xa[3].y=-i;const n=Math.ceil(t/bt)%4,r=Math.ceil(e/bt)%4;if(s.add(Tt(t)*i,Mt(t)*i),s.add(Tt(e)*i,Mt(e)*i),n!==r||e-t>_t){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;n{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)}}Ca.TimeOut=1e3/60;const Ma=new Ca,Ba=(t,e)=>{const i=((t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class Ea{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 Ra(t,e,i,s,n){return n?t.arc(i,s,e,0,xt,!1,n):t.arc(i,s,e,0,xt),!1}var Pa=new class extends Ea{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 Ra(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ra(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 Oa=new class extends Ea{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 Ia(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 La=new class extends Ea{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 Ia(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ia(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ia(t,this.parseSize(e)/2+n,i,s,r)}};function Da(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Fa=new class extends Ea{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Da(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Da(t,this.parseSize(e)/2+n,i,s)}};function ja(t,e,i,s,n=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 Na extends Ea{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 ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ja(t,this.parseSize(e)/2,i,s,n)}}var Ua=new Na;var za=new class extends Na{constructor(){super(...arguments),this.type="triangle"}};const Ha=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Va=Math.sin(xt/10)*Ha,Wa=-Math.cos(xt/10)*Ha;function Ga(t,e,i,s){const n=Va*e,r=Wa*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=xt*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 Ya=new class extends Ea{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 Ga(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ga(t,this.parseSize(e)/2+n,i,s)}};const Xa=Bt(3);function $a(t,e,i,s){const n=e,r=n/Xa,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 Ka=new class extends Ea{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 $a(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return $a(t,this.parseSize(e)/2+n,i,s)}};function qa(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 Za=new class extends Ea{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return qa(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return qa(t,this.parseSize(e)/2+n,i,s)}};function Ja(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Qa=new class extends Ea{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ja(t,this.parseSize(e)/2+n,i,s)}};const to=-.5,eo=Bt(3)/2,io=1/Bt(12);function so(t,e,i,s){const n=e/2,r=e*io,a=n,o=e*io+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(to*n-eo*r+i,eo*n+to*r+s),t.lineTo(to*a-eo*o+i,eo*a+to*o+s),t.lineTo(to*l-eo*h+i,eo*l+to*h+s),t.lineTo(to*n+eo*r+i,to*r-eo*n+s),t.lineTo(to*a+eo*o+i,to*o-eo*a+s),t.lineTo(to*l+eo*h+i,to*h-eo*l+s),t.closePath(),!1}var no=new class extends Ea{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 so(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return so(t,this.parseSize(e)/2+n,i,s)}};function ro(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 ao=new class extends Ea{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 ro(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ro(t,this.parseSize(e)/2,i,s,n)}};function oo(t,e,i,s,n=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 lo=new class extends Ea{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 oo(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return oo(t,this.parseSize(e)/2,i,s,n)}};function ho(t,e,i,s,n=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 co=new class extends Ea{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 ho(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ho(t,this.parseSize(e)/2,i,s,n)}};const uo=Bt(3);function po(t,e,i,s){const n=e*uo;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var go=new class extends Ea{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return po(t,this.parseSize(e)/2/uo,i,s)}drawOffset(t,e,i,s,n){return po(t,this.parseSize(e)/2/uo+n,i,s)}};function fo(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 mo=new class extends Ea{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 fo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fo(t,this.parseSize(e)/4+n,i,s)}};function vo(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 yo=new class extends Ea{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 vo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return vo(t,this.parseSize(e)/4+n,i,s)}};function _o(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 bo=new class extends Ea{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 _o(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return _o(t,this.parseSize(e)/4+n,i,s)}};function xo(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 So=new class extends Ea{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 xo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return xo(t,this.parseSize(e)/4+n,i,s)}};function Ao(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var wo=new class extends Ea{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Ao(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Ao(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 To(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ko=new class extends Ea{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return To(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return To(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 Co(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 Mo=new class extends Ea{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 Co(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Co(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 Bo(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Eo(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Ro=new class extends Ea{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)?Eo(t,e,i,s):Bo(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Eo(t,e+2*n,i,s):Bo(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Po=new he;class Oo{constructor(t,e,i=!1){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(),Ts(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ts(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Po.x1=i.bounds.x1*t,Po.y1=i.bounds.y1*t,Po.x2=i.bounds.x2*t,Po.y2=i.bounds.y2*t,e.union(Po)}))}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 Io={};[Pa,Oa,La,Fa,go,za,Ya,Ka,Za,Qa,no,ao,lo,Ua,co,mo,yo,bo,So,Ro,wo,ko,Mo].forEach((t=>{Io[t.type]=t}));const Lo={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class Do{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 Fo(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function jo(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=jo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Fo(t,"--\x3e",r+4,"Comment is not closed.");else{const a=jo(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 Do(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 Do(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 zo(t,e){return Ho(t)}function Ho(t,e){const i={};for(let e=0;eZo.set(t,!0)));const Jo=new Map;function Qo(t){if(Zo.has(t))return!0;if(Jo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Jo.set(t,!0)));const tl=Ko(),el=Ko(),il=Ko(),sl=Ko(),nl=Ko(),rl=Ko(),al=Ko(),ol=Ko(),ll=Ko(),hl=Ko();Ko();const cl=Ko();Ko();const ul=Ko();Ko();const dl=Ko(),pl=Ko(),gl=Symbol.for("GraphicService"),fl=Symbol.for("GraphicCreator"),ml={"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"},vl=Object.keys(ml),yl={duration:200,easing:"cubicOut"};function _l(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 bl(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,u,d,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],u=e[5],d=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]=u,t[6]=d,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+u*n+f*r+e[13],t[14]=l*s+d*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function xl(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 Sl(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],u=e[8],d=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*u+S*f,t[1]=_*n+b*l+x*d+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*u+S*f,t[5]=_*n+b*l+x*d+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*u+S*f,t[9]=_*n+b*l+x*d+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*u+S*f,t[13]=_*n+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Al(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 wl{constructor(){this.pools=[]}static identity(t){return _l(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 wl.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},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bl=new ue(1,0,0,1,0,0),El={x:0,y:0};let Rl=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new pn,this._clearMatrix=new ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Tl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},El),function(t,e,i){return Lr(t,0,!1,e,i)}(this.path.commandList,El.x,El.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},El);const i=zn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Lr(t,e,!0,i,s)}(this.path.commandList,i,El.x,El.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Bl,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Tl.free(t))),this.stack.length=0}};Rl=Cl([_i(),Ml("design:paramtypes",[Object,Number])],Rl);const Pl={WIDTH:500,HEIGHT:500,DPR:1};class Ol{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}set nativeCanvas(t){this._nativeCanvas=t}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=Pl.WIDTH,height:n=Pl.HEIGHT,dpr:r=Pl.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Il;Ol.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Il||(Il={}));class Ll{static Get(t,e=Il.Color1,i=[0,0,0,1]){if(e===Il.Color1){const e=Ll.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ae.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Ll.store1[t]=e,Ll.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=Ll.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ae.parseColorString(t);return n&&(Ll.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Ll.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===Il.Color1){if(Ll.store1[t])return;Ll.store1[t]=i,Ll.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ll.store255[t])return;Ll.store255[t]=i,Ll.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Dl(t,e=!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 Fl(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)=>{var a,o;return jl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):jl(t,e,i,s,n)}function jl(t,e,i,s,n){if(!t||!e)return t&&Dl(t)||e&&Dl(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ll.Get(t,Il.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ll.Get(e,Il.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:Dl(a)})))});return o?Fl(r,l,i,s,n):Fl(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:Hl(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:Hl(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:Hl(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),Dl(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)}function Nl(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}Ll.store255={},Ll.store1={};const Ul=[0,0,0,0],zl=[0,0,0,0];function Hl(t,e,i){return Ll.Get(t,Il.Color255,Ul),Ll.Get(e,Il.Color255,zl),`rgba(${Math.round(Ul[0]+(zl[0]-Ul[0])*i)},${Math.round(Ul[1]+(zl[1]-Ul[1])*i)},${Math.round(Ul[2]+(zl[2]-Ul[2])*i)},${Ul[3]+(zl[3]-Ul[3])*i})`}class Vl{static GetCanvas(){try{return Vl.canvas||(Vl.canvas=Gi.global.createCanvas({})),Vl.canvas}catch(t){return null}}static GetCtx(){if(!Vl.ctx){const t=Vl.GetCanvas();Vl.ctx=t.getContext("2d")}return Vl.ctx}}class Wl extends de{static getInstance(){return Wl._instance||(Wl._instance=new Wl),Wl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vl.GetCanvas(),s=Vl.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gl{static GetSize(t){for(let e=0;e=t)return Gl.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gl.GenKey(t,e,i,s,n),l=Gl.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=Gl.GenKey(t,e,i,s,n);Gl.cache[l]?Gl.cache[l].push({width:a,height:o,pattern:r}):Gl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Gl.cache={},Gl.ImageSize=[20,40,80,160,320,640,1280,2560];const Yl=new he,Xl=new ue;new he;const $l=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Kl=["x","y"],ql=["scaleX","scaleY"],Zl=["angle"],Jl=new Dt,Ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class th extends sa{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Io[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===((i=t=Lo[t]||t).startsWith("{const e=(new pn).fromString(t.d),i={};vl.forEach((e=>{t[e]&&(i[ml[e]]=t[e])})),n.push({path:e,attribute:i}),Yl.union(e.bounds)}));const r=Yl.width(),a=Yl.height(),o=1/kt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Oo(t,n,!0);return th.userSymbolMap[t]=l,l}var i;const s=(new pn).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/kt(n,r);s.transform(0,0,a,a);const o=new Oo(t,s);return th.userSymbolMap[t]=o,o}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=ba(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 rs(t);return Ts(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ms.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ms.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ms.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&ms.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ms.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vs.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})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:yl;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:ys.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:ys.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:ys.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ms.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ms.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ms.UPDATE_SHAPE_AND_BOUNDS)===ms.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ms.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ms.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ms.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ms.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ms.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ms.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,scaleX:i=mn.scaleX,scaleY:s=mn.scaleY,angle:n=mn.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Mt(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+u*f,S=c*g-l*f,A=u*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*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,!0),Gi.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(mn);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Xl.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:ys.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gi.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new pn).fromString(t):this.pathProxy=new pn,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Gi.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new la(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Gi.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Rl(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var eh;th.userSymbolMap={},th.mixin(da),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(eh||(eh={}));class ih extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rl,this._childUpdateTag=ms.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 Qr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Qr)}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===vs.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&ms.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,dx:i=mn.dx,dy:s=mn.dy,scaleX:n=mn.scaleX,scaleY:r=mn.scaleY,angle:a=mn.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 ea(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Gi.graphicService.updateTempAABBBounds(i),Gi.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&=ms.CLEAR_BOUNDS,this._childUpdateTag&=ms.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ms.UPDATE_BOUNDS||(this._childUpdateTag|=ms.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ms.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=Gi.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new ih(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ih.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function sh(t){return new ih(t)}ih.NOWORK_ANIMATE_ATTR=Ql;class nh extends ih{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 Qr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gi.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=>{Gi.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 rh=Symbol.for("TransformUtil"),ah=Symbol.for("GraphicUtil"),oh=Symbol.for("LayerService"),lh=Symbol.for("StaticLayerHandlerContribution"),hh=Symbol.for("DynamicLayerHandlerContribution"),ch=Symbol.for("VirtualLayerHandlerContribution");var uh,dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ph=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let gh=uh=class{static GenerateLayerId(){return`${uh.idprefix}_${uh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Gi.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?Vi.get(lh):"dynamic"===t?Vi.get(hh):Vi.get(ch),e}createLayer(t,e={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 nh(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:uh.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)}};gh.idprefix="visactor_layer",gh.prefix_count=0,gh=uh=dh([_i(),ph("design:paramtypes",[])],gh);var fh=new ai((t=>{t(Hi).to(Qi).inSingletonScope(),t(Nr).to(zr),t(ah).to(Gr).inSingletonScope(),t(rh).to($r).inSingletonScope(),t(oh).to(gh).inSingletonScope()}));function mh(t,e){return!(!t&&!e)}function vh(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function yh(t,e,i){return i&&t*e>0}function _h(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function bh(t,e){return t*e>0}function xh(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Sh(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,u=-h*o,d=t+c,p=e+u,g=i+c,f=s+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=n-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let w=(S*_-y*A)/b,T=(-S*y-_*A)/b;const k=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=w-m,B=T-v,E=k-m,R=C-v;return M*M+B*B>E*E+R*R&&(w=k,T=C),{cx:w,cy:T,x01:-c,y01:-u,x11:w*(n/x-1),y11:T*(n/x-1)}}function Ah(t,e,i,s,n){const r=At(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,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*Tt(c),w=n*Mt(c),T=s*Tt(d),k=s*Mt(d);let C,M,B,E;if((b>yt||y>yt)&&(C=n*Tt(u),M=n*Mt(u),B=s*Tt(p),E=s*Mt(p),r<_t)){const t=function(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,u=o-r;let d=u*l-c*h;return d*d1?0:R<-1?_t:Math.acos(R))/2),l=Bt(t[0]*t[0]+t[1]*t[1]);S=Ct(b,(s-l)/(o-1)),x=Ct(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:w,xirs:B,yirs:E,xore:C,yore:M,xire:T,yire:k,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function wh(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=At(l-o),c=l>o;let u=!1;if(n=St-yt)e.moveTo(i+n*Tt(o),s+n*Mt(o)),e.arc(i,s,n,o,l,!c),r>yt&&(e.moveTo(i+r*Tt(l),s+r*Mt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:w,outerEndAngle:T,limitedIcr:k,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:R,maxInnerCornerRadius:P}=Ah(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,s+p),u=!0;else if(m>yt){const t=Ct(v,m),r=Ct(y,m),o=Sh(g,f,d,p,n,t,Number(c)),l=Sh(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,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),s+o.cy+m*Mt(wt(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,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,n,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),s+l.cy+r*Mt(wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Mt(T))}else!a||a[0]?(e.moveTo(i+d,s+p),e.arc(i,s,n,w,T,!c)):e.moveTo(i+n*Tt(T),s+n*Mt(T));if(!(r>yt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),u=!0;else if(k>yt){const t=Ct(E,k),n=Ct(R,k),o=Sh(S,A,b,x,r,-n,Number(c)),l=Sh(d,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),k0&&e.arc(i+o.cx,s+o.cy,n,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),s+l.cy+t*Mt(wt(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,B,c):e.moveTo(i+r*Tt(B),s+r*Mt(B))}return a?a[3]&&e.lineTo(i+n*Tt(o),s+n*Mt(o)):e.closePath(),u}const Th=Symbol.for("ArcRenderContribution"),kh=Symbol.for("AreaRenderContribution"),Ch=Symbol.for("GroupRenderContribution"),Mh=Symbol.for("PathRenderContribution"),Bh=Symbol.for("PolygonRenderContribution"),Eh=Symbol.for("RectRenderContribution"),Rh=Symbol.for("SymbolRenderContribution"),Ph=Symbol.for("TextRenderContribution"),Oh=Symbol.for("InteractiveSubRenderContribution");function Ih(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Lh(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var Dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jh=function(t,e){return function(i,s){e(i,s,t)}};function Nh(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:u=i.scaleY,scaleZ:d=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(_l(t),bl(t,t,[n+o,r+l,a+h]),bl(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],u=e[10],d=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+u*s,t[7]=l*n+d*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=u*n-o*s,t[11]=d*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],u=e[10],d=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-u*s,t[3]=l*n-d*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+u*n,t[11]=l*s+d*n}(t,t,p),bl(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,u,d]),f){const i=kl.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]}bl(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],u=e[6],d=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+u*s,t[3]=l*n+d*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=u*n-o*s,t[7]=d*n-l*s}(i,i,f),bl(i,i,[-s[0],-s[1],0]),Sl(t,t,i)}}let Uh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ui(["graphic"]),onSetStage:new Ui(["graphic","stage"]),onRemove:new Ui(["graphic"]),onRelease:new Ui(["graphic"]),onAddIncremental:new Ui(["graphic","group","stage"]),onClearIncremental:new Ui(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ui(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ui(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ui(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new rs(t);return Ts(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=Lh(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=Ih(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,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){Xo(u,(l+h)/Math.abs(n+r),s,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xo(u,o/Math.abs(n+r)*2,!1,c+1),u.translate(s,a),e.union(u)}}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||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uh=Dh([_i(),jh(0,vi(fl)),Fh("design:paramtypes",[Object])],Uh);const zh=(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 Hh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=ts.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;u.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=pl,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 ea(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Wh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Zt(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=Gi.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Xo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Gi.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:u,stroke:d=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Hh(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:w}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(w.xOffset,w.yOffset,w.xOffset+w.width,w.yOffset+w.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}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:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),w=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const T=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:w},C=new Hh(a,k,T),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let R=1/0;if(b>0&&(R=Math.max(Math.floor(b/w),1)),x&&(R=Math.min(R,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=Ih(y,a),e=this.cache.verticalList.length*v,i=Lh(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===qo.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const x=Ih(y,a),S=this.cache.verticalList.length*v,A=Lh(_,S,u);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ba(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Vh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Vh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Wh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Wh.baselineMapAlign}getAlignMapBaseline(){return Wh.alignMapBaseline}}function Gh(t){return new Wh(t)}Wh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ql),Wh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Wh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Yh=["symbolType","size",...$l];let Xh=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=dl}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ea(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}=Gi.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;Xo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Gi.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,Yh)}needUpdateTag(t){return super.needUpdateTag(t,Yh)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new pn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new pn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function $h(t){return new Xh(t)}Xh.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ql);const Kh=["segments","points","curveType","curveTension",...$l];let qh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=ol}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=Ta(i,s,e))}getGraphicTheme(){return ea(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Kh)}needUpdateTag(t){return super.needUpdateTag(t,Kh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new pn;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Zh(t){return new qh(t)}qh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const Jh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Qh=["width","x1","y1","height","cornerRadius",...$l];class tc extends th{constructor(t){super(t),this.type="rect",this.numberType=cl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ea(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}=Gi.graphicService.updateTempAABBBounds(i);return zh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qh)}needUpdateTag(t){return super.needUpdateTag(t,Qh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Jh(e);return t=new pn,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new tc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tc.NOWORK_ANIMATE_ATTR}}function ec(t){return new tc(t)}tc.NOWORK_ANIMATE_ATTR=Ql;class ic{constructor(t,e,i,s,n,r,a,o,l,h,c,u,d,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=Vn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,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}}}function sc(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class nc{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ba(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Qn(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Qn(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=sc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&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=qn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const rc=["width","height","image",...$l];class ac extends th{constructor(t){super(t),this.type="image",this.numberType=al,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 ea(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);return zh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Fn[t]}needUpdateTags(t){return super.needUpdateTags(t,rc)}needUpdateTag(t){return super.needUpdateTag(t,rc)}clone(){return new ac(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ac.NOWORK_ANIMATE_ATTR}}ac.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ql);class oc extends ac{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=ba(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=ba(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=Fn.width,height:e=Fn.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 lc{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 oc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Vn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof nc){const e=$n.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 oc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Qn(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)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||Gn;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,Kn(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Wn;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?Hn(t,s,{AABBBounds:i}):s,Kn(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof oc)break;const{width:n}=Qn(t,s.character,s.ascentDescentMode),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 oc?t.width:t.getWidthWithEllips(this.direction)})),i}}class hc{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=Vn[this.direction]}store(t){if(t instanceof oc){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 lc(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,e=!1){t instanceof oc?"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||this.newLine)&&("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=qn(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 nc(i,t.newLine,t.character,t.ascentDescentMode),new nc(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let cc=!1;try{cc=Intl&&"function"==typeof Intl.Segmenter}catch(t){cc=!1}const uc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...$l];class dc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ul,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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return ea(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&dc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&dc.splitText(t.text).length>1)))}static splitText(t){if(cc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=dc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Gi.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}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;e0&&!dc.AllSingleCharacter(y)&&(y=dc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,w="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),T="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),k=new ic(0,0,(w?n:x?i:0)||0,(T?r:A?s:0)||0,a,o,l,h,c,u||"horizontal",!w&&x,!T&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),C=new hc(k);if(C.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&k.lines[k.lines.length-1].paragraphs.push(s)):C.deal(s,!0),k.lines.length!==t&&(t=k.lines.length,C.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,k.lines[k.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,C.lineWidth=0),C.send()}}else for(let t=0;t<_.length;t++)C.deal(_[t]);if(C.send(),!("horizontal"===k.layoutDirection?w:T)){const t=k.getActualSizeWidthEllipsis();let e="horizontal"===k.layoutDirection?t.width:t.height;("horizontal"===k.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===k.layoutDirection?i:s)),k.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&k.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=k}clone(){return new dc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ql);const gc=["path","customPath",...$l];class fc extends th{constructor(t){super(t),this.type="path",this.numberType=ll}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 pn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pn?this.cache:t.path)}getGraphicTheme(){return ea(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);zh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Gi.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 pn).fromString(t.path):t.customPath&&(this.cache=new pn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){return(new pn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ql);const vc=["segments","points","curveType","curveTension",...$l];class yc extends th{constructor(t){super(t),this.type="area",this.numberType=il}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 ea(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Gi.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=Ta(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new pn;const 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 yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const bc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...$l];class xc extends th{constructor(t){super(t),this.type="arc",this.numberType=tl}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=Nt(e),i=e+r,s&&At(r)yt&&o>yt)return{startAngle:e-n*d*r,endAngle:i+n*d*a,sc:n*d*r,ec:n*d*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=Bt(a*a+o*o)}=this.attribute,h=At(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>yt&&l>yt){const i=e>t?1:-1;let s=Rt(Number(l)/o*Mt(g)),n=Rt(Number(l)/a*Mt(g));return(f-=2*s)>yt?(s*=i,d+=s,p-=s):(f=0,d=p=(t+e)/2),(m-=2*n)>yt?(n*=i,c+=n,u-=n):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return ea(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}=Gi.graphicService.updateTempAABBBounds(i);zh(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Gi.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<=yt?i.set(0,0,0,0):Math.abs(o-l)>St-yt?i.set(-s,-s,s,s):(Aa(l,o,s,i),Aa(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=At(o-a),u=o>a;if(h=St-yt)n.moveTo(0+h*Tt(a),0+h*Mt(a)),n.arc(0,0,h,a,o,!u),l>yt&&(n.moveTo(0+l*Tt(o),0+l*Mt(o)),n.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Mt(a),i=l*Tt(o),s=l*Mt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!u),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,u),n.closePath()}return n}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ql);const Ac=["points","cornerRadius",...$l];class wc extends th{constructor(t){super(t),this.type="polygon",this.numberType=hl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ea(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.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=Ta(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Ac)}needUpdateTag(t){return super.needUpdateTag(t,Ac)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new pn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new wc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wc.NOWORK_ANIMATE_ATTR}}function Tc(t){return new wc(t)}wc.NOWORK_ANIMATE_ATTR=Ql;class kc extends ih{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function Cc(t){return new kc(t)}const Mc=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 Bc,Ec;function Rc(t){return Bc||(Bc=Mc.CreateGraphic("text",{})),Bc.initAttributes(t),Bc.AABBBounds}var Pc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ic=function(t,e){return function(i,s){e(i,s,t)}};class Lc{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=ea(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),u=i.height();let d=c,p=u;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,u/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(d=i*(u/s),p=u):"repeat-y"===n&&(p=s*(c/i),d=c);const r=t.dpr,a=Dr.allocate({width:d,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,d,p),o.drawImage(e,0,0,d,p),e=a.nativeCanvas),Dr.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,u),t.translate(-i.x1,-i.y1)}}}const Dc=new Lc;let Fc=class{constructor(t){this.subRenderContribitions=t,this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,u,d)}))}};Fc=Pc([_i(),Ic(0,vi(Li)),Ic(0,bi(Oh)),Oc("design:paramtypes",[Object])],Fc);const jc=new class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Nc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class Uc{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Dr.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])),Dr.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,St),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,u,d){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){var h;const{textureRatio:c=r.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(o,l,a,i);break;case"diamond":d=this.createDiamondPattern(o,l,a,i);break;case"rect":d=this.createRectPattern(o,l,a,i);break;case"vertical-line":d=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":d=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":d=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":d=this.createGridPattern(o,l,a,i)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=Dr.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),y=g.height(),_=l,b=o,x=d.columns?d.columns:Math.ceil(v/b),S=d.rows?d.rows:Math.ceil(y/b),A=d.gutterColumn?d.gutterColumn:2*_,w=d.gutterRow?d.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=$h({}));const T=d.columns?v/d.columns:b,k=d.rows?y/d.rows:b;this._tempSymbolGraphic.setAttributes({size:[T-A,k-w],symbolType:t});const C=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=T?o:zn(e,o,e.dpr),c=o/C,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+d*h,innerRadius:k-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),wh(t,e,i,s,C+d*h,k-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:k,startAngle:y,endAngle:_})}},Vc=zc,Wc=Dc;const Gc=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:y=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:y}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},Yc=_t/2;function Xc(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=At(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=At(t[0]),l=[e,e,e,e];break;case 2:case 3:e=At(t[0]),i=At(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=At(l[0]),l[1]=At(l[1]),l[2]=At(l[2]),l[3]=At(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,u,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Yc,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Yc,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!K(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Yc,_t,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],_t,_t+Yc,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var $c=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Kc=class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};Kc=$c([_i()],Kc);let qc=class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x: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 Xc(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{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,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};qc=$c([_i()],qc);const Zc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:w,y1:T,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:C,height:M}=t.attribute;C=(null!=C?C:w-i)||0,M=(null!=M?M:T-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=k?h:zn(e,h,e.dpr),d=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*g,M-o*g)):(e.beginPath(),Xc(e,d,p,C-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}},Jc=zc,Qc=Dc;const tu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)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,w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:zn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(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&&w(p,"outerBorder"),m&&w(g,"innerBorder")}},eu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}},iu=zc,su=Dc;const nu={x:0,y:0,z:0,lastModelMatrix:null};class ru{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(jc),this.builtinContributions.push(Nc),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===xs.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xs.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=ea(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=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=yh(u,d,h),_=bh(u,g),b=mh(h),x=vh(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ts(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),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())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}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:u=e.visible}=t.attribute,d=yh(o,l,n),p=bh(o,c),g=mh(n,r),f=vh(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||s||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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,u=i.modelMatrix,d=i.camera;nu.x=n,nu.y=r,nu.z=a,nu.lastModelMatrix=u;const p=d&&(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=kl.allocate(),n=kl.allocate();Nh(n,t,e),Sl(s,u||s,n),nu.x=0,nu.y=0,nu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),kl.free(n)}if(g&&!u){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,nu.z=a,i.setTransformForCurrent()}else if(p)nu.x=0,nu.y=0,nu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,this.transformWithoutTranslate(i,nu.x,nu.y,nu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),nu.x=0,nu.y=0,nu.z=0;return nu}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},u={x:n,y:r};s.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==d&&kl.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}var au=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ou=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lu=function(t,e){return function(i,s){e(i,s,t)}};let hu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=tl,this.builtinContributions=[Hc,Wc,Vc],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(nyt){const t=Ct(b,_),r=Ct(x,_),a=Sh(v,y,f,m,n,t,Number(d)),o=Sh(A,w,T,k,n,r,Number(d));if(_0&&e.arc(i+o.cx,s+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,s+m);if(!(r>yt)||M<.001)e.lineTo(i+T,s+k),p=!0;else if(C>yt){const t=Ct(E,C),n=Ct(R,C),a=Sh(T,k,A,w,r,-n,Number(d)),o=Sh(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,s,r,t,o,d)}}else e.lineTo(i+r*Tt(B),s+r*Mt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=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:w=l.outerRadius,innerRadius:T=l.innerRadius}=t.attribute;w+=b,T-=x;let k=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();At(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)ya[s]=t,i&&(i=!(null!==(e=ya[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ya[e]=!!t[e],i&&(i=!!ya[e]);else ya[0]=!1,ya[1]=!1,ya[2]=!1,ya[3]=!1;return{isFullStroke:i,stroke:ya}})(u);if((y||B)&&(e.beginPath(),wh(t,e,i,s,w,T),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,_,B,v,o),this._runFill(t,e,i,s,l,y,m,d,p,a)):(this._runFill(t,e,i,s,l,y,m,d,p,a),this._runStroke(t,e,i,s,l,_,B,v,o))),!B&&_&&(e.beginPath(),wh(t,e,i,s,w,T,E),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(At(h-r)>=St-yt){e.beginPath();const r=Math.abs(w-T)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,s,w,T,u,u+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const d=()=>{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+=St;for(;i>St;)i-=St;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),Fl(o.color,l.color,h,!1)}(0,0,h,n);a||yh&&(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()))};d(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=k,h.endAngle+=k)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};function cu(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]=Ps(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 uu(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:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+n,o+r,a)}else d&&(h=!s,t.lineTo(d.x+n,d.y+r,a))}return h}function du(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:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((s,n)=>{s.originP1!==s.originP2?(i=uu(t,s,e,i,r,a,o),e=s):e=s}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),cu(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===s?d=_s.ROW:"y"===s?d=_s.COLUMN:"auto"===s&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.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 gu=class extends ru{constructor(){super(...arguments),this.numberType=ol}draw(t,e,i,s){const n=ea(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,u,d,p,g){var f;if(!e)return;t.beginPath();du(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=dn(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){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,u,d,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*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,u,d,n[m],[l,t.attribute],Ct(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,s,t,a,o)}};function fu(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),cu(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),cu(t,l,1,s),o=!1):o=!0}t.closePath()}gu=pu([_i()],gu);const mu=new class extends Uc{constructor(){super(...arguments),this.time=xs.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:ka(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ka(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ka(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ka(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},vu=Dc;var yu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bu=function(t,e){return function(i,s){e(i,s,t)}};let xu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=il,this.builtinContributions=[mu,vu],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(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,u,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)}}d?d(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,u,d,p;const g=ea(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,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,w=S.doStroke&&S.sVisible,{clipRange:T=g.clipRange,closePath:k,points:C,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(k&&"linear"===B&&(B="linearClosed"),1===T&&!M&&!C.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,w,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const s=M.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=dn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[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=M[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(u=s.y1)&&void 0!==u?u:s.y})}i.length>1&&(n=dn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!C||!C.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(C,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=dn(e,B,{curveTension:b}),n=dn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{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===T){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,w,_,r[c],[g,t.attribute],T,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,w,_,r[d],[g,t.attribute],Ct(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,w,_,t.attribute,g,T,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=ea(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,u,d,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=_s.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=At(y.x-b.x),A=At(y.y-b.y);x=null==y.x1?_s.ROW:null==y.y1?_s.COLUMN:Number.isFinite(S+A)?S>A?_s.ROW:_s.COLUMN:_s.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;ou?_s.ROW:_s.COLUMN,Number.isFinite(c)||(o=_s.COLUMN),Number.isFinite(u)||(o=_s.ROW);const d=i*(o===_s.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),du(t,i[0]?e.top:e.bottom,l,x===_s.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,w-h,T-c,o),t.stroke()}})(),!1}};xu=yu([_i(),bu(0,vi(Li)),bu(0,bi(kh)),_u("design:paramtypes",[Object])],xu);const Su=zc,Au=Dc;var wu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ku=function(t,e){return function(i,s){e(i,s,t)}};let Cu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ll,this.builtinContributions=[Au,Su],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:ea(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ts(t.pathShape.commandList,e,i,s,1,1,f);else{Ts((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,_,b,v,y,u,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-s,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-s,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,u,n,a,o)}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cu=wu([_i(),ku(0,vi(Li)),ku(0,bi(Mh)),Tu("design:paramtypes",[Object])],Cu);var Mu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(i,s){e(i,s,t)}};let Ru=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cl,this.builtinContributions=[Zc,Qc,Jc],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:w=l.fillStrokeOrder,drawStrokeWhenZeroWH:T=l.drawStrokeWhenZeroWH}=t.attribute;let{width:k,height:C}=t.attribute;k=(null!=k?k:b-S)||0,C=(null!=C?C:x-A)||0;const M=_h(g,f,k,C,h),B=xh(g,v,k,C,T),E=mh(h,c),R=vh(u,m);if(!t.valid||!y)return;if(!E&&!R)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,C)):(e.beginPath(),Xc(e,i,s,k,C,d,"bevel"!==p));const P={doFill:E,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,R,M,B,l,n,a,o,P),w?(this._runStroke(t,e,i,s,l,P,B,S,A,o),this._runFill(t,e,i,s,l,P,M,S,A,a)):(this._runFill(t,e,i,s,l,P,M,S,A,a),this._runStroke(t,e,i,s,l,P,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,R,M,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Ru=Mu([_i(),Eu(0,vi(Li)),Eu(0,bi(Eh)),Bu("design:paramtypes",[Object])],Ru);var Pu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ou=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Iu=function(t,e){return function(i,s){e(i,s,t)}};let Lu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=dl,this.builtinContributions=[tu,su,iu,eu],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:ea(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:w=l.keepDirIn3d}=t.attribute,T=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let k=i,C=s,M=T;const B=e.camera;if(w&&B&&e.project){const t=e.project(i,s,T);e.camera=null,_(c)&&(c[0],c[1]),k=t.x,C=t.y,M=void 0}!1===A.draw(e,c,k,C,M,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,u,d,A,a)):(this._runFill(t,e,i,s,l,x,y,u,d,A,a),this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-s)/d,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lu=Pu([_i(),Iu(0,vi(Li)),Iu(0,bi(Rh)),Ou("design:paramtypes",[Object])],Lu);const Du=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,s){if(!this.pools.length)return(new he).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 he(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Fu=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:C}=t.attribute;if(!C)return;const M=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let B;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(C)&&C.background,R=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),s=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(m=C.dy)&&void 0!==m?m:0),n=null!==(v=C.width)&&void 0!==v?v:e.width(),r=null!==(y=C.height)&&void 0!==y?y:e.height();if(B=Du.allocate(i,s,i+n,s+r),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(_=C.x)&&void 0!==_?_:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(S=C.dy)&&void 0!==S?S:0),t,e)}}else B=t.AABBBounds,R||(B=Rc(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(C);if("success"!==n.state||!n.data)return void M();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:A,backgroundFit:w,backgroundKeepAspectRatio:T}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=C,n?(Xc(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Du.free(B),M()}};var ju=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uu=function(t,e){return function(i,s){e(i,s,t)}};let zu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pl,this.builtinContributions=[Fu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=ea(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=Ba(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:w,doFill:T,doStroke:k}=S,C=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,T,k,A,w,u,n,a,o),C&&this.transformUseContext2d(t,u,M,e);const B=(n,r,l,h)=>{let c=i+r;const d=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Tl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Tl.free(t)}k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),e.strokeText(n,c,d,M))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),e.fillText(n,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,M)})))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,M),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,M,u,e,{width:n.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:s=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===s?d=-a:"middle"===s&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+d,r,n),r+=s}))}))}C&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,s,T,k,A,w,u,n,a,o)}draw(t,e,i,s){const n=ea(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,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Ih(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}};function Hu(t,e,i,s){if(e&&e.length){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},$u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ku=function(t,e){return function(i,s){e(i,s,t)}};let qu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hl,this.builtinContributions=[Yu,Gu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=ea(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=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))?Hu(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Hu(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],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-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 _=Vu(u,d),b=Vu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Wu(h,y,_,u,d),A=Wu(h,y,b,p,g),w=2*h.x-S.x-A.x,T=2*h.y-S.y-A.y,k=Vu(w,T),C=Wu(h,Vu(y,v),k,w,T);let M=Math.atan2(S.y-C.y,S.x-C.x);const B=Math.atan2(A.y-C.y,A.x-C.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&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,u-i,d-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-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=ea(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};qu=Xu([_i(),Ku(0,vi(Li)),Ku(0,bi(Bh)),$u("design:paramtypes",[Object])],qu);var Zu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 td=class{constructor(t){this.groupRenderContribitions=t,this.numberType=rl}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:ea(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,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,cornerType:w=l.cornerType,x:T=l.x,y:k=l.y}=t.attribute,C=_h(p,m,g,f,c),M=xh(p,v,g,f),B=mh(c,d),E=vh(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(C||M||a||o||d))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,g,f)):(e.beginPath(),Xc(e,i,s,g,f,y,"bevel"!==w));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc));const R={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xs.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o,R)})),h&&e.clip();const P=()=>{R.doFill&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,T-i,k-s,l),e.fill()))},O=()=>{R.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,T-i,k-s,l),e.stroke()))};A?(O(),P()):(P(),O()),this._groupRenderContribitions.forEach((r=>{r.time===xs.afterFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Gi.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=ea(t,null==s?void 0:s.theme).group,i=kl.allocate(),n=kl.allocate();Nh(n,t,e),Sl(i,p||i,n),a.modelMatrix=i,kl.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&kl.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};td=Zu([_i(),Qu(0,vi(Li)),Qu(0,bi(Ch)),Ju("design:paramtypes",[Object])],td);const ed=Symbol.for("IncrementalDrawContribution"),id=Symbol.for("ArcRender"),sd=Symbol.for("AreaRender"),nd=Symbol.for("CircleRender"),rd=Symbol.for("GraphicRender"),ad=Symbol.for("GroupRender"),od=Symbol.for("LineRender"),ld=Symbol.for("PathRender"),hd=Symbol.for("PolygonRender"),cd=Symbol.for("RectRender"),ud=Symbol.for("SymbolRender"),dd=Symbol.for("TextRender"),pd=Symbol.for("RichTextRender"),gd=Symbol.for("GlyphRender"),fd=Symbol.for("DrawContribution"),md=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===el,!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+=St;for(;o<0;)o+=St;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 vd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _d=Symbol.for("DrawItemInterceptor"),bd=new he,xd=new he;class Sd{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){bd.copy(s.dirtyBounds),xd.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,Tl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(bd),s.backupDirtyBounds.copy(xd)),!0}}class Ad{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 wd=class{constructor(){this.order=1,this.interceptors=[new Sd,new kd,new Td,new Ad]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&kl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Md=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bd=function(t,e){return function(i,s){e(i,s,t)}};let Ed=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Ed=Cd([_i(),Bd(0,vi(fd)),Md("design:paramtypes",[Object])],Ed);var Rd=new ai((t=>{t(Wi).to(Ed)}));const Pd=Symbol.for("PickerService"),Od=Symbol.for("GlobalPickerService"),Id=Symbol.for("PickItemInterceptor"),Ld=Symbol.for("PickServiceInterceptor");var Dd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Fd=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Fd=Dd([_i()],Fd);let jd=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=ea(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Tl.allocateByObj(a),d=new Dt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jd=Dd([_i()],jd);let Nd=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}};Nd=Dd([_i()],Nd);let Ud=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=md(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()}};Ud=Dd([_i()],Ud);var zd=new ai(((t,e,i)=>{i(Pd)||(t(Od).toSelf(),t(Pd).toService(Od)),t(Ud).toSelf().inSingletonScope(),t(Id).toService(Ud),t(jd).toSelf().inSingletonScope(),t(Id).toService(jd),t(Nd).toSelf().inSingletonScope(),t(Id).toService(Nd),Fi(t,Id),t(Fd).toSelf().inSingletonScope(),t(Ld).toService(Fd),Fi(t,Ld)})),Hd=new ai((t=>{t(gl).to(Uh),t(fl).toConstantValue(Mc)}));const Vd=Symbol.for("AutoEnablePlugins"),Wd=Symbol.for("PluginService");var Gd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xd=function(t,e){return function(i,s){e(i,s,t)}};let $d=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&&Vi.isBound(Vd)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};$d=Gd([_i(),Xd(0,vi(Li)),Xd(0,bi(Vd)),Yd("design:paramtypes",[Object])],$d);var Kd=new ai((t=>{t(Wd).to($d),function(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).whenTargetNamed(e)}(t,Vd)})),qd=new ai((t=>{Fi(t,zi)})),Zd=new ai((t=>{t(sr).to(nr).inSingletonScope(),Fi(t,sr)})),Jd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Gi.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=or({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()}};tp=Jd([_i(),Qd("design:paramtypes",[])],tp);var ep=new ai((t=>{t(tp).toSelf(),t(lh).toService(tp)}));var ip=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 sp(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 np(t,e,i,s=!1,n=!1){let 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}=sp(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;t{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}=sp(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var op=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hp=function(t,e){return function(i,s){e(i,s,t)}};let cp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):np(e,An.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new le,this.backupDirtyBounds=new le,this.global=Gi.global,this.layerService=Gi.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.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}=Xt(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)}}(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Tl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=ap(e,i,An.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&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Du.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Tl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Du.free(n),Tl.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||Vi.get(ed);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 dp=class extends gu{constructor(){super(...arguments),this.numberType=ol}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=ea(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=yh(d,p,c),y=bh(d,g),_=mh(c),b=vh(u,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())}};dp=up([_i()],dp);var pp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gp=class extends xu{constructor(){super(...arguments),this.numberType=il}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=ea(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=yh(d,u,c),f=mh(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())}};gp=pp([_i()],gp);var fp,mp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yp=function(t,e){return function(i,s){e(i,s,t)}},_p=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"}(fp||(fp={}));let bp=class extends cp{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=fp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ui([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return _p(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:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.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 _p(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return _p(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>_p(this,void 0,void 0,(function*(){if(2!==t.count)yield rp(t,An.zIndex,((i,s)=>{if(this.status===fp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return _p(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return _p(this,void 0,void 0,(function*(){this.rendering&&(this.status=fp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=fp.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 _p(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:()=>_p(this,void 0,void 0,(function*(){yield rp(t,An.zIndex,(t=>_p(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};bp=mp([_i(),yp(0,yi(rd)),yp(1,vi(dp)),yp(2,vi(gp)),yp(3,vi(Li)),yp(3,bi(_d)),vp("design:paramtypes",[Array,Object,Object,Object])],bp);var xp=new ai((t=>{t(Lc).toSelf().inSingletonScope(),t(Uc).toSelf().inSingletonScope(),t(fd).to(cp),t(ed).to(bp),t(ad).to(td).inSingletonScope(),t(rd).toService(ad),Fi(t,Ch),t(Fc).toSelf().inSingletonScope(),Fi(t,Oh),Fi(t,rd),t(wd).toSelf().inSingletonScope(),t(_d).toService(wd),Fi(t,_d)}));function Sp(){Sp.__loaded||(Sp.__loaded=!0,Vi.load(fh),Vi.load(Hd),Vi.load(Rd),Vi.load(zd),Vi.load(Kd),function(t){t.load(qd),t.load(Zd),t.load(ep)}(Vi),function(t){t.load(xp)}(Vi))}Sp.__loaded=!1,Sp();const Ap=Vi.get(Hi);Gi.global=Ap;const wp=Vi.get(ah);Gi.graphicUtil=wp;const Tp=Vi.get(rh);Gi.transformUtil=Tp;const kp=Vi.get(gl);Gi.graphicService=kp;const Cp=Vi.get(oh);Gi.layerService=Cp;class Mp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ri.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Bp{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ri.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=Gi.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Gi.global.getRequestAnimationFrame();this.rafId=t((()=>{Gi.global.devicePixelRatio!==this.dpr&&(this.dpr=Gi.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Gi.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Ep{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gi.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 Rp=new he;class Pp{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ri.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()}));const e=this.pluginService.stage;e&&(e.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&&(Rp.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Rp,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Op;function Ip(){!function(){if(null==Op)try{const t=document.createElement("canvas"),e=t.getContext("2d");Op=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Op&&(Op=!!document.createElement)}catch(t){Op=!1}}();const t=Gi.global&&Gi.global.env;return t?"browser"===t:Op}let Lp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Lp._pluginClasses={};const Dp="white";class Fp extends ih{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:Dp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Qr,this.hooks={beforeRender:new Ui(["stage"]),afterRender:new Ui(["stage"]),afterClearScreen:new Ui(["stage"]),afterClearRect:new Ui(["stage"])},this.global=Gi.global,!this.global.env&&Ip()&&this.global.setEnv("browser"),this.window=Vi.get(Nr),this.renderService=Vi.get(Wi),this.pluginService=Vi.get(Wd),this.layerService=Vi.get(oh),this.graphicService=Vi.get(gl),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:Dp,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ga(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(t=!1){t&&(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:u,beta:d,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(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const w=Lp.getPlugin("DirectionalLight");w&&(this.light=new w(f,m,v));const T={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=T;else{const t=Lp.getPlugin("OrthoCamera");t&&(this.camera=new t(T))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Lp.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 Mp))}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 Bp))}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 Ep))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new le;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Pp,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=Lp.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=Lp.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=Lp.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Vi.get(Nr),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=Vi.get(Pd)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},Np=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 Up=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new he}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}}loadFont(t,e,i){return Np(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};Up=jp([_i()],Up);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},Hp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Vp=class{constructor(){this._uid=ri.GenAutoIncrementId(),this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};Vp=zp([_i(),Hp("design:paramtypes",[])],Vp);var Wp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yp=function(t,e){return function(i,s){e(i,s,t)}};let Xp=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Gi.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 he).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 ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Dt(e.x,e.y),a=ea(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=ea(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,s);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&kl.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!d||t.stage.camera||(n.group=t),Tl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function $p(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,u=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=s}function Kp(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=n.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function eg(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),ag=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},og=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new le;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return ag(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ag(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);og(n[0],s,i),og(n[1],e-s,i)}};let lg=!1;const hg=new ai((t=>{lg||(lg=!0,t(hu).toSelf().inSingletonScope(),t(id).to(hu).inSingletonScope(),t(rd).toService(id),t(Th).toService(Fc),Fi(t,Th))}));let cg=!1;const ug=new ai((t=>{cg||(cg=!0,t(Ru).toSelf().inSingletonScope(),t(cd).to(Ru).inSingletonScope(),t(rd).toService(cd),t(qc).toSelf(),t(Kc).toSelf(),t(Eh).toService(qc),t(Eh).toService(Kc),t(Eh).toService(Fc),Fi(t,Eh))}));let dg=!1;const pg=new ai((t=>{dg||(dg=!0,t(gu).toSelf().inSingletonScope(),t(dp).toSelf().inSingletonScope(),t(od).to(gu).inSingletonScope(),t(rd).toService(od))}));let gg=!1;const fg=new ai((t=>{gg||(gg=!0,t(xu).toSelf().inSingletonScope(),t(sd).to(xu).inSingletonScope(),t(rd).toService(sd),t(kh).toService(Fc),Fi(t,kh),t(gp).toSelf().inSingletonScope())}));let mg=!1;const vg=new ai((t=>{mg||(mg=!0,t(Lu).toSelf().inSingletonScope(),t(ud).to(Lu).inSingletonScope(),t(rd).toService(ud),t(Rh).toService(Fc),Fi(t,Rh))}));let yg=!1;const _g=new ai((t=>{yg||(yg=!0,t(dd).to(zu).inSingletonScope(),t(rd).toService(dd),t(Ph).toService(Fc),Fi(t,Ph))}));let bg=!1;const xg=new ai((t=>{bg||(bg=!0,t(Cu).toSelf().inSingletonScope(),t(ld).to(Cu).inSingletonScope(),t(rd).toService(ld),t(Mh).toService(Fc),Fi(t,Mh))}));let Sg=!1;const Ag=new ai((t=>{Sg||(Sg=!0,t(hd).to(qu).inSingletonScope(),t(rd).toService(hd),t(Bh).toService(Fc),Fi(t,Bh))}));var wg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kg=class extends ru{constructor(){super(),this.numberType=ul,this.builtinContributions=[Fu],this.init()}drawShape(t,e,i,s,n){const r=ea(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=yh(o,l,!0),u=yh(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,u,c,u,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,u,c,u,r,n))}drawIcon(t,e,i,s,n){var r;const a=ea(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=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(),Xc(e,i-t,s-n,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,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=ea(t).richtext;this._draw(t,s,!1,i)}};kg=wg([_i(),Tg("design:paramtypes",[])],kg);let Cg=!1;const Mg=new ai((t=>{Cg||(Cg=!0,t(pd).to(kg).inSingletonScope(),t(rd).toService(pd))}));function Bg(t){const e=[];for(let i=0;iit.getInstance().info(`[VChart log]: ${t}`,...e),Rg=(t,e)=>(u(Og.warnHandler)&&Og.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Pg=(t,e,i)=>{if(!u(Og.errorHandler))throw new Error(t);Og.errorHandler.call(null,t,e)},Og={silent:!1,warnHandler:!1,errorHandler:!1},Ig=Ip(),Lg=Ig&&globalThis?globalThis.document:void 0;function Dg(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ig}function Fg(t){return jg(t)||"mobile-browser"===t}function jg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ng=0;function Ug(){return Ng>=9999999&&(Ng=0),Ng++}function zg(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Hg(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Vg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Wg extends ih{constructor(t,e){super(t),this._skipRenderAttributes=Vg,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(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"},mf=(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 vf extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=ha.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=ha.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||ff(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,u=mf(l[0],l[1]);s.scale=u/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=ha.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=mf(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ff(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!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u: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("pointerleave",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("pointerleave",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=ha.now()-i>this.config.press.time&&mf(s[0],t){Gi.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){if(!this.element)return;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},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bf=[0,0,0];let xf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},vn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_n),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bn),{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Tl.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&&(Tl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=St;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,u=ca);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gl.Set(e,i,s,r,a,g,d,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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[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,e=Gi.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Gi.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:bn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:bn.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&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[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=Hn(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:u=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:zn(this,a,this.dpr),r.strokeStyle=Hn(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(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?this.font=t.font:this.font=se(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Tl.free(t))),this.stack.length=0}};xf.env="browser",xf=yf([_i(),_f("design:paramtypes",[Object,Number])],xf);var Sf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let wf=class extends Ol{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Gi.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new xf(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 Tf(t,e){return new ai((i=>{i(rr).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ar).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}wf.env="browser",wf=Sf([_i(),Af("design:paramtypes",[Object])],wf);const kf=Tf(wf,xf);var Cf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Xp{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=Dr.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 Pf=class{constructor(){this.type="group",this.numberType=rl}contains(t,e,i){return!1}};Pf=Rf([_i()],Pf);const Of=new ai(((t,e,i,s)=>{Of.__vloaded||(Of.__vloaded=!0,t(pf).to(Pf).inSingletonScope(),t(gf).toService(pf),Fi(t,gf))}));Of.__vloaded=!1;var If=Of;const Lf=new ai(((t,e,i,s)=>{i(Ef)||t(Ef).toSelf().inSingletonScope(),i(Pd)?s(Pd).toService(Ef):t(Pd).toService(Ef)}));var Df,Ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Nf=Df=class extends Vp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Df.idprefix}_${Df.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Gi.global,this.viewBox=new he,this.modelMatrix=new ue(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:Df.GenerateCanvasId(),canvasControled:!0};this.canvas=new wf(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 wf({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)}};Nf.env="browser",Nf.idprefix="visactor_window",Nf.prefix_count=0,Nf=Df=Ff([_i(),jf("design:paramtypes",[])],Nf);const Uf=new ai((t=>{t(Nf).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Nf))).whenTargetNamed(Nf.env)}));var zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=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 Wf{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 Gf(t,e=!1){const i=document.createElement("img");if(Gi.global.isImageAnonymous&&(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 Yf=class extends Up{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 Wf(t)}return new he}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 Gf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Gf(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:ri.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(...t){}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}}loadFont(t,e,i){return Vf(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Yf=zf([_i(),Hf("design:paramtypes",[])],Yf);const Xf=new ai((t=>{Xf.isBrowserBound||(Xf.isBrowserBound=!0,t(Yf).toSelf().inSingletonScope(),t(zi).toService(Yf))}));function $f(t,e=!0){$f.__loaded||($f.__loaded=!0,t.load(Xf),t.load(kf),t.load(Uf),e&&function(t){t.load(If),t.load(Lf)}(t))}Xf.isBrowserBound=!1,$f.__loaded=!1;var 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},qf=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 Jf=class extends Xp{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 Rl(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=Kf([_i(),Zf(0,vi(Li)),Zf(0,bi(Gg)),Zf(1,vi(Li)),Zf(1,bi(Id)),Zf(2,vi(Li)),Zf(2,bi(Ld)),qf("design:paramtypes",[Object,Object,Object])],Jf);const Qf=new ai((t=>{Qf.__vloaded||(Qf.__vloaded=!0,Fi(t,Gg))}));Qf.__vloaded=!1;var tm=Qf;class em{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:zn(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nm=function(t,e){return function(i,s){e(i,s,t)}};let rm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};rm=im([_i(),nm(0,vi(id)),sm("design:paramtypes",[Object])],rm);let am=!1;const om=new ai(((t,e,i,s)=>{am||(am=!0,t(Yg).to(rm).inSingletonScope(),t(Gg).toService(Yg))}));var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};um=lm([_i(),cm(0,vi(sd)),hm("design:paramtypes",[Object])],um);let dm=!1;const pm=new ai(((t,e,i,s)=>{dm||(dm=!0,t(Xg).to(um).inSingletonScope(),t(Gg).toService(Xg))}));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},fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mm=function(t,e){return function(i,s){e(i,s,t)}};let vm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sl}};vm=gm([_i(),mm(0,vi(nd)),fm("design:paramtypes",[Object])],vm);let ym=!1;const _m=new ai(((t,e,i,s)=>{ym||(ym=!0,t($g).to(vm).inSingletonScope(),t(Gg).toService($g))}));class bm{constructor(){this.type="glyph",this.numberType=nl}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 xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Am=function(t,e){return function(i,s){e(i,s,t)}};let wm=class extends bm{constructor(t){super(),this.canvasRenderer=t}};wm=xm([_i(),Am(0,vi(gd)),Sm("design:paramtypes",[Object])],wm);let Tm=!1;const km=new ai(((t,e,i,s)=>{Tm||(Tm=!0,t(sf).to(wm).inSingletonScope(),t(wm).toService(sf))}));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};let Mm=class{constructor(){this.type="image",this.numberType=al}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Mm=Cm([_i()],Mm);let Bm=!1;const Em=new ai(((t,e,i,s)=>{Bm||(Bm=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));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},Pm=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)}};let Im=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};Im=Rm([_i(),Om(0,vi(od)),Pm("design:paramtypes",[Object])],Im);let Lm=!1;const Dm=new ai(((t,e,i,s)=>{Lm||(Lm=!0,t(qg).to(Im).inSingletonScope(),t(Gg).toService(qg))}));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)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Um=Fm([_i(),Nm(0,vi(hd)),jm("design:paramtypes",[Object])],Um);let zm=!1;const Hm=new ai(((t,e,i,s)=>{zm||(zm=!0,t(ef).to(Um).inSingletonScope(),t(Gg).toService(ef))}));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},Wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,s){e(i,s,t)}};let Ym=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Ym=Vm([_i(),Gm(0,vi(ld)),Wm("design:paramtypes",[Object])],Ym);let Xm=!1;const $m=new ai(((t,e,i,s)=>{Xm||(Xm=!0,t(Zg).to(Ym).inSingletonScope(),t(Gg).toService(Zg))})),Km=new he;class qm{constructor(){this.type="rect",this.numberType=cl}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:zn(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;Km.setValue(i.x1,i.y1,i.x2,i.y2),Km.expand(-r/2),h=!Km.containsPoint(e)}}return s.highPerformanceRestore(),h}}var Zm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Qm=function(t,e){return function(i,s){e(i,s,t)}};let tv=class extends qm{constructor(t){super(),this.canvasRenderer=t}};tv=Zm([_i(),Qm(0,vi(cd)),Jm("design:paramtypes",[Object])],tv);let ev=!1;const iv=new ai(((t,e,i,s)=>{ev||(ev=!0,t(Jg).to(tv).inSingletonScope(),t(Gg).toService(Jg))}));let sv=!1;const nv=new ai(((t,e,i,s)=>{sv||(sv=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));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)},ov=function(t,e){return function(i,s){e(i,s,t)}};let lv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}};lv=rv([_i(),ov(0,vi(ud)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new ai(((t,e,i,s)=>{hv||(hv=!0,t(Qg).to(lv).inSingletonScope(),t(Gg).toService(Qg))}));var 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};let dv=class{constructor(){this.type="text",this.numberType=pl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dv=uv([_i()],dv);let pv=!1;const gv=new ai(((t,e,i,s)=>{pv||(pv=!0,t(tf).to(dv).inSingletonScope(),t(Gg).toService(tf))})),fv=new ai(((t,e,i,s)=>{i(Jf)||t(Jf).toSelf().inSingletonScope(),i(Pd)?s(Pd).toService(Jf):t(Pd).toService(Jf)}));var mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yv=class extends xf{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};yv.env="node",yv=mv([_i(),vv("design:paramtypes",[Object,Number])],yv);var _v=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let xv=class extends Ol{constructor(t){super(t)}init(){this._context=new yv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}};xv.env="node",xv=_v([_i(),bv("design:paramtypes",[Object])],xv);const Sv=Tf(xv,yv);var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)}};let kv=class extends Vp{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:ri.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xv(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xv({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};kv.env="node",kv=Av([_i(),Tv(0,vi(Hi)),wv("design:paramtypes",[Object])],kv);const Cv=new ai((t=>{t(kv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(kv))).whenTargetNamed(kv.env)}));var Mv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Bv=class extends Up{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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};Bv=Mv([_i()],Bv);const Ev=new ai((t=>{Ev.isNodeBound||(Ev.isNodeBound=!0,t(Bv).toSelf().inSingletonScope(),t(zi).toService(Bv))}));function Rv(t,e=!0){Rv.__loaded||(Rv.__loaded=!0,t.load(Ev),t.load(Sv),t.load(Cv))}Ev.isNodeBound=!1,Rv.__loaded=!1;var Pv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ov=class extends xf{draw(){}createPattern(t,e){return null}};Ov.env="wx",Ov=Pv([_i()],Ov);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},Lv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Dv=class extends Ol{constructor(t){super(t)}init(){this._context=new Ov(this,this._dpr)}release(...t){}};Dv.env="wx",Dv=Iv([_i(),Lv("design:paramtypes",[Object])],Dv);const Fv=Tf(Dv,Ov);var jv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uv=function(t,e){return function(i,s){e(i,s,t)}};class zv{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 Hv=class extends Vp{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new zv}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:ri.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dv(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 Dv({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()}};Hv.env="wx",Hv=jv([_i(),Uv(0,vi(Hi)),Nv("design:paramtypes",[Object])],Hv);const Vv=new ai((t=>{t(Hv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Hv))).whenTargetNamed(Hv.env)}));var 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},Gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yv=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 Xv=class extends Up{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,a){return Yv(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Xv=Wv([_i(),Gv("design:paramtypes",[])],Xv);const $v=new ai((t=>{$v._isWxBound||($v._isWxBound=!0,t(Xv).toSelf().inSingletonScope(),t(zi).toService(Xv))}));function Kv(t,e=!0){Kv.__loaded||(Kv.__loaded=!0,t.load($v),t.load(Fv),t.load(Vv),e&&function(t){t.load(tm),t.load(fv),t.load(om),t.load(pm),t.load(_m),t.load(km),t.load(Em),t.load(Dm),t.load(Hm),t.load($m),t.load(iv),t.load(nv),t.load(cv),t.load(gv)}(t))}$v._isWxBound=!1,Kv.__loaded=!1;var qv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Jv=function(t,e){return function(i,s){e(i,s,t)}};let Qv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};Qv=qv([_i(),Jv(0,vi(id)),Zv("design:paramtypes",[Object])],Qv);let ty=!1;const ey=new ai(((t,e,i,s)=>{ty||(ty=!0,t(nf).to(Qv).inSingletonScope(),t(gf).toService(nf))}));var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class extends qm{constructor(t){super(),this.canvasRenderer=t}};ry=iy([_i(),ny(0,vi(cd)),sy("design:paramtypes",[Object])],ry);let ay=!1;const oy=new ai(((t,e,i,s)=>{ay||(ay=!0,t(lf).to(ry).inSingletonScope(),t(gf).toService(lf))}));class ly extends ru{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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.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:zn(s,n+r,s.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==h&&kl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}var hy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},uy=function(t,e){return function(i,s){e(i,s,t)}};let dy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};dy=hy([_i(),uy(0,vi(od)),cy("design:paramtypes",[Object])],dy);let py=!1;const gy=new ai(((t,e,i,s)=>{py||(py=!0,t(af).to(dy).inSingletonScope(),t(gf).toService(af))}));var fy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vy=function(t,e){return function(i,s){e(i,s,t)}};let yy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};yy=fy([_i(),vy(0,vi(sd)),my("design:paramtypes",[Object])],yy);let _y=!1;const by=new ai(((t,e,i,s)=>{_y||(_y=!0,t(rf).to(yy).inSingletonScope(),t(gf).toService(rf))}));class xy extends ru{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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==h&&kl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}var Sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wy=function(t,e){return function(i,s){e(i,s,t)}};let Ty=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}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 u=e;if(s.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.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:zn(s,n+r,s.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==c&&kl.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),d}};Ty=Sy([_i(),wy(0,vi(ud)),Ay("design:paramtypes",[Object])],Ty);let ky=!1;const Cy=new ai(((t,e,i,s)=>{ky||(ky=!0,t(hf).to(Ty).inSingletonScope(),t(gf).toService(hf))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},By=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ey=function(t,e){return function(i,s){e(i,s,t)}};let Ry=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=pl}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:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=Lh(a,d,n),v=Ih(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==d&&kl.free(s.modelMatrix),s.modelMatrix=d,s.highPerformanceRestore(),g}};Ry=My([_i(),Ey(0,vi(dd)),By("design:paramtypes",[Object])],Ry);let Py=!1;const Oy=new ai(((t,e,i,s)=>{Py||(Py=!0,t(cf).to(Ry).inSingletonScope(),t(gf).toService(cf))}));var Iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dy=function(t,e){return function(i,s){e(i,s,t)}};let Fy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Fy=Iy([_i(),Dy(0,vi(ld)),Ly("design:paramtypes",[Object])],Fy);let jy=!1;const Ny=new ai(((t,e,i,s)=>{jy||(jy=!0,t(of).to(Fy).inSingletonScope(),t(gf).toService(of))}));var Uy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hy=function(t,e){return function(i,s){e(i,s,t)}};let Vy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Vy=Uy([_i(),Hy(0,vi(hd)),zy("design:paramtypes",[Object])],Vy);let Wy=!1;const Gy=new ai(((t,e,i,s)=>{Wy||(Wy=!0,t(uf).to(Vy).inSingletonScope(),t(gf).toService(uf))}));var Yy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$y=function(t,e){return function(i,s){e(i,s,t)}};let Ky=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ul}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ky=Yy([_i(),$y(0,vi(pd)),Xy("design:paramtypes",[Object])],Ky);let qy=!1;const Zy=new ai(((t,e,i,s)=>{qy||(qy=!0,t(df).to(Ky).inSingletonScope(),t(gf).toService(df))})),Jy=Ip();function Qy(){Qy.__loaded||(Qy.__loaded=!0,Mc.RegisterGraphicCreator("arc",Sc),Vi.load(hg),Vi.load(Jy?ey:om))}Qy.__loaded=!1;const t_=Qy;function e_(){e_.__loaded||(e_.__loaded=!0,Mc.RegisterGraphicCreator("area",_c),Vi.load(fg),Vi.load(Jy?by:pm))}e_.__loaded=!1;const i_=e_;function s_(){s_.__loaded||(s_.__loaded=!0,Mc.RegisterGraphicCreator("group",sh))}s_.__loaded=!1;const n_=s_;function r_(){r_.__loaded||(r_.__loaded=!0,Mc.RegisterGraphicCreator("line",Zh),Vi.load(pg),Vi.load(Jy?gy:Dm))}r_.__loaded=!1;const a_=r_;function o_(){o_.__loaded||(o_.__loaded=!0,Mc.RegisterGraphicCreator("path",mc),Vi.load(xg),Vi.load(Jy?Ny:$m))}o_.__loaded=!1;const l_=o_;function h_(){h_.__loaded||(h_.__loaded=!0,Mc.RegisterGraphicCreator("polygon",Tc),Vi.load(Ag),Vi.load(Jy?Gy:Hm))}h_.__loaded=!1;const c_=h_;function u_(){u_.__loaded||(u_.__loaded=!0,Mc.RegisterGraphicCreator("rect",ec),Vi.load(ug),Vi.load(Jy?oy:iv))}u_.__loaded=!1;const d_=u_;function p_(){p_.__loaded||(p_.__loaded=!0,Mc.RegisterGraphicCreator("richtext",pc),Vi.load(Mg),Vi.load(Jy?Zy:nv))}p_.__loaded=!1;const g_=p_;function f_(){f_.__loaded||(f_.__loaded=!0,Mc.RegisterGraphicCreator("shadowRoot",Cc))}f_.__loaded=!1;const m_=f_;function v_(){v_.__loaded||(v_.__loaded=!0,Mc.RegisterGraphicCreator("symbol",$h),Vi.load(vg),Vi.load(Jy?Cy:cv))}v_.__loaded=!1;const y_=v_;function __(){__.__loaded||(__.__loaded=!0,Mc.RegisterGraphicCreator("text",Gh),Vi.load(_g),Vi.load(Jy?Oy:gv))}__.__loaded=!1;const b_=__;function x_(){n_(),d_()}const S_=-.5*Math.PI,A_=1.5*Math.PI,w_="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 T_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(T_||(T_={}));const k_={[T_.selectedReverse]:{},[T_.selected]:{},[T_.hover]:{},[T_.hoverReverse]:{}},C_={container:"",width:30,height:30,style:{}};function M_(){return"browser"===Ap.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const B_={debounce:gt,throttle:ft};x_();class E_ extends Wg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},E_.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=M_(),a="browser"===Ap.env?Ap:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:B_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:ut(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=ut(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",B_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Ap.env?Ap:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(ut(s,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(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]=Ce(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]=ut(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?ut([a+i*n,a+s*n],a,n-l):ut([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=M_(),e="browser"===Ap.env?Ap:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Ap.env?Ap:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}function R_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&R_(t,e)}))}E_.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 P_=t=>!d(t)&&!1!==t.visible;const O_=["#ffffff","#000000"];function I_(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ae(t).toHex(),o=new Ae(e).toHex();return L_(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(...O_);for(const n of a)if(t!==n&&L_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function L_(t,e,i,s,n){if("lightness"===n){const i=Ae.getColorBrightness(new Ae(e));return Ae.getColorBrightness(new Ae(t))<.5?i>=.5:i<.5}return s?D_(t,e)>s:"largeText"===i?D_(t,e)>3:D_(t,e)>4.5}function D_(t,e){const i=F_(t),s=F_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function F_(t){const e=Te(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 j_(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 N_(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 U_(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=Ot(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const z_=(t,e,i,s)=>new ne(Object.assign({defaultFontParams:Object.assign({fontFamily:w_,fontSize:14},s),getTextBounds:i?void 0:Rc,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function H_(t,e,i={}){if(!t)return{width:0,height:0};const s=Rc({text:t,fontFamily:e.fontFamily||i.fontFamily||w_,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 V_(t,e="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 W_(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 G_(t,e="type"){const i=V_(t,e);return"rich"===i?Mc.richtext(W_(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Mc.text(t))}function Y_(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 X_(){n_(),d_(),y_(),g_(),b_()}var $_=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);nh&&(k=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),w=0,T=0;let U=0;"left"===j||"start"===j?U=1:"right"===j||"end"===j?U=-1:"center"===j&&(U=0),U?U<0?(w-=k,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):U>0&&x.setAttribute("x",b[3]):(w-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const z="right"===_||"end"===_,H="left"===_||"start"===_,V=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&U){const t=k-b[1]-b[3],e=I+B,i=1===U?(t-e)/2+B+I/2:b[0]+B-(k/2+e/2-B)+I/2;if(V(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(H&&1!==U){const t=k-b[1]-b[3],e=0===U?-t/2+B/2:-k+b[3]+b[1]+B;if(V(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(z&&-1!==U){const t=k-b[1]-b[3],e=0===U?t/2+B/2:t;if(V(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(T-=C/2,A&&A.setAttribute("y",0)):"bottom"===N?(T-=C,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:W}=a,Y=$_(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:W&&!!s,width:k,height:C,x:w,y:T}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new pn)}this._bgRect=t}this._textShape=O,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},K_.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,u,d,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===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.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))}}K_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const q_={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}},Z_={poptip:j({},q_)};class J_ extends Wg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}n_(),a_();class Q_ extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Q_.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})}}Q_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},n_(),d_();class tb extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tb.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})}}tb.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},n_(),a_(),c_(),y_();class eb extends Wg{getStartAngle(){return zt(this._startAngle)}getEndAngle(){return zt(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eb.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(q(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=Mc.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),E(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=Mc.line;G(i)[0].cornerRadius&&(t=Mc.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"),E(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:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Mc.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+d:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:q(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}}var ib,sb;eb.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"}(ib||(ib={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sb||(sb={}));const nb={[sb.selectedReverse]:{},[sb.selected]:{},[sb.hover]:{},[sb.hoverReverse]:{}},rb={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}}},ab={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ob=Math.sin(Math.PI/10);function lb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cb(t){const e={};return R_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ub(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function db(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 pb(t,e,i){var s;if(hb(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>re(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>re(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ae(n,r)}function gb(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&&!E(s.states)?(s.addState(T_.hover,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(T_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(T_.hoverReverse),t.removeState(T_.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(T_.selected)?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(T_.selectedReverse),t.removeState(T_.selected))})),null):s.name&&!E(s.states)?(s.addState(T_.selected,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(T_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=Mc.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._prepare(),this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(mb)}_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=Mc.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ib.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=Mc.group({x:0,y:0,pickable:!1});t.name=ib.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 u=r.width(),d=r.height();n&&(u=Math.abs(u*Math.cos(n)),d=Math.abs(d*Math.sin(n))),a=Math.max(a,u),o=Math.max(o,d),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=Mc.group({x:0,y:0,pickable:!1});i.name=ib.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Mc.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ib.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=k_;else{const t=this.data[s],e=j({},k_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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=Mc.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ib.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=k_;else{const i=j({},k_,s.state);Object.keys(i).forEach((s=>{u(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&&u(s)&&(e=s(e,i));const n=this._transformItems(e),r=Mc.group({x:0,y:0,pickable:!1});return r.name=`${ib.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=G_(this._getLabelAttribute(t,e,n,i));if(a.name=ib.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=k_;else{const s=j({},k_,this.attribute.label.state);Object.keys(s).forEach((r=>{u(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new K_(Object.assign({},e));i.name=ib.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ub(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&&u(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;At(s[0])>At(s[1])?o=_t/2*(l.x>e.x?1:-1):h=_t/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]?d+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:d+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=u(y)?j({},rb.label.style,y(t,e,i,s)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),u(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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},R_(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&H(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const yb={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&&pb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function _b(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function bb(t,e,i,s,n=!1){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({},wb(t,e.attribute.angle)),{angle:Ab(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({},Tb(t,e.attribute.angle)),{angle:Ab(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=Zt({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 Ab(t=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 wb(t,e=0){let 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=Ab(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 Tb(t,e=0){let 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=Ab(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(E(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=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hb(h),m=lb(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/u,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(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);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 Cb(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 Mb{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=N_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Bb{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-Bb.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Bb.bounceIn(2*t):.5*Bb.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*St/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/St*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*St/e)*.5+1}}static registerFunc(t,e){Bb[t]=e}}function Eb(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Bb.quadIn=Bb.getPowIn(2),Bb.quadOut=Bb.getPowOut(2),Bb.quadInOut=Bb.getPowInOut(2),Bb.cubicIn=Bb.getPowIn(3),Bb.cubicOut=Bb.getPowOut(3),Bb.cubicInOut=Bb.getPowInOut(3),Bb.quartIn=Bb.getPowIn(4),Bb.quartOut=Bb.getPowOut(4),Bb.quartInOut=Bb.getPowInOut(4),Bb.quintIn=Bb.getPowIn(5),Bb.quintOut=Bb.getPowOut(5),Bb.quintInOut=Bb.getPowInOut(5),Bb.backIn=Bb.getBackIn(1.7),Bb.backOut=Bb.getBackOut(1.7),Bb.backInOut=Bb.getBackInOut(1.7),Bb.elasticIn=Bb.getElasticIn(1,.3),Bb.elasticOut=Bb.getElasticOut(1,.3),Bb.elasticInOut=Bb.getElasticInOut(1,.3*1.5),Bb.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Bb.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Bb.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Bb[`flicker${t}`]=e=>Eb(e,t);for(let t=2;t<10;t++)Bb[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Rb(t,e,i){return t+(e-t)*i}const Pb=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Rb(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Rb(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Rb(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Rb(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Rb(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Rb(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Rb(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Rb(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Rb(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Fl(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Nl(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Fl(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Nl(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Rb(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Rb(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Rb(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Rb(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Rb(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Ta(e,i,s),r.addUpdateBoundTag()}}};function Ob(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Bb[s])&&void 0!==n?n:Bb.linear:Bb.linear,"wait"===t&&(this.onUpdate=Ib),this.id=ri.GenAutoIncrementId(),this.syncAttributeUpdate=Ib}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Ll.Get(i,Il.Color255),r=Ll.Get(s,Il.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Pb["fill"===e?"fillPure":"strokePure"])}else Pb[e]?t.push(Pb[e]):t.push(Ob)}else Pb[e]?t.push(Pb[e]):t.push(Ob)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}const Db=new Xi;class Fb{constructor(){this.released=!1}tick(t,e){Db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class jb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===es.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=es.INITIAL,Gi.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),Gi.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Fb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==es.INITIAL&&(this.status=es.PAUSE,!0)}resume(){return this.status!==es.INITIAL&&(this.status=es.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=es.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===es.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===es.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Ub.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&u(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:Ub.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&u(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+d*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=d*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,d;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:w=0,options:T,custom:k,customType:C,controlOptions:M}=t,B=e.animate();B.priority=w;const E=u(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,R=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],P=null===(l=e.context)||void 0===l?void 0:l.indexKey;R&&P&&(i=null!==(h=R[P])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),this._handleRunAnimate(B,k,C,D,L,_,m,f,M,T,p,e);let F=0;x&&(F=x*(s-i-1));const j=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return j>0&&(F+=j),F>0&&B.wait(F),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,d){var p,g,f,m,v,y;if(e&&i){const c=Object.assign({width:(null===(p=d.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=d.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,d)),_=u(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(y=null===(v=d.context)||void 0===v?void 0:v.data)||void 0===y?void 0:y[0],d,c):h;c.options=_,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;d||(u||(u=this.createPropsFromChannel(a,i)),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i)),p=u.from);const g=null!==(n=t.custom)&&void 0!==n?n:Ub.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,d,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ss.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Ub.builtInAnimateMap={};class zb extends Lb{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Hb extends zb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Vb{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Ub(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Wb(t){return new Vb(t)}class Gb extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Yb=1e3,Xb="quadInOut",$b=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Kb=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=Fl(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},qb=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?tg(t):[],n=tg(e);i&&s&&(i.fromTransform&&eg(s,i.fromTransform.clone().getInverse()),eg(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Jb=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Qb=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Jb.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Ll.Get(t,Il.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class tx extends zb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;qb(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Kb(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ex=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Zb(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Qb(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new tx({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Yb,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Xb);return c.play(u),c};class ix extends zb{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;qb(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Kb(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const sx=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>$b.includes(t))(i)||(e[i]=t[i])})),e},nx=(t,e,i)=>{const s=sx(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=Gi.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},rx=(t,e,i)=>{const s=[],n=i?null:sx(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:sx(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Jh(t.attribute),n=sg(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Gi.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=sg(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Gi.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=sg(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(Gi.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ng(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ng(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Gi.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:rg(i)}];const s=[];return og(i,e,s),s})(t,e).forEach((t=>{s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return og(l,e,h),h})(t,e).forEach((t=>{s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=tg(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(Gi.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&nx(t,s,e),s};class ox extends zb{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let u=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(u=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[u,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}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=wa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cx extends lx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ux extends hx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const dx=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class px extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class gx extends px{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=dx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class fx extends px{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class mx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class vx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const yx=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class _x extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=yx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const xx=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class Sx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>wa(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class Ax extends Sx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:xx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Tx extends Sx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:xx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const kx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class Cx extends Sx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:kx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Mx extends Sx{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:kx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Bx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class Ex extends Sx{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Bx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Rx extends Sx{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Bx(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const Px=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class Ox extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ix extends Ox{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Px(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class Lx extends Ox{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const Dx=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class Fx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Dx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class jx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Nx extends Hb{onBind(){var t;const e=Wb(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class Ux extends Hb{onBind(){const t=Wb(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function zx(){n_(),a_(),g_(),b_(),Ub.registerBuiltInAnimate("axisEnter",Nx),Ub.registerBuiltInAnimate("axisUpdate",Ux)}var Hx=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=Mc.group({zIndex:999});e.name=ib.axisBreak,e.id=this._getNodeId(`${ib.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},ab,s),a=null!==(e=r.size)&&void 0!==e?e:ab.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=Mc.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ib.axisBreakSymbol;const h=Mc.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ib.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=Mc.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ib.background,n.id=this._getNodeId("background"),n.states=j({},nb,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=Hx(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];E(l)||(c.state={line:j({},nb,l),symbol:j({},nb,l)});const u=new eb(c);u.name=ib.line,u.id=this._getNodeId("line"),t.add(u)}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:u}=s,p=Hx(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),w=this.getVerticalVector(x,!1,{x:0,y:0});let T,k,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=U_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;k=1==-1*t?"bottom":"top"}else T=this.getTextAlign(w),k=this.getTextBaseline(w,!1);let M=u;if(d(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 B=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:M,textStyle:Object.assign({textAlign:T,textBaseline:k},a),state:{text:j({},nb,c.text),shape:j({},nb,c.shape),panel:j({},nb,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}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 wb(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Tb(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),u=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-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=s.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-n}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,s,this);else{if(c)!function(t,e){if(E(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)})),Sb(i,t),!xb(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=hb(a),l=lb(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Cb(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=Ct(c,i))}}else{if(l){const i=Cb(e.attribute.y,null===(u=t[s+1])||void 0===u?void 0:u.attribute.y,null===(d=t[s-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Ct(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(E(t))return;const i=t.filter(_b);if(E(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=u(n)?n:yb[n]||yb.parity;if(s.length>=3&&gb(s,r)){do{s=a(s,r)}while(s.length>=3&&gb(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);pb(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),bb(l,s,n,(t=>pb(t,l,r))),bb(h,s,o,(t=>pb(t,h,r)||!(!n||t===l)&&pb(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=Mc.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ib.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,u=null!==(i=o.space)&&void 0!==i?i:4;let d=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=H_(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=Ce(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}release(){super.release(),this._breaks=null}}Vx.defaultAttributes=rb,W(Vx,Mb);const Wx=t=>t.map(((t,e)=>({index:e,value:t}))),Gx=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(u+=jt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=z_(a),y=t.range();let _=[];for(let i=0;i{$x[t]=!0}));const Qx=t=>-Math.log(-t),tS=t=>-Math.exp(-t),eS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,iS=t=>10===t?eS:t===Math.E?Math.exp:e=>Math.pow(t,e),sS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),nS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),rS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function aS(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 oS(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function lS(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function hS(t,e,i,s){return 1===i&&(i=0),lS(t,i,s)*(e/(1-i))}function cS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function uS(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]{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 pS{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=cS(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 d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(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 gS=Symbol("implicit");class fS extends pS{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=Xx.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=gS}clone(){const t=(new fS).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!==gS)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 mS(t,e,r,n)}class yS extends fS{constructor(t){super(),this.type=Xx.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=hS(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:vS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return vS(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=dt(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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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 yS(!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:_S}=ke;function bS(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=Ae.parseColorString(e)){const e=_S(Ae.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof we?_S(t,e):e instanceof Ae?_S(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 xS extends pS{constructor(t=Jx,e=Jx){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Jx,this._piecewise=oS,this._interpolate=bS}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=dt(i[0],i[r-1])),this._piecewise=r>2?uS:oS,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:Jx),this.rescale(i)):this._clamp!==Jx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const SS=Math.sqrt(50),AS=Math.sqrt(10),wS=Math.sqrt(2),TS=[1,2,5,10],kS=(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=ES(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?MS(0,-(e-1)/s,s):MS((e-1)/s,0,s)},CS=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 kS(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return kS(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=MS(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=MS(t,e,l);return n&&r.reverse(),r})),ES=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=TS[0];return i>=SS?s=TS[3]:i>=AS?s=TS[2]:i>=wS&&(s=TS[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function RS(t,e,i){const s=(e-t)/Math.max(0,i);return ES(s)}function PS(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;e0;){if(s=RS(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function IS(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 LS=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),DS=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=s-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}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})),FS=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=BS(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?LS(t,e,n):LS(t,e,dS(n)),h=LS(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),jS=ht(((t,e,i,s,n)=>PS(s(t),s(e),i).map((t=>dS(n(t))))));class NS extends xS{constructor(){super(...arguments),this.type=Xx.Linear}clone(){var t;const e=new NS;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return CS(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(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=BS(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(t=10){const e=this.calculateVisibleDomain(this._range);return PS(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 zS(t){return e=>-t(-e)}function HS(t=Number.EPSILON){return e=>Math.max(e,t)}class VS extends xS{constructor(){super(sS(10),iS(10)),this.type=Xx.Log,this._limit=HS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new VS).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=sS(this._base),s=iS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=zS(i),this._pows=zS(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=Qx,this.untransformer=tS):(this._logs=i,this._pows=s,this._limit=HS(),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 Jx}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return DS(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FS(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jS(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(VS,US);class WS extends NS{constructor(){super(nS(1),rS(1)),this.type=Xx.Symlog,this._const=1}clone(){return(new WS).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=nS(t),this.untransformer=rS(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return DS(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return FS(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return jS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(WS,US);class GS{constructor(){this.type=Xx.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!d(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 GS).domain(this._domain).range(this._range).unknown(this._unknown)}}function YS(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 XS(t,e,i,s,n=!1){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,n,r;if(!Kx(t.type))return Wx(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return Wx([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=YS(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=YS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(s=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=u(e.tickMode)?e.tickMode:void 0;m=YS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:n}):t.ticks(e,{noDecimals:d,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=Yx(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=Yx(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?KS.greedy:KS.parity;for(;l.length>=3&&gb(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;pb(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),XS(t,l,a,(e=>pb(e,t,i))),XS(n,l,o,(e=>pb(e,n,i)||!(!a||e===t)&&pb(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return Wx(m)},KS={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&pb(i,t,e)||(i=t,0))))}},qS=(t,e,i,s)=>{const n=Yx(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},ZS=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,JS=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?Wx([s[s.length-1]]):Wx([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=u(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=qS(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=tA(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=qS(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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+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 d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!s){o=d;break}{const s=t.length-1;let n,r=0;n=t.length%d>0?t.length-t.length%d+d:t.length;do{if(n-=d,n!==s&&!ZS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?JS(e[n-d],e[n]):t,u=Math.abs(t-c);if(u~~(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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,u=a;for(;u>=n;--u)if(o=u*t+s,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&eA[31&o]&iA[1+(31&l)])return!0}else{if(i[h]&eA[31&o])return!0;if(i[c]&iA[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,u;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,eA[31&o]&iA[1+(31&l)]);else for(s(h,eA[31&o]),s(c,iA[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,iA[31&a]|eA[1+(31&o)]);else for(n(l,iA[31&a]),n(h,eA[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 nA(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ct(i,-o,t.width+l),u=ct(s,-o,t.width+l),d=ct(n,-a,t.height+h),p=ct(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function rA(t,e,i=!1){return i?nA(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function aA(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=rA(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=nA(t,r)),e.getRange(r)))}function oA(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return oA(t,e,n,o,h,c,l)}return!1}var d;if("moveY"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return oA(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return oA(t,e,n,s,h,c)}return!1}const hA=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],cA=["top","inside-top","inside"];function uA(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=s,d=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const dA={mode:"same-time",duration:300,easing:"linear"};function pA(t){return 3===t||4===t}function gA(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 fA=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 mA(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)}}var vA=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const bA=(t,e)=>Math.ceil(t)>Math.floor(e),xA=([t,e],[i,s])=>s>t&&e>i;function SA(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 AA=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||E(e.states)||(e.addState(T_.hover,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(T_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(R_(this,(t=>{E(t.states)||(t.removeState(T_.hoverReverse),t.removeState(T_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void R_(this,(t=>{E(t.states)||(t.removeState(T_.selectedReverse),t.removeState(T_.selected))}));E(e.states)||(e.addState(T_.selected,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(T_.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)===ys.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===ys.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($t(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,u=s+o,d=n+l,p=r+h,g=d-c,f=p-u;return[mA(g,f,c,u,a,o),mA(-g,-f,d,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Mc.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new pn)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(u(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=u(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),u(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return G_(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=u(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=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&&bA(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&bA(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,u(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(SA([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:u=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])&&!xA([d(n),p(n)],[d(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),d=o-(t+s);if(di){const e=t-(a-d),i=l(n)-e;Math.abs(i)<=u&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(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)<=u&&Math.abs(h)<=u&&(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},h),{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(rA(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(rA(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(rA(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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,u=(null==n?void 0:n.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,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{TA[t]=e};var CA=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{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,u=(e.y1+e.y2)/2;let d=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":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(s+g)+Math.sign(d)*(l/2),y:u+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}MA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const BA=()=>{kA("symbol",MA),kA("line-data",MA)};var EA=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{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,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(e,i);let d=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")?d=g?1:-1:i.includes("right")&&(d=g?-1:1),i){case"top-right":case"bottom-right":d=-1;break;case"top-left":case"bottom-left":d=1}return{x:c+d*s+d*l/2,y:u+p*s+p*h/2}}}RA.tag="rect-label",RA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var PA=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};OA.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const IA=()=>{kA("line",OA),kA("area",OA)};var LA=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=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=Ut(c,h.outerRadius,o),f=Ut(c,a+e.line.line1MinLength,o),m=new DA(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=Ut(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):pA(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));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,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-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?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=Ut(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=pA(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=pA(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=pA(d)?-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):u.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?d(h)||"auto"===h?"edge"===c?pA(t.quadrant)?"left":"right":pA(t.quadrant)?"right":"left":h:d(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,d)}else if(-1!==u&&-1===d){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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(pA(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,d))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 UA(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Ft.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 zA(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=db(t,!!n),o=db(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=UA(e,t,!1,!!n),o=UA(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=db(t,!!n),o=db(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}NA.defaultAttributes={pickable:!1};class HA extends Wg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.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 ub(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?`${ib.grid}-sub`:`${ib.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=db(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=UA(t,o,!1,!!a)}const d=Mc.path(Object.assign({path:c,z:l},u(r)?j({},this.skipDefault?null:HA.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${n}`),e.add(d)})),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,d=n[1].y-n[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+d*g});const f=db(o,!!a),m=At(o[0].x-o[1].x),v=At(o[0].y-o[1].y),y=Mc.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*_t/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?j({},this.skipDefault?null:HA.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),u=!at(a.value,1)&&!at(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.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}}HA.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},n_(),l_();class VA extends HA{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},HA.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=S_,endAngle:r=A_}=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 WA(){n_(),y_(),b_()}W(VA,Mb);const GA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};WA();class YA extends Wg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},YA.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(JA.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(JA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===JA.focus||"focus"===o){const s=a.hasState(qA.focus);a.toggleState(qA.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[qA.unSelected,qA.unSelectedHover,qA.focus],t),this._setLegendItemState(e,qA.selected,t)})):(this._setLegendItemState(a,qA.selected,t),this._removeLegendItemState(a,[qA.unSelected,qA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qA.selected,qA.selectedHover,qA.focus],t),this._setLegendItemState(e,qA.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(qA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(qA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ZA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[qA.selected,qA.selectedHover],t),this._setLegendItemState(a,qA.unSelected,t)):(this._setLegendItemState(a,qA.selected,t),this._removeLegendItemState(a,[qA.unSelected,qA.unSelectedHover],t))}else this._setLegendItemState(a,qA.selected,t),this._removeLegendItemState(a,[qA.unSelected,qA.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qA.selected,qA.selectedHover],t),this._setLegendItemState(e,qA.unSelected,t))}))}this._dispatchLegendEvent(ZA.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,qA.selected),this._removeLegendItemState(e,[qA.unSelected,qA.unSelectedHover])):(this._removeLegendItemState(e,[qA.selected,qA.selectedHover]),this._setLegendItemState(e,qA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=XA,spaceRow:l=$A,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:w}=this._itemContext,T=0,k=0;const C=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(s)&&(f&&a?(w=Math.ceil((S+g)/s),b=w>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||C.forEach((t=>{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),w+=1,S=0,A+=k+l,k=0,C.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,k=Math.max(k,m),C.push(i)):(p(v)&&(f&&a?(w=Math.ceil((A+m)/v),b=w>1):v<=m?(w+=1,b=!0,A=0,t>0&&(S+=T+o)):v{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=w,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=w),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=Mc.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._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(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:s.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-u)),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:u,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),w=this._handleStyle(b,t,e,i,s),T=this._handleStyle(x,t,e,i,s),k=Ce(c);let C;!1===x.visible?(C=Mc.group({x:0,y:0,cursor:null===(n=T.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,JA.item,t,C)):(C=Mc.group(Object.assign({x:0,y:0},T.style)),this._appendDataToShape(C,JA.item,t,C,T.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?qA.selected:qA.unSelected);const M=Mc.group({x:0,y:0,pickable:!1});C.add(M);let B,E=0,P=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);P=_(i)?i[0]||0:i,O=R(v,"space",8);const s=Mc.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,JA.itemShape,t,C,S.state),s.addState(e?qA.selected:qA.unSelected),M.add(s)}let I=0;if(u){const e=R(g,"size",10);B=Mc.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:k},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,JA.focus,t,C),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=G_(Object.assign(Object.assign({x:P/2+O,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,JA.itemLabel,t,C,A.state),D.addState(e?qA.selected:qA.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",u?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=G_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,JA.itemValue,t,C,w.state),r.addState(e?qA.selected:qA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-k[1]-k[3]-P-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-k[1]-k[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));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-k[1]-k[3]-P-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const j=M.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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 U=j.height(),z=p(this.attribute.item.width)?this.attribute.item.width:N+k[1]+k[3],H=this._itemHeightByUser||U+k[0]+k[2];return C.attribute.width=z,C.attribute.height=H,B&&B.setAttribute("visible",!1),M.translateTo(-j.x1+k[3],-j.y1+k[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 YA(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 YA(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 E_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new E_(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=XA,spaceRow:o=$A}=n,l=this._itemsContainer,{space:h=KA,defaultCurrent:c=1}=r,u=tw(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(u),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&&e>0&&(_=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(u),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{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Mc.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"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=XA,spaceRow:a=$A}=s,o=this._itemsContainer,{space:l=KA,defaultCurrent:h=1}=n,c=tw(n,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-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(u){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=Mc.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(u?g:f,u?"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=Mc.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(qA.selected)?this._setLegendItemState(t,qA.selectedHover,e):this._setLegendItemState(t,qA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===JA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ZA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(qA.unSelectedHover)||t.hasState(qA.selectedHover))&&(i=!0),t.removeState(qA.unSelectedHover),t.removeState(qA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(qA.unSelectedHover)&&!t.hasState(qA.selectedHover)||(i=!0),t.removeState(qA.unSelectedHover),t.removeState(qA.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===JA.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ZA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ZA.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!==JA.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ZA.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!==JA.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ZA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(qA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},ew,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(qA.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(u(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]&&(u(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()}};iw.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:XA,spaceRow:$A,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:KA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const sw=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(d)?void 0:j({},...i),key:s.every(d)?void 0:j({},...s),value:n.every(d)?void 0:j({},...n)})},nw=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}},rw={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:w_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new he).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},aw=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];n_(),d_(),y_(),b_(),g_();let ow=class t extends Wg{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 u=Ce(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},d.shape,{visible:P_(d)&&P_(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:P_(d)&&P_(d.value)},nw(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:P_(d)&&P_(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:P_(d)&&P_(d.value)},nw(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},C_),d.value),visible:P_(d)&&P_(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=P_(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=n.width-u[3]-u[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",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=P_(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!P_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=n.shape.size+n.shape.spacing;let d="right"===c?(o?u:0)+(P_(n.key)?r+n.key.spacing:0)+(P_(n.value)?a:0):0;this._createShape("right"===c?d-n.shape.size/2:d+n.shape.size/2,n,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(n,h,l);g&&(Y_(c,g,n.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+n.key.spacing:d+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:P_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),Y_(c,f,t,d,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(P_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ba(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(P_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},nw(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},nw(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},C_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(P_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},nw(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},nw(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=>aw.includes(t)))?(this._mergeAttributes(e,s),d(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,u=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?u-=i+n:"middle"===l?u-=i/2:u+=n,c+e>h.x2&&(c-=e+s),u+i>h.y2&&(u-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&P_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=P_(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=z_(u),y=z_(d);let _=0;if(P_(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(P_(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&Io[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return sw({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return sw({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function lw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function hw(t,e){const i=cw(t),s=cw(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 cw(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function uw(t,e,i){let s=!1;if(e&&u(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}ow.defaultAttributes=rw;function dw(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}}function pw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&pw(t[i],e)}}var gw,fw,mw;function vw(t){var e,i;const{type:s}=t;return s===fw.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(gw||(gw={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(fw||(fw={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(mw||(mw={}));const yw={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},_w={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function bw(t,e){var i;if(!t)return[];const s=Cw(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?Tw(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>ww(i)?Sw(t,i,e):i)).filter(p)}))):i.map((i=>ww(i)?Sw(t,i,e):i)).filter(p):[]}return[]}function xw(t,e){var i,s;return Tw(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?u(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 Sw(t,e,i){var s;const n=Cw(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=yw[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=_w[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new Ae(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ge(t,i,s),a=pe(n,r,e.l),l=new Ae(`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 Aw=(t,e)=>{if(e&&ww(t)){const i=Sw(e,t);if(i)return i}return t};function ww(t){return t&&"palette"===t.type&&!!t.key}function Tw(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function kw(t){return _(t)?{dataScheme:t}:t}function Cw(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=vw(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 Mw extends fS{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(!Tw(this._range))return void super.range(this._range);const t=xw(this._range,this._domain);super.range(t)}}const Bw={linear:NS,band:yS,point:class extends yS{constructor(t){super(!1),this.type=Xx.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:fS,threshold:GS,colorOrdinal:Mw};function Ew(t){const e=Bw[t];return e?new e:null}function Rw(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 Pw(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Ow(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Iw(t){return!!y(t)&&(!!t.endsWith("%")&&zg(t.substring(0,t.length-1)))}function Lw(t){return!!g(t)&&("percent"in t||"offset"in t)}function Dw(t,e,i,s=0){var n,r;return S(t)?t:Iw(t)?Number(t.substring(0,t.length-1))*e/100:u(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 Fw(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]=Dw(t[s],e.size,i)}))})),o}function jw(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}}function Nw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||Iw(t)||u(t)||Lw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function Uw(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const zw=(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},Hw=[{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"]}];function Vw(t,e){return t&&e.key in t?t[e.key]:e.default}function Ww(t){return t&&"token"===t.type&&!!t.key}const Gw={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%"},Yw={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:Hw,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"}}},token:Gw,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},Xw={name:"dark",colorScheme:{default:{dataScheme:Hw,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}}}}}},$w=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),$w(t[s],e.slice(1),i))};function Kw(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=kw(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)})}qw._charts={},qw._series={},qw._components={},qw._graphicComponents={},qw._marks={},qw._regions={},qw._animations={},qw._implements={},qw._chartPlugin={},qw._vChartPlugin={},qw._componentPlugin={},qw.transforms={fields:Ve,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}},qw.dataParser={csv:(t,e={},i)=>(i.type=He.DSV,Ze(t)),dsv:(t,e={},i)=>{i.type=He.DSV;const s=Ne(Qe,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return qe(n).parse(t)},tsv:(t,e={},i)=>(i.type=He.DSV,Je(t))},qw._layout={},qw._grammarTransforms={},qw._stageEventPlugins={},qw.registerStageEventPlugin=(t,e)=>{qw._stageEventPlugins[t]=e},qw.getStageEventPlugin=t=>qw._stageEventPlugins[t],qw._interactionTriggers={},qw.registerInteractionTrigger=(t,e)=>{qw._interactionTriggers[t]=e},qw._composedEventMap={},qw.registerComposedEvent=(t,e)=>{qw._composedEventMap[t]=e},qw._tooltipProcessors={},qw.registerTooltipProcessor=(t,e)=>{qw._tooltipProcessors[t]=e},qw.createTooltipProcessor=(t,e)=>{const i=qw._tooltipProcessors[t];return i?new i(e):null};const Qw=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};Qw();const tT={[Yw.name]:Yw},eT=Yw.name,iT=new Map(Object.keys(tT).map((t=>[t,tT[t]]))),sT=new Map,nT=new Map(Object.keys(tT).map((t=>[t,t===eT]))),rT=(t,e)=>{if(!t)return;const i=hT(e);iT.set(t,i),nT.set(t,!0)},aT=(t=eT)=>(nT.has(t)&&!nT.get(t)&&rT(t,iT.get(t)),iT.get(t)),oT=t=>iT.delete(t)&&sT.delete(t)&&nT.delete(t),lT=t=>!!y(t)&&iT.has(t),hT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:eT;return Zw({},aT(i),t)};class cT{static registerInstance(t){cT.instances.set(t.id,t)}static unregisterInstance(t){cT.instances.delete(t.id)}static getInstance(t){return cT.instances.get(t)}static instanceExist(t){return cT.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return cT.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}cT.instances=new Map;class uT{static registerTheme(t,e){rT(t,e)}static getTheme(t,e=!1){return aT(t)}static removeTheme(t){return oT(t)}static themeExist(t){return lT(t)}static getDefaultTheme(){return uT.themes.get(eT)}static setCurrentTheme(t){uT.themeExist(t)&&(uT._currentThemeName=t,cT.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return uT.getTheme(uT._currentThemeName,t)}static getCurrentThemeName(){return uT._currentThemeName}}function dT(t){return y(t)?uT.themeExist(t)?uT.getTheme(t):{}:g(t)?t:{}}uT.themes=iT,uT._currentThemeName=eT;const pT=["animationThreshold","colorScheme","name","padding"];function gT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];pT.includes(n)?s[n]=r:m(r)?ww(r)?s[n]=Aw(r,e):Ww(r)?s[n]=Vw(i,r):s[n]=gT(r,e,i):s[n]=r})),s}function fT(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]=fT(t[s],e)}return i}return _(t)?t.map((t=>fT(t,e))):t}function mT(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]=mT(t[s],e)}return i}return _(t)?t.map((t=>mT(t,e))):t}const vT=(t,e,i,s)=>((t,e,i)=>z_(t,e,i,{fontFamily:Gw.fontFamily,fontSize:Gw.fontSize}))(e,i,s).measure(t),yT="__VCHART",_T=500,bT=500,xT=`${yT}_MEASURE_CANVAS_ID`,ST=`${yT}_DEFAULT_DATA_INDEX`,AT=`${yT}_DEFAULT_DATA_KEY`,wT=`${yT}_DEFAULT_DATA_SERIES_FIELD`,TT=`${yT}_DEFAULT_SERIES_STYLE_NAME`,kT=`${yT}_STACK_KEY`,CT=`${yT}_STACK_START`,MT=`${yT}_STACK_END`,BT=`${yT}_STACK_START_PERCENT`,ET=`${yT}_STACK_END_PERCENT`,RT=`${yT}_STACK_START_OffsetSilhouette`,PT=`${yT}_STACK_END_OffsetSilhouette`,OT=`${yT}_STACK_TOTAL`,IT=`${yT}_STACK_TOTAL_PERCENT`,LT=`${yT}_STACK_TOTAL_TOP`,DT=`${yT}_STACK_TOTAL_BOTTOM`,FT=`${yT}_MOSAIC_VALUE_START_PERCENT`,jT=`${yT}_MOSAIC_VALUE_END_PERCENT`,NT=`${yT}_MOSAIC_CAT_START_PERCENT`,UT=`${yT}_MOSAIC_CAT_END_PERCENT`,zT=`${yT}_SEGMENT_START`,HT=`${yT}_SEGMENT_END`,VT=`${yT}_KEY`;function WT(t,e){for(let i=0;it.key===e))}function YT(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 XT(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:{}},JT(t,a,n[o],l,e,r))})),s?$T(n):n}function $T(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))):$T(t[e].nodes);return t}function KT(t,e){if("values"in t&&t.values.length){const i=lw(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,ET);t.values.forEach((t=>{t[OT]=i,t[IT]=s}))}else for(const i in t.nodes)KT(t.nodes[i],e)}function qT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][MT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,u=null;const d=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],(!u||l[n.end]>u[n.end])&&(u=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)ZT(t.nodes[r],e,i,s,n)}function JT(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[MT]=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)),JT(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function QT(t={}){const e=Object.assign({},t);if(u(t.style)?e.style=(e,i,s,n)=>ek(t.style(e,i,s,n)):E(t.style)||(e.style=ek(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])?i[e]=(i,s,n,r)=>ek(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=ek(t.state[e]))})),e.state=i}return e}function tk(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>ek(t[i](e,s,n,r)):E(t[i])||(e[i]=ek(t[i]))})),e}function ek(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:jt(t.angle)}):t}const ik=t=>"line"===t||"area"===t,sk=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ik(i)?e:null==e?void 0:e[0]},nk=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let rk=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},n=qw.getComposedEvent(t);if(n){const e=new n(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(qw.getComposedEvent(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()}};var ak;!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"}(ak||(ak={}));const ok=["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 lk,hk,ck;t.ChartEvent=void 0,(lk=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",lk.rendered="rendered",lk.renderFinished="renderFinished",lk.animationFinished="animationFinished",lk.regionSeriesDataFilterOver="regionSeriesDataFilterOver",lk.afterInitData="afterInitData",lk.afterInitEvent="afterInitEvent",lk.afterInitMark="afterInitMark",lk.rawDataUpdate="rawDataUpdate",lk.viewDataFilterOver="viewDataFilterOver",lk.viewDataUpdate="viewDataUpdate",lk.viewDataStatisticsUpdate="viewDataStatisticsUpdate",lk.markDeltaYUpdate="markDeltaYUpdate",lk.viewDataLabelUpdate="viewDataLabelUpdate",lk.scaleDomainUpdate="scaleDomainUpdate",lk.scaleUpdate="scaleUpdate",lk.dataZoomChange="dataZoomChange",lk.drill="drill",lk.layoutStart="layoutStart",lk.layoutEnd="layoutEnd",lk.layoutRectUpdate="layoutRectUpdate",lk.playerPlay="playerPlay",lk.playerPause="playerPause",lk.playerEnd="playerEnd",lk.playerChange="playerChange",lk.playerForward="playerForward",lk.playerBackward="playerBackward",lk.scrollBarChange="scrollBarChange",lk.brushStart="brushStart",lk.brushChange="brushChange",lk.brushEnd="brushEnd",lk.brushClear="brushClear",lk.brushActive="brushActive",lk.legendSelectedDataChange="legendSelectedDataChange",lk.legendFilter="legendFilter",lk.legendItemClick="legendItemClick",lk.legendItemHover="legendItemHover",lk.legendItemUnHover="legendItemUnHover",lk.tooltipShow="tooltipShow",lk.tooltipHide="tooltipHide",lk.tooltipRelease="tooltipRelease",lk.afterResize="afterResize",lk.afterRender="afterRender",lk.afterLayout="afterLayout",lk.afterMarkLayoutEnd="afterMarkLayoutEnd",lk.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(hk||(hk={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(ck||(ck={}));const uk=[ck.mark,ck.model,ck.chart,ck.vchart];class dk{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(ck.vchart,[]),this._levelNodes.set(ck.chart,[]),this._levelNodes.set(ck.model,[]),this._levelNodes.set(ck.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 pk={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 gk{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=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>sk(t)))};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)||hk.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||hk.chart);o.get(t)||o.set(t,new dk);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)||hk.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||hk.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)||hk.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||hk.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?uk.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[hk.chart,hk.window,hk.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(u(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 pk[a]&&(a=pk[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?ck.model:ck.vchart:ck.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=hk.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!==ck.model&&s!==ck.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=ck.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 hk.chart:return this._viewBubbles;case hk.window:return this._windowBubbles;case hk.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case hk.chart:return this._viewListeners;case hk.window:return this._windowListeners;case hk.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return ok.includes(t)||Object.values(ak).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&qw.hasInteractionTrigger(e)}}function fk(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function mk(t,e,i){t.getParser(e)||t.registerParser(e,i)}const vk=new Map;function yk(t,e=!1){let i=e;return t.latestData instanceof ni&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const _k=(t,e)=>0===t.length?[]:1===t.length?yk(t[0],null==e?void 0:e.deep):t.map((t=>yk(t,null==e?void 0:e.deep)));function bk(e,i,s){fk(i=i instanceof si?i:e.dataSet,"copyDataView",_k);const n=new ni(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function xk(t,e,i=[]){var s;if(t instanceof ni)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===n));if(d)u=d;else{const t={name:n};if(c&&(t.fields=c),u=new ni(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Rg(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Rg(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Rg("values should be array")):u.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function Sk(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Ak,wk,Tk,kk;t.TransformLevel=void 0,(Ak=t.TransformLevel||(t.TransformLevel={}))[Ak.copyDataView=-10]="copyDataView",Ak[Ak.treemapFilter=-8]="treemapFilter",Ak[Ak.treemapFlatten=-7]="treemapFlatten",Ak[Ak.dotObjFlat=-7]="dotObjFlat",Ak[Ak.linkDotInfo=-7]="linkDotInfo",Ak[Ak.sankeyLayout=-7]="sankeyLayout",Ak[Ak.dataZoomFilter=-6]="dataZoomFilter",Ak[Ak.legendFilter=-5]="legendFilter",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"}(wk||(wk={})),function(t){t.data="data",t.mark="mark"}(Tk||(Tk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(kk||(kk={}));const Ck=["line","area","trail"];function Mk(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(VT,i?t.slice().sort(i):t.slice()),{keys:[VT],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const Bk=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function Ek(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{Ek(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function Pk(t,e,i,s){const n=Mk(t,(t=>i(t))),r=Mk(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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 Ok{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option;Ap.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new Fp(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=sh({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Fg(o))&&!1!==c&&qw.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=kk.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Ap.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Ap.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>Ek(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>Ek(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{Ek(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Eg(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===kk.before&&(this._layoutState=kk.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=kk.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Eg(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=Rk(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=Pk(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=Pk(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=Mk(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=Mk(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===hk.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:sk(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===hk.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===hk.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===hk.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===hk.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===hk.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{Ek(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=Rk(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Dg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Yo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gi.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{Ek(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Ap.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Ap.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function Ik(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:Pg)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function Lk(t){t.crosshair=G(t.crosshair||{}).map((e=>Kw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function Dk(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}=Me(l,i.width,i.height);a=t,o=e}else if(h&&Dg(e.mode)){let t;t=y(h)?Ap.getElementById(h):h;const{width:e,height:s}=Me(t,i.width,i.height);a=e,o=s}else if(jg(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 Fk(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 jk(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}}var Nk,Uk,zk,Hk,Vk,Wk;t.LayoutZIndex=void 0,(Nk=t.LayoutZIndex||(t.LayoutZIndex={}))[Nk.SeriesGroup=0]="SeriesGroup",Nk[Nk.Axis_Grid=50]="Axis_Grid",Nk[Nk.CrossHair_Grid=100]="CrossHair_Grid",Nk[Nk.Region=450]="Region",Nk[Nk.Mark=300]="Mark",Nk[Nk.Node=400]="Node",Nk[Nk.Axis=100]="Axis",Nk[Nk.MarkLine=500]="MarkLine",Nk[Nk.MarkArea=100]="MarkArea",Nk[Nk.MarkPoint=500]="MarkPoint",Nk[Nk.DataZoom=500]="DataZoom",Nk[Nk.ScrollBar=500]="ScrollBar",Nk[Nk.Player=500]="Player",Nk[Nk.Legend=500]="Legend",Nk[Nk.CrossHair=500]="CrossHair",Nk[Nk.Indicator=500]="Indicator",Nk[Nk.Title=500]="Title",Nk[Nk.Label=500]="Label",Nk[Nk.Brush=500]="Brush",Nk[Nk.CustomMark=500]="CustomMark",Nk[Nk.Interaction=700]="Interaction",t.LayoutLevel=void 0,(Uk=t.LayoutLevel||(t.LayoutLevel={}))[Uk.Indicator=10]="Indicator",Uk[Uk.Region=20]="Region",Uk[Uk.Axis=30]="Axis",Uk[Uk.DataZoom=40]="DataZoom",Uk[Uk.Player=40]="Player",Uk[Uk.ScrollBar=40]="ScrollBar",Uk[Uk.Legend=50]="Legend",Uk[Uk.Title=70]="Title",Uk[Uk.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(zk=t.AttributeLevel||(t.AttributeLevel={}))[zk.Default=0]="Default",zk[zk.Theme=1]="Theme",zk[zk.Chart=2]="Chart",zk[zk.Base_Series=3]="Base_Series",zk[zk.Series=4]="Series",zk[zk.Mark=5]="Mark",zk[zk.User_Chart=6]="User_Chart",zk[zk.User_Series=7]="User_Series",zk[zk.User_Mark=8]="User_Mark",zk[zk.User_SeriesStyle=9]="User_SeriesStyle",zk[zk.Built_In=99]="Built_In";class Gk{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},Gk.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]))))}}Gk.defaultMarkInfo={};class Yk{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class Xk{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=>Kw({},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 $k extends Yk{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=Xk,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new Gk,this._lastLayoutRect=null,this.id=Ug(),this.userId=t.id,this._spec=t,this.effect={},this.event=new rk(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${yT}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=qw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class Kk{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=Fw(Nw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:Dw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:Dw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:Dw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:Dw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:Dw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:Dw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=Dw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=Dw(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=Dw(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(jw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class qk extends $k{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,this._transformLayoutPadding=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 Kk(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&H(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 Zk extends Xk{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Jk extends qk{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(e,i){var s;super(e,i),this.transformerConstructor=Zk,this.modelType="region",this.specKey="region",this.type=Jk.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return H(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function Qk(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 tC(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 eC(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 iC(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:s}=aC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),eC(u,!0,p,l),s&&tC(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function sC(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:s}=aC(t,e,n),d=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=aC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,n),d.push(t))})),p.push(l),u.push(d),eC(u,!1,p,o),s&&tC(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function rC(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:s,layoutRect:u,rect:d}=aC(t,e,n),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=aC(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Qk(t);n.length&&iC(n,e,i,!1,"left",s),r.length&&iC(r,e,i,!0,"left",s),a.length&&sC(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Qk(t);n.length&&nC(n,e,i,!1,"top",s),r.length&&nC(r,e,i,!0,"top",s),a.length&&rC(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Qk(t);n.length&&iC(n,e,i,!1,"right",s),r.length&&iC(r,e,i,!0,"right",s),a.length&&sC(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=Qk(t);n.length&&nC(n,e,i,!1,"bottom",s),r.length&&nC(r,e,i,!0,"bottom",s),a.length&&rC(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=aC(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{H(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=aC(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Pg)("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}}}oC.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(Hk||(Hk={})),t.STATE_VALUE_ENUM=void 0,(Vk=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",Vk.STATE_HOVER="hover",Vk.STATE_HOVER_REVERSE="hover_reverse",Vk.STATE_DIMENSION_HOVER="dimension_hover",Vk.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",Vk.STATE_SELECTED="selected",Vk.STATE_SELECTED_REVERSE="selected_reverse",Vk.STATE_SANKEY_EMPHASIS="selected",Vk.STATE_SANKEY_EMPHASIS_REVERSE="blur",Vk.STATE_HIGHLIGHT="highlight",Vk.STATE_BLUR="blur",Vk.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(Wk||(Wk={}));const lC=["linear","radial","conical"],hC={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const cC={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{cC[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class uC extends Yk{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class dC extends uC{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,Ck.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!cC[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(yT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(yT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(Kx(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class pC extends Yk{constructor(){super(...arguments),this.id=Ug(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=qw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class gC extends pC{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const fC=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,mC=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=fC(l.delay,n,a,o),u=fC(l.duration,n,a,o),d=fC(l.oneByOne,n,a,o),p=fC(l.splitPath,n,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?rx:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ax)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);ex(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?rx:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ax)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Zb(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Qb(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:ys.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new tx({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Yb,null!==(l=i.easing)&&void 0!==l?l:Xb))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:ys.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new ix({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Yb,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Xb))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):ex(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:s})},vC=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},yC=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class _C extends pC{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new gC(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new pn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==Hk.enter&&t.context.diffState!==Hk.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new dC(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,jt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&Kw(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(qx(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=Ew(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=u(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):lC.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):qx(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=u(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=xw(bw(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()),d=Object.assign(Object.assign({},hC[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(d).forEach((s=>{const n=d[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return u(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=Ae.SetOpacity(a,s)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):u(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)lC.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=xw(bw(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return Mk(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return qw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[AT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=Mk(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{yC(t),s.push(...t.getGraphics())})),e.forEach((t=>{yC(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);mC([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=vC(e,n),r=vC(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===wk.exit?wk.exit:i===wk.update?wk.update:wk.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===Hk.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===Hk.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=Hk.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=Hk.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=Hk.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=wk.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=wk.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return Bk(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=Bk(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!u(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);d(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=nk(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=qw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=qw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===kk.before||(Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===Hk.exit&&!e.isExiting)if(e.context.animationState===Hk.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:Hk.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var bC;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(bC||(bC={}));class xC extends _C{constructor(){super(...arguments),this.type=xC.type,this._marks=[],this._diffState=Hk.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Rg("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?(Rg("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))}getMarkInUserId(t){let e;return Ek(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===Hk.update){const t=this.hasAnimation(),e=nk(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=Hk.update}render(){this._isCommited&&(Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}xC.type="group";const SC={measureText:vT};class AC{static instance(){return AC.instance_||(AC.instance_=new AC),AC.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 wC{constructor(){this.id=Ug(),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))?Rg("不要重复添加相同的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 TC extends wC{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}}const kC={type:"fadeIn"};function CC(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 kC;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const MC={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"}},BC={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},EC=()=>{qw.registerAnimation("scaleInOut",(()=>BC))},RC=(t,e)=>({appear:CC(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:ox,duration:MC.update.duration,easing:MC.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),PC=()=>{qw.registerAnimation("line",RC)},OC=()=>{Ub.registerBuiltInAnimate("growPointsIn",Ax),Ub.registerBuiltInAnimate("growPointsOut",Tx),Ub.registerBuiltInAnimate("growPointsXIn",Cx),Ub.registerBuiltInAnimate("growPointsXOut",Mx),Ub.registerBuiltInAnimate("growPointsYIn",Ex),Ub.registerBuiltInAnimate("growPointsYOut",Rx),Ub.registerBuiltInAnimate("clipIn",cx),Ub.registerBuiltInAnimate("clipOut",ux)},IC=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class LC{constructor(t){this._markSet=new Gk,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 DC={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class FC extends LC{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},DC,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}FC.type="element-highlight",FC.defaultOptions=DC;const jC=()=>{qw.registerInteractionTrigger(FC.type,FC)},NC={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class UC extends LC{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},NC,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}UC.type="element-select",UC.defaultOptions=NC;const zC=()=>{qw.registerInteractionTrigger(UC.type,UC)};class HC extends wC{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class VC{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>qw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>qw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>qw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return qw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>qw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){qw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&AC.instance().registerFunction(t,e)}static unregisterFunction(t){t&&AC.instance().unregisterFunction(t)}static getFunction(t){return t?AC.instance().getFunction(t):null}static getFunctionList(){return AC.instance().getFunctionNameList()}static registerMap(t,e,i){const s=qw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=qw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,vk.get(e);var e}static registerSVG(t,e,i){const s=qw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=qw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){cT.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,u,d;this.id=Ug(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;H(n.theme,this._spec.theme)?H(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=Fk(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?qw.getSeriesBuiltInTheme(e):qw.getComponentBuiltInTheme(e);i=i?Kw({},s,i[e]):s}s===t.length-1&&p(i)&&(i=gT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},pw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Dg(v);if(S?$f(Vi):"node"===v&&Rv(Vi),S&&f&&(this._container=y(f)?Ap.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=uT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const w=new it(null!==(a=this._option.logLevel)&&void 0!==a?a:et.Error);it.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.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._compiler=new Ok({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new gk(this,this._compiler),this._event=new rk(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),cT.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Kw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=fT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;VC.getFunctionList()&&VC.getFunctionList().length&&(t=mT(t,VC)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=qw.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=qw.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=qw.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 Dk(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:_T,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:bT})}_initDataSet(t){this._dataSet=t instanceof si?t:new si,mk(this._dataSet,"dataview",ti),mk(this._dataSet,"array",s),fk(this._dataSet,"copyDataView",_k);for(const t in qw.transforms)fk(this._dataSet,t,qw.transforms[t]);for(const t in qw.dataParser)mk(this._dataSet,t,qw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?wk.none:wk.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,cT.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 d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 ni?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=xk(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Kw({},t[n][e.index],i):i):t[n]=s?Kw({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Kw({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Kw({},t[n],i):i)}))}(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=Kw({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=Zw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=dT(this._currentThemeName),this._currentTheme=o(a,l);else if(y(n)&&(!r||y(r))||y(r)&&(!n||y(n))){const t=Zw({},dT(this._currentThemeName),dT(n),dT(r));this._currentTheme=o(a,t)}else{const t=Zw({},dT(this._currentThemeName),dT(n),dT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(Z_.poptip,q_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Dg(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.getTheme("background")||this._option.background}getCurrentTheme(){return dT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!uT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 Ik(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(!Dg(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;this._chart.resetLayoutItemTag(),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)?Ap.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(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?Uw(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(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 Rg("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?Uw(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Rg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return AC.instance().getFunction(t)}registerFunction(t,e){t&&e&&AC.instance().registerFunction(t,e)}unregisterFunction(t){t&&AC.instance().unregisterFunction(t)}getFunctionList(){return AC.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=qw.getChartPlugins();t.length>0&&(this._chartPlugin=new TC(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=qw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new HC(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}VC.InstanceManager=cT,VC.ThemeManager=uT,VC.globalConfig={uniqueTooltip:!0},VC.Utils=SC,VC.vglobal=Ap;qw.registerRegion("region",Jk),qw.registerLayout("base",oC),m_(),n_(),qw.registerMark(xC.type,xC),qw.registerStageEventPlugin("gesture",vf),jC(),zC(),rT(Xw.name,Xw);const WC="monotone",GC="linear",YC="bevel";function XC(t,e){return e("component",t)}function $C(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=qw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const KC=(t,e,i,s)=>{if(d(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},qC=(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},ZC=(t,e,i,s)=>{let n;if(n=u(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=$C(void 0,s,t,e);i&&r&&(n=i(...r))}return n},JC=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const QC=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tM(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=iM(ZC(h,r,a,c),u,g),o.value=iM(ZC(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=ZC(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function eM(t,e,i,s,n,r,a){if(u(e)){tM(t,e(n,a),i,s,r,a)}else e&&tM(t,e,i,s,r,a)}const iM=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=Be.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sM{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,u,d,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!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,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=>{eM(a,t,e,i,s,n,r)})):u(t)?eM(a,t,e,i,s,n,r):t&&tM(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=u(e)?e(s,n):e;if(r?d(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:ZC(r.visible,t,n),value:iM(ZC(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:ZC(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=ZC(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&QC(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 nM={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}},rM=(t,e)=>{var i,s;let n=e.fields;if(u(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=WT([],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 aM(a,n,o)},aM=(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 u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{zg(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{zg(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nM[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},oM=(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=>{zg(t[e])||(t[e]=0)}))})),t};function lM(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function hM(t,e,i){t&&(i.needDefaultSeriesField&&(t[wT]=i.defaultSeriesField),t[ST]=e,t[AT]=i.getKey(t,e,i))}const cM={label:{name:"label",type:"text"}},uM=`${yT}_rect_x`,dM=`${yT}_rect_x1`,pM=`${yT}_rect_y`,gM=`${yT}_rect_y1`,fM={data:!0},mM={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},vM=[...Object.keys(MC),"normal"];function yM(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 AM(n)&&delete n.type,n.oneByOne&&(n=bM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:xM,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Kw({},o[e],a);return AM(n)&&delete n.type,n.oneByOne&&(n=bM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:xM,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function _M(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;const i=["custom","customParameters"];return t=I(t,null,i),wM(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function bM(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=u(n)?n(t,i,a):A(n)?n:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(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=u(n)?n(t,r,o):A(n)?n:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(s)?s(t,r,o):s;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function xM(t,e){var i;return null!==(i=null==t?void 0:t[ST])&&void 0!==i?i:e.context.graphicIndex}function SM(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 AM(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function wM(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),wM(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),wM(t[s],e,i))}function TM(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class kM extends Xk{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=vw(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=qw.getSeriesMarkMap(o)?function(t,e,i){const s=qw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=Kw({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return Kw({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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),d(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:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&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=Kw({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>Kw({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class CM extends $k{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:`${yT}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kM,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=TM(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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 d(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)&&(fk(this._rawData.dataSet,"invalidTravel",oM),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=xk(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=bk(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=bk(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new gC(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&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(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=aM(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(){fk(this._dataSet,"dimensionStatistics",rM);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ni(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&&WT(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){fk(this._dataSet,"dimensionStatistics",rM);const s=new ni(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=WT(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&WT(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ni(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 d(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("-"):u(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)&&(fk(this._rawData.dataSet,"addVChartProperty",qC),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:lM.bind(this),call:hM}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=yM({},_M(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||d(t.dataId)&&d(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Fg(s)||jg(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=Kw(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Kw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=IC(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=IC(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=IC(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:wT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:TT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,TT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new sM(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)=>!H(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!H(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},fM),mM),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=>mM[i]&&!H(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!H(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ni||Sk(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();TM(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){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:wT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Mw).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return bw(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:wT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(l),this.initMarkStyleWithSpec(_,Kw({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:AT}_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!==MT&&t!==ET&&t!==CT&&t!==BT||(t=this.getStackValueField()),null!==(e=YT(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=>zg(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:wT]}}function MM(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();Kx(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 BM(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}}}CM.mark=cM,CM.transformerConstructor=kM;class EM extends CM{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);Kx(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:`${yT}_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(MT),this.setFieldX2(CT)):(this.setFieldY(MT),this.setFieldY2(CT))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(ET),this.setFieldX2(BT)):(this.setFieldY(ET),this.setFieldY2(BT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(PT),this.setFieldX2(RT)):(this.setFieldY(PT),this.setFieldY2(RT))}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(t.ChartEvent.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)&&(MM("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)}}function RM(t){return"bottom"===t||"top"===t}function PM(t){return"left"===t||"right"===t}function OM(t){return"z"===t}function IM(t,e){return Ow(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function LM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?RM(t)?"linear":"band":RM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const DM=(t,e,i)=>{var s;const n=null!==(s="band"===e?XC("axisBand",i):["linear","log","symlog"].includes(e)?XC("axisLinear",i):{})&&void 0!==s?s:{},r=RM(t)?XC("axisX",i):PM(t)?XC("axisY",i):XC("axisZ",i);return Kw({},XC("axis",i),n,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:Pg)("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:Pg)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>Zx(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return RM(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class jM 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:hk.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const NM=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},UM=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},zM=(t,e,i,s)=>{var n;const r=e.getScale(),a=Zx(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:HM(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,VM=(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};class WM 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)=>!NM(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:hk.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:hk.canvas}),callback:this.onMouseOut}),Fg(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:hk.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Fg(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var GM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(GM||(GM={}));const YM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class XM{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(YM.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:YC,curveType:GC,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===WC?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(YM.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:SM(this._spec,YM.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new ni(this._option.dataSet,{name:`${yT}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(GM.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[YM.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(GM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,Kw({},this._spec[YM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const $M=Object.assign(Object.assign({},cM),YM),KM=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>KM(t,e[i])));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]))},qM=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class ZM extends _C{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return qM}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(qx(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?KM(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,u=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!u||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),u?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:Hk.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[AT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class JM extends ZM{constructor(){super(...arguments),this.type=JM.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)===fw.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}JM.type="line";const QM=()=>{qw.registerMark(JM.type,JM),m_(),a_(),IA(),BA(),OC(),qw.registerGraphicComponent("line",Zh)};class tB extends _C{constructor(){super(...arguments),this.type=tB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}tB.type="symbol";const eB=()=>{qw.registerMark(tB.type,tB),m_(),y_(),BA(),qw.registerGraphicComponent("symbol",$h)};class iB extends kM{_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 sB(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function nB(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 rB(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:u}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[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),u[1]=-u[0]*t}return!0}function aB(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 oB(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 lB(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 hB=(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 u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.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=u.map((t=>function(t,e,i,s,n){const r=Lt(t,e),a=Math.max(It(i),It(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return Wx(v)};class cB{constructor(t){this.id=Ug(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class uB extends cB{constructor(){super(uB.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!Kx(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&sB(c)&&sB(u)))return;const d=nB(t,c),p=nB(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!aB(d,p))return}else if(0===_&&0===b){if(!aB(p,d))return}else if(y||A)if(y&&!A){if(!rB(d,p))return}else if(A&&!y){if(!rB(p,d))return}else{if(f===b)return;if(f>b){if(!oB(d,p))return}else if(!oB(p,d))return}else{if(0===f&&0===_){if(!lB(d,p))return}else if(0===b&&0===g&&!lB(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){fk(e.getOption().dataSet,"tickAlign",hB);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}uB.pluginType="component",uB.type="AxisSyncPlugin";const dB={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function pB(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 gB(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const fB=t=>"band"===t||"ordinal"===t||"point"===t;function mB(t,e){return{id:t,label:t,value:e,rawValue:t}}function vB(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class yB extends wC{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const _B=`${yT}_ARC_TRANSFORM_VALUE`,bB=`${yT}_ARC_RATIO`,xB=`${yT}_ARC_START_ANGLE`,SB=`${yT}_ARC_END_ANGLE`,AB=`${yT}_ARC_K`,wB=`${yT}_ARC_MIDDLE_ANGLE`,TB=`${yT}_ARC_QUADRANT`,kB=`${yT}_ARC_RADIAN`,CB=-Math.PI/2,MB=3*Math.PI/2,BB=(t,e,i)=>{var s;const n=null!==(s="band"===e?XC("axisBand",i):"linear"===e?XC("axisLinear",i):{})&&void 0!==s?s:{},r=XC("angle"===t?"axisAngle":"axisRadius",i);return Kw({},XC("axis",i),n,r)};function EB(t,e,i,s){switch(t){case r.cartesianBandAxis:return DM(IM(i,["z"]),"band",e);case r.cartesianLinearAxis:return DM(IM(i,["z"]),"linear",e);case r.cartesianLogAxis:return DM(IM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return DM(IM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return DM(IM(i),void 0,e);case r.polarBandAxis:return BB(i.orient,"band",e);case r.polarLinearAxis:return BB(i.orient,"linear",e);case r.polarAxis:return BB(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,trigger:c,triggerOff:u}=null!==(s=XC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>RM(t.orient)));let g;g=p(d)?Kw({},fB(d.type)?a:o,l):l;const f=n.find((t=>PM(t.orient)));let m;return m=p(f)?Kw({},Zx(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(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,trigger:c,triggerOff:u}=null!==(s=XC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>"angle"===t.orient));let g;g=p(d)?Kw({},fB(d.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?Kw({},Zx(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return RB(i,XC(t,e));default:return XC(t,e)}}const RB=(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=Kw({},e,s);return delete n.horizontal,delete n.vertical,n};class PB extends Xk{getTheme(t,e){return EB(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({},Nw(e)),{[s]:0}))}}class OB extends qk{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=PB,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof la||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:hk.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 yB(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!H(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}}getDatum(t){}}var IB,LB;OB.transformerConstructor=PB,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(IB||(IB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(LB||(LB={}));class DB extends _C{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=qw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(ak.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}DB.type="component";const FB=()=>{qw.registerMark(DB.type,DB)},jB=t=>t;class NB extends OB{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?IB.circleAxis:IB.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?LB.circleAxisGrid:LB.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=yM(null===(h=qw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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()),e=new gC(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return uw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?Kx(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 uw(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=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));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),uw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&H(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):uw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(uw(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=QT(s=t.domainLine)).startSymbol=QT(s.startSymbol),s.endSymbol=QT(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=N(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=u(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return ek(Kw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:ek(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>ek(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=ek(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return ek(Kw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:ek(t.tick.style)),t.tick.state&&(i.tick.state=tk(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=u(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return ek(Kw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:ek(t.subTick.style)),t.subTick.state&&(i.subTick.state=tk(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 u,p=r;"left"!==t.orient&&"right"!==t.orient||n&&d(p)&&(p="left"===t.orient?-90:90,u=dB[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:Kw({},u,ek(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:ek(h.style)}),h.state&&(i.title.state.shape=tk(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:ek(o.style)}),o.state&&(i.title.state.background=tk(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=tk(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=ek(t.background.style)),t.background.state&&(i.panel.state=tk(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:u(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 ek(Kw({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:ek(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:ek(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=$C(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){mk(this._option.dataSet,"scale",jB);const i=this.registerTicksTransform();return new ni(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)}getDatum(t){var e;return t&&t.name===ib.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}NB.specKey="axes";const UB=()=>{FB(),qw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},zB=[uB];class HB extends NB{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),uw(this._regions,(t=>{const e=this.getOrient();RM(e)?vB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):PM(e)?vB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):OM(e)&&vB(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=Kw({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(Kw({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=RM(this.getOrient()),n=t=>{var e;return(s?!RM(t.getOrient()):RM(t.getOrient()))&&Kx(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=IM(i,["z"]),OM(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!gB(e))return null;const{axisType:t,componentName:s}=LM(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=>PM(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(!gB(t))return;const{axisType:s,componentName:n}=LM(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=qw.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return RM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):OM(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(zB.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){RM(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&&!RM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!OM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;PM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=Dw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=Dw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=RM(this.getOrient())?t.fieldX:OM(this.getOrient())?t.fieldZ:t.fieldY,Kx(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:Kx(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(ak.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(RM(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=RM(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)}))}collectScale(){const t=[];return uw(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]:RM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:OM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();uw(this._regions,(e=>{RM(t)?vB(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):PM(t)?vB(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):OM(t)&&vB(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=RM(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=RM(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=Kw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new le).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=RM(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;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return mB(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:Kx(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}HB.type=r.cartesianAxis,HB.specKey="axes";const VB=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function WB(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,YB=(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 XB(t,e,i="count"){const s=YB(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const $B=Math.sqrt(50),KB=Math.sqrt(10),qB=Math.sqrt(2);class ZB{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=pB(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(u(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=RM(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 d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(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 d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(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=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(GB),e.sort(GB),{domain:WB(t,e),scope:XB(t,e,i)}}(r,Bg(t),this._spec.breaks[0].scopeType);e=Bg(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}=pB(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>=$B?10:n>=KB?5:n>=qB?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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}}const JB={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},QB={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}}},tE={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}}},eE={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}}};class iE extends HB{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new NS}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!OM(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=RM(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=Iw(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=Bg(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 fk(this._option.dataSet,t,$S),t}}iE.type=r.cartesianLinearAxis,iE.specKey="axes",iE.builtInTheme={axis:eE,axisLinear:JB,axisX:QB,axisY:tE},W(iE,ZB);const sE=()=>{qw.registerGraphicComponent(IB.lineAxis,((t,e)=>new Vx(t,e))),qw.registerGraphicComponent(LB.lineAxisGrid,((t,e)=>new VA(t,e))),UB(),qw.registerComponent(iE.type,iE)};class nE extends HB{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new yS}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 fk(this._option.dataSet,t,QS),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=hS(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(),u=e=>{const i=t===n?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new gC(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=mB(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=>mB(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 rE=()=>{qw.registerGraphicComponent(IB.lineAxis,((t,e)=>new Vx(t,e))),qw.registerGraphicComponent(LB.lineAxisGrid,((t,e)=>new VA(t,e))),UB(),qw.registerComponent(nE.type,nE,!1)};class aE extends iE{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),uw(this._regions,(t=>{RM(this.getOrient())?vB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):vB(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=Kw({},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 ni(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 gC(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=Be.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,u=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="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?d(u,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=>mB(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=>mB(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return fk(this._option.dataSet,t,$S),t}transformScaleDomain(){}}aE.type=r.cartesianTimeAxis,aE.specKey="axes",aE.builtInTheme={axis:eE,axisX:QB,axisY:tE};class oE extends iE{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new VS}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 fk(this._option.dataSet,t,$S),t}transformScaleDomain(){}}oE.type=r.cartesianLogAxis,oE.specKey="axes",oE.builtInTheme={axis:eE,axisLinear:JB,axisX:QB,axisY:tE},W(oE,ZB);class lE extends iE{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new WS}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 fk(this._option.dataSet,t,$S),t}transformScaleDomain(){}}lE.type=r.cartesianSymlogAxis,lE.specKey="axes",lE.builtInTheme={axis:eE,axisLinear:JB,axisX:QB,axisY:tE},W(lE,ZB);const hE=`${yT}_hide_`;function cE(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const uE=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[hE]&&(cE(t,!0),t[hE]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[hE]=!0,cE(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},dE=()=>{qw.registerGrammarTransform("symbolOverlap",{transform:uE,runType:"afterEncode"})},pE={min:$,max:X,average:function(t,e){let i=0,s=0;return t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)})),i/s},sum:lw};function gE(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function fE(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 mE(t,e,i,s){return fE(t,e,i,"min",s)}function vE(t,e,i,s){return fE(t,e,i,"max",s)}function yE(t,e,i,s){return fE(t,e,i,"average",s)}function _E(t,e,i,s){return fE(t,e,i,"sum",s)}const bE=(t,e)=>{let i=u(t.size)?t.size():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=gE;if("min"===n?l=mE:"max"===n?l=vE:"average"===n?l=yE:"sum"===n&&(l=_E),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[]},xE=()=>{qw.registerGrammarTransform("dataSampling",{transform:bE})};class SE extends EM{constructor(){super(...arguments),this.type=fw.line,this.transformerConstructor=iB,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(yM(null===(i=qw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),_M("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=BM(this);this._symbolMark.setAnimationConfig(yM(null===(s=qw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_M("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}SE.type=fw.line,SE.mark=$M,SE.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},SE.transformerConstructor=iB,W(SE,XM);class AE{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)=>{Sk(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ni)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];Rg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Rg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class wE{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)=>{Hg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{WT(e,[{key:t,operations:Kx(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&&WT(e,[{key:i.field,operations:Kx(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?Ew("colorOrdinal"):Ew(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(Hg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(H(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(!H(r.specified,s.specified))return e.reMake=!0,e;s.range&&!H(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Hg(s.domain)?e.reRender=!0:H(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(!Hg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=Kx(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=Kx(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;Kx(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(Kx(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=Kx(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));Kx(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class TE{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class kE extends Yk{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Ug(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:_T,height:bT},this._viewRect={width:_T,height:bT},this._viewBox={x1:0,y1:0,x2:_T,y2:bT},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=Nw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new rk(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new AE(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new TE;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=qw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=qw.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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(u(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){const s=qw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof $k)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 _C))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof _C)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&Sk(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=Dk(this._spec,this._option,{width:_T,height:bT})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=bw(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new wE(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){Fk(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=bw(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(!H(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{Fk(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,Fk(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):Fk(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()];Fk(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=Fw(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=u(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(ak.AFTER_MARK_RENDER_END,e)};this._event.on(ak.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:sk;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(ik(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));u&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===GM.dimensionHover||s===GM.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=d(t)||!n||n.every((t=>Zx(t.axis.getScale().type)&&d(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const CE=(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 ME{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),u=Object.assign(Object.assign({},s),c);e?u.theme=h.getTheme(r,t):$w(t,a,c.spec),$w(n,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=CE(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=CE(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(qw.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(qw.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=qw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=qw.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=qw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return u&&!g&&(null===(n=u.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):KC(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),d&&(null===(a=KC(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,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"];return 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}))}_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 BE extends ME{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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=>{d(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&Kw(i,jk(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 EE extends BE{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),Lk(t)}}const RE=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=XT(t,!0);for(const e in o)for(const i in o[e].nodes)ZT(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)qT(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&KT(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class OE{_beforeInit(){this._dataSet&&fk(this._dataSet,"stackSplit",RE)}_initStack(){this._stack=new PE(this),this._stack.init()}}const IE={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:GM.dimensionHover};class LE extends LC{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},IE,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=sk(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}LE.type="dimension-hover",LE.defaultOptions=IE;const DE=()=>{qw.registerInteractionTrigger(LE.type,LE)},FE=()=>{qw.registerComposedEvent(GM.dimensionHover,WM),qw.registerComposedEvent(GM.dimensionClick,jM)},jE=t=>t.fieldX[0],NE=t=>t.fieldY[0],UE=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},zE=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},HE=(t,e)=>t?e?jE:UE:e?NE:zE,VE=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=VM(t,(t=>RM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=VM(t,(t=>PM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{Zx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const s=WE(t,i,HE(e,Zx(t.getScale().type)));s&&d.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=WE(t,i,HE(e,s));n&&d.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},WE=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:GE(t,s,i)},GE=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=zM(e,t,"cartesian",null!=i?i:RM(t.getOrient())?jE:NE);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},YE=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let w=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(Zx(m.type))A=m.bandwidth(),0===A&&m.step&&(w=m.step());else if(Kx(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=function(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};$E(t,u),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&XE(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=w,t[n].cacheInfo=S})),t),XE=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=$C(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},$E=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},KE=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=qE(i,s,n,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},qE=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},ZE=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return YE(c,r,e),c.xField.cacheInfo?KE(c.xField):c.yField.cacheInfo?KE(c.yField):void 0},JE=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],QE=(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])&&JE.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(tR(s).every((t=>{var e;return!QC("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},tR=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},eR={dom:`${yT}_TOOLTIP_HANDLER_DOM`,canvas:`${yT}_TOOLTIP_HANDLER_CANVAS`},iR={key:"其他",value:"..."};var sR;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(sR||(sR={}));class nR{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=QE(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[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({},iR),t):iR;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!d(e)&&QC(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 rR extends nR{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!Zx(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const aR=()=>{qw.registerTooltipProcessor("dimension",rR)};class oR extends nR{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,u=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,d=null===(n=null==u?void 0:u.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vs.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(sk(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const lR=()=>{qw.registerTooltipProcessor("mark",oR)};class hR extends nR{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 cR=()=>{qw.registerTooltipProcessor("group",hR)};class uR extends kE{constructor(){super(...arguments),this.transformerConstructor=EE,this.type="line",this.seriesType=fw.line}_setModelOption(){this._modelOption.getDimensionInfo=VE,this._modelOption.getDimensionInfoByValue=GE,this._modelOption.getRectByDimensionData=ZE}}uR.type="line",uR.seriesType=fw.line,uR.transformerConstructor=EE,W(uR,OE);function dR(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 pR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:dR(t,e)}),gR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:dR(t,e)}),fR={type:"fadeIn"},mR={type:"growCenterIn"};function vR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return fR;case"scaleIn":return mR;default:return pR(t)}}class yR extends _C{constructor(){super(...arguments),this.type=yR.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}yR.type="rect";const _R=()=>{m_(),d_(),kA("rect",RA),qw.registerMark(yR.type,yR),Ub.registerBuiltInAnimate("growHeightIn",_x),Ub.registerBuiltInAnimate("growHeightOut",bx),Ub.registerBuiltInAnimate("growWidthIn",Fx),Ub.registerBuiltInAnimate("growWidthOut",jx),Ub.registerBuiltInAnimate("growCenterIn",mx),Ub.registerBuiltInAnimate("growCenterOut",vx),qw.registerGraphicComponent("rect",ec)},bR=Object.assign(Object.assign({},cM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function xR(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=zw(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[uM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Rw(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[dM]):Rw(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=Rw(this._dataToPosX(t),e,i),n=Rw(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[pM]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Rw(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[gM]):Rw(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=Rw(this._dataToPosY(t),e,i),n=Rw(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},wR.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:SM(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(wR.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(fk(this._option.dataSet,"addVChartProperty",qC),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(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};fk(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ni(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:lM.bind(this),call:hM}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new gC(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=gM,s=pM,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=dM,s=uM,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=XT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)xR(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,u=Rw(this[r](t),l,i),d=Rw(this[a](t),l,i);let p=Math.abs(u-d);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[CT],n=t[MT],r=t[BT],h=t[ET];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]),{[CT]:i,[MT]:s}),a?{[BT]:o,[ET]: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(ec(Object.assign(Object.assign({},c),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Rw(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Rw(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=d(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=BM(this);this._barMark.setAnimationConfig(yM(null===(e=qw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),_M(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(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=zw(this._spec.barWidth,a)),l&&(c=Math.max(c,zw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,zw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(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],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=zw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(s+=d*y+(d-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=Kx(g.type||"band");return u(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}wR.type=fw.bar,wR.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},wR.mark=bR,wR.transformerConstructor=AR;const TR=()=>{xE(),_R(),qw.registerAnimation("bar",((t,e)=>({appear:vR(t,e),enter:pR(t,!1),exit:gR(t,!1),disappear:gR(t)}))),rE(),sE(),qw.registerSeries(wR.type,wR)};class kR extends BE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Lk(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 CR extends kE{constructor(){super(...arguments),this.transformerConstructor=kR,this.type="bar",this.seriesType=fw.bar}_setModelOption(){this._modelOption.getDimensionInfo=VE,this._modelOption.getDimensionInfoByValue=GE,this._modelOption.getRectByDimensionData=ZE}}CR.type="bar",CR.seriesType=fw.bar,CR.transformerConstructor=kR,W(CR,OE);const MR=[...qM,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class BR extends ZM{constructor(){super(...arguments),this.type=BR.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return MR}_getIgnoreAttributes(){return[]}}BR.type="area";class ER extends sM{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 RR=Object.assign(Object.assign(Object.assign({},cM),YM),{area:{name:"area",type:"area"}}),PR=()=>{qw.registerAnimation("area",RC),PC(),EC()};class OR extends iB{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),d=!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||d&&!u)&&(g=h,f=l),l.style=Kw({},f.style,g.style),l.state=Kw({},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 IR extends EM{constructor(){super(...arguments),this.type=fw.area,this.transformerConstructor=OR,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(IR.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===WC?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Rw(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Rw(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[MT]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(yM(null===(e=qw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),_M("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(yM(null===(i=qw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),_M("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=BM(this);this._symbolMark.setAnimationConfig(yM(null===(s=qw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),_M("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 ER(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(){super.onLayoutEnd(),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}}}IR.type=fw.area,IR.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},IR.mark=RR,IR.transformerConstructor=OR,W(IR,XM);const LR=()=>{xE(),dE(),QM(),qw.registerMark(BR.type,BR),m_(),i_(),IA(),BA(),OC(),qw.registerGraphicComponent("area",_c),eB(),PR(),rE(),sE(),qw.registerSeries(IR.type,IR)};class DR extends BE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Lk(t)}}class FR extends kE{constructor(){super(...arguments),this.transformerConstructor=DR,this.type="area",this.seriesType=fw.area}_setModelOption(){this._modelOption.getDimensionInfo=VE,this._modelOption.getDimensionInfoByValue=GE,this._modelOption.getRectByDimensionData=ZE}}FR.type="area",FR.seriesType=fw.area,FR.transformerConstructor=DR,W(FR,OE);class jR extends CM{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=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(d(t)||d(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:[]};Kx(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:[]};Kx(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(t.ChartEvent.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)&&MM(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 NR(t){return zg(t)?Number.parseFloat(t):0}const UR=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=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&&u&&zR(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,w=S,T=0;const k=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[_B],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=w/T;A=p,m.forEach((e=>{const i=e[r]===f?f:e[_B]*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},zR=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===NR(t[e])))||!i&&0===t.reduce(((t,i)=>t+NR(i[e])),0)));function HR(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const VR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:HR(t,!0,wk.appear)}),WR={type:"fadeIn"},GR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:HR(t,!0,wk.enter)}),YR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:HR(t,!0,wk.exit)}),XR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:HR(t,!0,wk.exit)});function $R(t,e){if(!1===e)return{};switch(e){case"fadeIn":return WR;case"growRadius":return VR(Object.assign(Object.assign({},t),{growField:"radius"}));default:return VR(Object.assign(Object.assign({},t),{growField:"angle"}))}}class KR extends _C{constructor(t,e){super(t,e),this.type=qR.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i),e[wB])[t]+s,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 qR extends KR{constructor(){super(...arguments),this.type=qR.type}}qR.type="arc";const ZR=()=>{m_(),t_(),kA("arc",FA),Ub.registerBuiltInAnimate("growRadiusIn",Ix),Ub.registerBuiltInAnimate("growRadiusOut",Lx),Ub.registerBuiltInAnimate("growAngleIn",gx),Ub.registerBuiltInAnimate("growAngleOut",fx),qw.registerGraphicComponent("arc",Sc),qw.registerMark(qR.type,qR)},JR=Object.assign(Object.assign({},cM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class QR extends kM{_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=Kw({},this._theme,i,t);const n=(t,e)=>Kw({},"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 tP=`${yT}_LABEL_VISIBLE`;class eP extends jR{constructor(){super(...arguments),this.transformerConstructor=QR,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:Dw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:Dw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=CB,this._endAngle=MB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[wB];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Ut(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;fk(this._dataSet,"pie",UR),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:xB,asEndAngle:SB,asRatio:bB,asMiddleAngle:wB,asRadian:kB,asQuadrant:TB,asK:AB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ni(this._dataSet,{name:`${yT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new gC(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},eP.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:AT,groupKey:this._seriesField,isSeriesMark:!0},{morph:SM(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return dw(xB)(t)}endAngleScale(t){return dw(SB)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(u(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 Ht(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 e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Pw(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Pw(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:dw(tP).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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*(d(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[wB];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Ut(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===wk.appear)return this._startAngle;if(i===wk.disappear)return this._endAngle;const r=[wk.disappear,wk.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[ST];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[ST]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[ST])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[ST])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[wB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[wB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[wB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[wB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=yM(null===(i=qw.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]}}eP.transformerConstructor=QR,eP.mark=JR,eP.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class iP extends eP{constructor(){super(...arguments),this.type=fw.pie}}iP.type=fw.pie;const sP=()=>{ZR(),qw.registerAnimation("pie",((t,e)=>({appear:$R(t,e),enter:GR(t),exit:YR(t),disappear:XR(t)}))),qw.registerAnimation("emptyCircle",((t,e)=>({appear:$R(t,e)}))),qw.registerSeries(iP.type,iP)};class nP extends ME{_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=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),_(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 rP extends nP{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class aP extends kE{constructor(){super(...arguments),this.transformerConstructor=rP}}aP.transformerConstructor=rP;class oP extends aP{constructor(){super(...arguments),this.transformerConstructor=rP,this.type="pie",this.seriesType=fw.pie}}oP.type="pie",oP.seriesType=fw.pie,oP.transformerConstructor=rP;class lP extends ME{_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")&&Kw(e,jk(this.type,t))})),this._transformAxisSpec(t)}}const hP=(t,e)=>{if(!t)return null;const i=VM(t,(t=>"angle"===t.getOrient()),e),s=VM(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&&Zx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=hw({x:1,y:0},u);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=cw(u),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=zM(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&&Zx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=hw({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=cw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=zM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class cP extends kE{constructor(){super(...arguments),this.transformerConstructor=lP,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=VE(t,e,i))&&void 0!==s?s:[],...null!==(n=hP(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=GE,this._modelOption.getRectByDimensionData=ZE}}cP.type="common",cP.transformerConstructor=lP,W(cP,OE);const uP={rect:vP,symbol:fP,arc:_P,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=fP(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!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=pP(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),Gh(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:bP,area:bP,rect3d:vP,arc3d:_P,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function dP(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=uP[t])&&void 0!==i?i:uP.point;return e.series.type===fw.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=gP(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:xP(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function pP(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==fw.sankey){const{formatFunc:t,args:n}=$C(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function gP(t){return u(t)?e=>t(e.data):t}function fP(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=gP(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:mP(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function mP(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function vP(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=gP(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="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 d,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&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][s]}return s},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:yP(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function yP(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 _P(t){var e;const{labelSpec:i}=t,s=null!==(e=gP(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 bP(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}))):[{index:0,[wT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function xP(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class SP extends OB{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,H(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=Aw({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==Hk.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}SP.type=r.label;class AP extends _C{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=AP.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?pc(t):Gh(t)}}AP.type="text";class wP extends AP{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}wP.type="text",wP.constructorType="label";const TP=()=>{qw.registerMark(AP.type,AP),m_(),b_(),g_(),qw.registerGraphicComponent("text",Gh),qw.registerGraphicComponent("richtext",pc),qw.registerMark(wP.constructorType,wP)};class kP extends PB{_initTheme(t,e){return{spec:t,theme:this._theme}}}class CP extends SP{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=kP,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(ak.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(ak.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),uw(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=Kw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},dP(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[DT])):t=>t.filter((t=>t.data[LT]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?pP(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}CP.type=r.label,CP.specKey="label",CP.transformerConstructor=kP;var MP;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(MP||(MP={}));const BP={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class EP extends OB{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Zx(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||H(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:ck.chart}:{source:hk.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Fg(e)||jg(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(t.ChartEvent.tooltipHide,{source:hk.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:hk.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:hk.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)=>{BP[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:u}=this.getLayoutStartPoint();return n.forEach((t=>{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-u),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-u)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||on&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}EP.specKey="crosshair";const RP={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class PP extends EP{static getSpecInfo(t){return KC(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=RM(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){RM(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:PM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=KE(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new Q_(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new tb(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}PP.specKey="crosshair",PP.builtInTheme={crosshair:RP},PP.type=r.cartesianCrosshair;const OP=(t,e)=>p(e)?t.map((t=>e[t])):void 0,IP=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),LP=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function DP(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=FP(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",u=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=>IP(i,s)(t)&&IP(n,r)(t)&&(d(a)||IP([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:u.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:u.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:hk.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return VC.globalConfig.uniqueTooltip&&VC.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:hk.chart,event:y(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return VC.globalConfig.uniqueTooltip&&VC.hideTooltip(l.id),c}return"none"}const FP=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),u=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=OP(c,t);let y=OP(u,t);const _=LP(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(IP(c,v));if(!_&&(y=OP(u,i),!LP(y)))return;const n=e.type===fw.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Zx(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])=>d(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(IP(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=OP(u,o),!LP(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:u,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(IP(c,n));if(!_&&(y=OP(u,r),!LP(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===fw.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(IP(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=OP(u,i),!LP(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},jP=t=>p(t)&&!_(t),NP=t=>p(t)&&_(t);class UP extends PB{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=Kw({},this._theme,r.style),r.offset=Kw({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:jg(this._option.mode)||!Dg(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=Ap.getElementById(t.parentElement)):Dg(this._option.mode)&&(t.parentElement=null==Lg?void 0:Lg.body)}}const zP={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class HP extends OB{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=UP,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Dg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&jP(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&&!d(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&&VC.globalConfig.uniqueTooltip&&l&&VC.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:hk.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:hk.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?eR.canvas:eR.dom,n=qw.getComponentPluginInType(t);n||Pg("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=qw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Fg(s)||jg(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=DP(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(d(this._cacheInfo)||d(t))return!1;if(NP(t)){if(jP(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>NM(t,e[i])))}if(NP(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}HP.type=r.tooltip,HP.transformerConstructor=UP,HP.builtInTheme={tooltip:zP},HP.specKey="tooltip";function VP(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:u,data:d,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 E(t.style)||(s.textStyle=ek(t.style)),E(t.textStyle)||Kw(s.textStyle,ek(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ek(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ek(s.background.style),s}(s):b.title={visible:!1},E(n.focusIconStyle)||ek(n.focusIconStyle),n.shape&&(n.shape=QT(n.shape)),n.label&&(n.label=QT(n.label)),n.value&&(n.value=QT(n.value)),n.background&&(n.background=QT(n.background)),Iw(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),Iw(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),Iw(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(E(r.railStyle)||ek(r.railStyle),E(r.sliderStyle)||ek(r.sliderStyle)):(E(r.textStyle)||ek(r.textStyle),r.handler&&QT(r.handler)),b.pager=r,a.visible&&!E(a.style)&&(Kw(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const WP=(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},GP=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:wT;return h?h(t,c,g):(_(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(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)};class YP extends OB{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{uw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),uw(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=Ow(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()}_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):(H(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new gC(this._option,e),this._initSelectedData(),uw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(uw(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;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)H(s,this._cacheAttrs)||this._legendComponent.setAttributes(Kw({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Kw({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());H(t,this._cacheAttrs)||this._legendComponent.setAttributes(Kw({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}YP.specKey="legends";class XP extends YP{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return KC(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),uw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){fk(this._option.dataSet,"discreteLegendFilter",GP),fk(this._option.dataSet,"discreteLegendDataMake",WP);const t=new ni(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return uw(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(d(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!Hg(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return u(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&d(t.title.text)&&d(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=YT(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},VP(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return iw}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(ZA.legendItemClick,(i=>{const s=R(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(ZA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ZA.legendItemUnHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity: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 u(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=$C(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=$C(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}XP.specKey="legends",XP.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},XP.type=r.discreteLegend;const $P="vchart-tooltip",KP=`${$P}-container`,qP=`${$P}-title`,ZP=`${$P}-content-box`,JP={offsetX:10,offsetY:10},QP="99999999999999";function tO(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const eO=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,iO=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?tO(t):"",sO=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const s=t(e);S(s)&&(i=s)}return i},nO={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},rO=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=nO[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class aO extends cB{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:w,offsetY:T}=this._option,k=m[_],C=JC(null==k?void 0:k.position,b,e),M=null!==(r=JC(null==k?void 0:k.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},R="canvas"===m.renderMode,P=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==P?void 0:P.width)&&void 0!==o?o:_T,I=null!==(l=null==P?void 0:P.height)&&void 0!==l?l:bT;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},N={x:0,y:0},U=1,z=1;const H=Dg(this._env);if(H&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),H&&!R){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-N.x,y:F.y-N.y},U=eO(e,F),z=eO(t,N)}const V=z/U,W={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?w:T;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(rO(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;W.left=sO(t,y),W.top=sO(i,y),W.right=sO(e,y),W.bottom=sO(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&$.forEach((t=>{const e=C[t];S(e)||u(e)?W[Y[t][0]]=sO(e,y):X(e,t)}));else p(C)&&(X({orient:C,mode:M},"x"),X({orient:C,mode:M},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?w:T,r=rO(G[t],t);if(A(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(A(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=U,H&&(q[t]+=j[t]),q[t]/=z;const a="x"===t?D.width:D.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/U)/z:-N[t]/z,l=a/z+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",lO=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=oO(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=oO(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},hO=(t={})=>{const{lineHeight:e}=t;return t.fontSize?Dw(e,t.fontSize):0},cO=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),r&&(o=Ce(r),a.padding=oO(o)),{panelStyle:a,panelPadding:o}};function uO(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class dO extends aO{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(dO.type),this.type=eR.dom,this._tooltipContainer=null==Lg?void 0:Lg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Lg&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=cO(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:oO(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=lO(h),x=lO(u),S=lO(p),w="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[w]=oO(null!==(i=c.spacing)&&void 0!==i?i:8),x[w]=oO(null!==(s=u.spacing)&&void 0!==s?s:26),S[w]=oO(null!==(n=p.spacing)&&void 0!==n?n:0);const T=Math.max(hO(p),hO(u));return y.lineHeight=T>0?`${T}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(qP))),l=a.find((t=>t.className.includes(ZP)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(qP),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(uO(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${$P}-column`),e.classList.add(`${$P}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(ZP),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];uO(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));uO(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${$P}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=iO(e.key),e.keyStyle&&lO(e.keyStyle,l)):"value"===i?(o.innerHTML=iO(e.value),e.valueStyle&&lO(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?tO(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?tO(c):m,_=p,b=t=>new Xh({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,w;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;w=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(w=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new le));let T=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const k=Un.IsGradientStr(d);if(!d||y(d)&&!k||u)return m=u?"none":d?tO(d):"currentColor",`\n \n \n \n `;const C=k?Un.Parse(d):g(d)?d:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===C.gradient?t=`\n ${i}\n `:"linear"===C.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),uO(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(ZP))),h=[...o.children].find((t=>t.className.includes(qP)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(qP)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=Dw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,uO(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{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},Ec||(Ec=Mc.CreateGraphic("richtext",{})),Ec.setAttributes(a),Ec.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function fO(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:pO),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const mO=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 vO extends aO{constructor(){super(vO.type),this.type=eR.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new ow({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Ce(u.padding),b=Nw(u.padding),x=fO(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=fO(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=fO(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:mO(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:w,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:k={},content:C=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const R=!!C.length;let P=0,O=0,I=0,L=0;if(R){const t=[],e=[],i=[],s=[];let n=0;T.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:T}=r,k={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=Kw({},S,fO(b,void 0,{})),{width:s,height:n,text:r}=gO(h,i);k.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=Kw({},A,fO(x,void 0,{})),{width:e,height:s,text:n}=gO(m,t);k.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};T?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,k.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else k.shape={visible:!1};return k.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(N){V=Kw({},x,fO(z,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:R?Math.ceil(E):void 0);const{text:t,width:e,height:i}=gO(U,V);T.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=T.title.value.width,F=T.title.value.height,j=F+(R?T.title.spaceRow:0)}return B+=j,T.title.width=D,T.title.height=F,W()?M+=E||D:M+=Math.max(D,E),R&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-L-P-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=M,T.panel.height=B,T})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}vO.type=eR.canvas;const yO=/\{([^}]+)\}/,_O=/\{([^}]+)\}/g,bO=/:/;class xO extends cB{constructor(){super(xO.type),this.type="formatterPlugin",this._timeModeFormat={utc:Be.getInstance().timeUTCFormat,local:Be.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Fe.getInstance().format,this._numericSpecifier=Fe.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[xO.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),qw.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=yO.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(_O,((t,i)=>{if(!bO.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(Ie.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}xO.pluginType="chart",xO.specKey="formatter",xO.type="formatterPlugin";VC.useRegisters([()=>{aR(),lR(),cR(),FE(),DE(),xE(),dE(),QM(),eB(),PC(),EC(),rE(),sE(),qw.registerSeries(SE.type,SE),qw.registerChart(uR.type,uR)},()=>{aR(),lR(),cR(),DE(),LR(),FE(),qw.registerChart(FR.type,FR)},()=>{aR(),lR(),cR(),DE(),TR(),FE(),qw.registerChart(CR.type,CR)},()=>{lR(),sP(),qw.registerChart(oP.type,oP)},()=>{aR(),lR(),cR(),FE(),qw.registerChart(cP.type,cP),DE()},sE,rE,()=>{qw.registerComponent(XP.type,XP)},()=>{qw.registerComponent(HP.type,HP)},()=>{qw.registerComponent(PP.type,PP)},()=>{qw.registerGraphicComponent(CP.type,(t=>new NA(t))),TP(),FB(),qw.registerComponent(CP.type,CP,!0,1/0)},()=>{var t;t=vO,qw.registerComponentPlugin(t.type,t)},()=>{var t;t=xO,qw.registerChartPlugin(t.type,t)},jC,zC]),VC.useRegisters([()=>{Kv(Vi)}]),t.DEFAULT_CHART_HEIGHT=bT,t.DEFAULT_CHART_WIDTH=_T,t.DEFAULT_CLOSE_STROKE_JOIN=YC,t.DEFAULT_DATA_INDEX=ST,t.DEFAULT_DATA_KEY=AT,t.DEFAULT_DATA_SERIES_FIELD=wT,t.DEFAULT_KEY=VT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=GC,t.DEFAULT_MEASURE_CANVAS_ID=xT,t.DEFAULT_SERIES_STYLE_NAME=TT,t.DEFAULT_SMOOTH_INTERPOLATE=WC,t.Factory=qw,t.MOSAIC_CAT_END_PERCENT=UT,t.MOSAIC_CAT_START_PERCENT=NT,t.MOSAIC_VALUE_END_PERCENT=jT,t.MOSAIC_VALUE_START_PERCENT=FT,t.ManualTicker=class extends jb{constructor(t){super(t),this.lastFrameTime=0,this.status=es.RUNNING}setupTickHandler(){const t=new Nb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,!0}},t.PREFIX=yT,t.SEGMENT_FIELD_END=HT,t.SEGMENT_FIELD_START=zT,t.STACK_FIELD_END=MT,t.STACK_FIELD_END_OffsetSilhouette=PT,t.STACK_FIELD_END_PERCENT=ET,t.STACK_FIELD_KEY=kT,t.STACK_FIELD_START=CT,t.STACK_FIELD_START_OffsetSilhouette=RT,t.STACK_FIELD_START_PERCENT=BT,t.STACK_FIELD_TOTAL=OT,t.STACK_FIELD_TOTAL_BOTTOM=DT,t.STACK_FIELD_TOTAL_PERCENT=IT,t.STACK_FIELD_TOTAL_TOP=LT,t.StreamLight=class extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Gi.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new pn,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Gi.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-n,p=d+(s-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Ps(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(u=(o-a)/c.getLength());const[e]=Ps(c||s,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;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(u(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(d(i))for(let i=0;i(l(t),t)))},t.measureText=vT,t.normalizeLayoutPaddingSpec=Nw,t.queryColorFromColorScheme=Sw,t.queryToken=Vw,t.registerDataSetInstanceParser=mk,t.registerDataSetInstanceTransform=fk,t.registerTheme=rT,t.removeTheme=oT,t.themeExist=lT,t.themes=iT,t.token=Gw,t.transformColorSchemeToStandardStruct=kw,t.transformToGraphic=ek,t.version="2.0.6",t.vglobal=Ap,t.warn=Rg,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index aa7f47f439..b0f479fcb1 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "2.0.5", + "version": "2.0.6", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -122,11 +122,11 @@ "@visactor/vdataset": "~1.0.6", "@visactor/vscale": "~1.0.6", "@visactor/vlayouts": "~1.0.6", - "@visactor/vrender-core": "1.0.13", - "@visactor/vrender-kits": "1.0.13", - "@visactor/vrender-components": "1.0.13", - "@visactor/vrender-animate": "1.0.13", - "@visactor/vutils-extension": "workspace:2.0.5" + "@visactor/vrender-core": "~1.0.18", + "@visactor/vrender-kits": "~1.0.18", + "@visactor/vrender-components": "~1.0.18", + "@visactor/vrender-animate": "~1.0.18", + "@visactor/vutils-extension": "workspace:2.0.6" }, "publishConfig": { "access": "public", diff --git a/packages/vchart/src/chart/waterfall/waterfall-transformer.ts b/packages/vchart/src/chart/waterfall/waterfall-transformer.ts index 96dfcdf376..ee68100a55 100644 --- a/packages/vchart/src/chart/waterfall/waterfall-transformer.ts +++ b/packages/vchart/src/chart/waterfall/waterfall-transformer.ts @@ -26,6 +26,7 @@ export class WaterfallChartSpecTransformer< series.stackLabel = spec.stackLabel; series.leaderLine = spec.leaderLine; series.total = spec.total; + series.calculationMode = spec.calculationMode; return series; } diff --git a/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts b/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts index 7ca8390c6a..84d7d500b9 100644 --- a/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts +++ b/packages/vchart/src/component/marker/mark-line/cartesian-mark-line.ts @@ -111,6 +111,10 @@ export class CartesianMarkLine extends BaseMarkLine { expandDistanceValue = expandDistance as number; } const { points, limitRect } = updateAttrs; + if (!points || points.length < 2) { + this._markerComponent?.setAttributes(updateAttrs); + return; + } const joinPoints = getInsertPoints( (points as IPoint[])[0], diff --git a/packages/vchart/src/data/transforms/waterfall.ts b/packages/vchart/src/data/transforms/waterfall.ts index 29c0586b29..dd68b8ddef 100644 --- a/packages/vchart/src/data/transforms/waterfall.ts +++ b/packages/vchart/src/data/transforms/waterfall.ts @@ -29,6 +29,8 @@ export interface IWaterfallOpt { startAs: string; endAs: string; total: IWaterfallSeriesSpec['total']; + calculationMode: 'increase' | 'decrease'; + seriesFieldName: { total: string; increase: string; @@ -42,7 +44,7 @@ export const waterfall = (lastData: Array, op: IWaterfallOpt) => { if (!lastData || lastData.length === 0) { return lastData; } - const { indexField, total: totalSpec, groupData } = op; + const { indexField, total: totalSpec, groupData, calculationMode } = op; const totalData: { start: number; end: number; @@ -57,7 +59,10 @@ export const waterfall = (lastData: Array, op: IWaterfallOpt) => { dimensionValues: { [key in string]: Set }; dimensionData: { [key in string]: Datum[] }; }; - const indexValues = Array.from(dimensionValues[indexField]); + let indexValues = Array.from(dimensionValues[indexField]); + if (calculationMode === 'decrease') { + indexValues = indexValues.reverse(); + } // 上一次的计算结果 let temp: { start: number; end: number; lastIndex: string; positive: number; negative: number } = { start: 0, @@ -320,13 +325,14 @@ export interface IWaterfallFillEndOpt { valueField: string; seriesField?: string; total: IWaterfallSeriesSpec['total']; + calculationMode: IWaterfallSeriesSpec['calculationMode']; } export const waterfallFillTotal = (data: Array, op: IWaterfallFillEndOpt) => { if (!data) { return data; } - const { indexField, valueField, total, seriesField } = op; + const { indexField, valueField, total, seriesField, calculationMode } = op; const totalData = { [indexField]: total?.text || 'total', [valueField]: data.reduce((pre, cur) => precisionAdd(pre, +cur[valueField]), 0) @@ -334,6 +340,10 @@ export const waterfallFillTotal = (data: Array, op: IWaterfallFillEndOpt) if (seriesField) { totalData[seriesField] = 'total'; } - data.push(totalData); + if (calculationMode === 'decrease') { + data.unshift(totalData); + } else { + data.push(totalData); + } return data; }; diff --git a/packages/vchart/src/plugin/chart/formatter/formatter.ts b/packages/vchart/src/plugin/chart/formatter/formatter.ts index fb78cd8bb2..a67c9f540e 100644 --- a/packages/vchart/src/plugin/chart/formatter/formatter.ts +++ b/packages/vchart/src/plugin/chart/formatter/formatter.ts @@ -1,21 +1,16 @@ import { isFunction, isArray, TimeUtil, NumberUtil, numberSpecifierReg } from '@visactor/vutils'; - import { BasePlugin } from '../../base/base-plugin'; - import type { IChartPlugin, IChartPluginService } from '../interface'; import { Factory } from '../../../core/factory'; import { registerChartPlugin } from '../register'; const bracketReg = /\{([^}]+)\}/; const bracketGReg = /\{([^}]+)\}/g; - const semicolonReg = /:/; export class FormatterPlugin extends BasePlugin implements IChartPlugin { static readonly pluginType: 'chart' = 'chart'; - static readonly specKey = 'formatter'; - static readonly type: string = 'formatterPlugin'; readonly type: string = 'formatterPlugin'; @@ -32,7 +27,6 @@ export class FormatterPlugin extends BasePlugin implements IChartPlugin { }; protected _formatter = this._format; - private _timeFormatter = this._timeModeFormat.local; private _numericFormatter = NumberUtil.getInstance().format; @@ -130,10 +124,76 @@ export class FormatterPlugin extends BasePlugin implements IChartPlugin { return this._numericFormatter(formatter, Number(text)); } else if (formatter.includes('%') && this._timeFormatter) { return this._timeFormatter(formatter, text); + } else if (formatter.startsWith('calc(')) { + return this._calcFormatter(formatter, text); } return text; } + /** + * 安全地计算数学表达式 + * 支持基本运算:+ - * / ( ) 和变量 v + * @param formatter 格式字符串,如 "calc(v*2+1)" + * @param text 要计算的数值 + * @returns 计算结果或原始文本(如果计算失败) + */ + private _calcFormatter(formatter: string, text: string | number): string | number { + try { + // 提取表达式部分,移除 "calc(" 和 ")" + const expression = formatter.slice(5, -1).replace(/v/g, String(text)); + + // 使用安全的数学表达式计算器 + return this._calculateMathExpression(expression, text); + } catch (e) { + return text; + } + } + + /** + * 安全的数学表达式计算器 + * 支持操作符:+ - * / ( ) 和数字 + * @param expression 数学表达式字符串 + * @returns 计算结果 + */ + private _calculateMathExpression(expression: string, text: string | number): number | string { + // 移除所有空白字符 + const cleanExpression = expression.replace(/\s+/g, ''); + + // 验证表达式只包含允许的字符 + if (!this._isValidMathExpression(cleanExpression)) { + return text; + } + + // 使用 Function 构造函数创建安全的计算函数 + // 这比 eval 安全,因为它只能访问提供的参数 + try { + // 将表达式转换为安全的函数调用 + // 例如: "2+3*4" -> "return (2+3*4)" + const safeFunction = new Function('return (' + cleanExpression + ')'); + const result = safeFunction(); + + // 验证结果是否为有效数字 + if (typeof result !== 'number' || isNaN(result) || !isFinite(result)) { + throw new Error('Invalid calculation result'); + } + + return result; + } catch (error) { + return text; + } + } + + /** + * 验证数学表达式是否只包含允许的字符 + * @param expression 要验证的表达式 + * @returns 是否有效 + */ + private _isValidMathExpression(expression: string): boolean { + // 只允许数字、小数点、运算符和括号 + const validPattern = /^[0-9+\-*/().]+$/; + return validPattern.test(expression); + } + release() { super.release(); this._format = null; diff --git a/packages/vchart/src/series/waterfall/interface.ts b/packages/vchart/src/series/waterfall/interface.ts index f5b316e05e..eec6615c05 100644 --- a/packages/vchart/src/series/waterfall/interface.ts +++ b/packages/vchart/src/series/waterfall/interface.ts @@ -89,6 +89,13 @@ export interface IWaterfallSeriesSpec /** 标签偏移量 */ offset?: number; }; + + /** + * 瀑布图类型 + * 默认为 increase 增长瀑布图 + * @since 2.0.6 + */ + calculationMode?: 'increase' | 'decrease'; } export interface IWaterfallSeriesTheme extends IBarSeriesTheme { diff --git a/packages/vchart/src/series/waterfall/waterfall.ts b/packages/vchart/src/series/waterfall/waterfall.ts index f2f0ed3178..cd17cc5a9d 100644 --- a/packages/vchart/src/series/waterfall/waterfall.ts +++ b/packages/vchart/src/series/waterfall/waterfall.ts @@ -103,6 +103,7 @@ export class WaterfallSeries this.getGroups().groupData, stackInverse: this.getRegion().getStackInverse() } @@ -301,6 +303,7 @@ export class WaterfallSeries this.totalPositionY(datum, 'index', 0) + y1: (datum: Datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0) }, 'normal', AttributeLevel.Series @@ -329,9 +332,9 @@ export class WaterfallSeries this.totalPositionX(datum, 'index', 0), + x1: (datum: Datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0), y: (datum: Datum) => this.totalPositionY(datum, 'lastEnd', 0), y1: (datum: Datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0) }, diff --git a/packages/vstory/package.json b/packages/vstory/package.json index a6f5f032c1..d7dc0863d3 100644 --- a/packages/vstory/package.json +++ b/packages/vstory/package.json @@ -21,9 +21,9 @@ }, "dependencies": { "@visactor/vchart": "workspace:1.11.0", - "@visactor/vrender-core": "1.0.13", - "@visactor/vrender-kits": "1.0.13", - "@visactor/vrender-components": "1.0.13", + "@visactor/vrender-core": "~1.0.18", + "@visactor/vrender-kits": "~1.0.18", + "@visactor/vrender-components": "~1.0.18", "@visactor/vutils": "~1.0.6" }, "devDependencies": { @@ -42,4 +42,4 @@ "vite": "3.2.6", "typescript": "4.9.5" } -} \ No newline at end of file +} diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index adc4227718..dcb57f39f8 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "2.0.5", + "version": "2.0.6", "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 5851027d16..d9702cc40d 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){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,i=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,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const Tt=4294967296;const wt=t=>e=>L(e,t),Ct=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||wt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Bt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Pt=t=>0,Lt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Dt=1e-12,Ft=Math.PI,zt=Ft/2,jt=2*Ft,Ht=2*Math.PI,Vt=Math.abs,Nt=Math.atan2,Ut=Math.cos,Wt=Math.max,Gt=Math.min,Yt=Math.sin,$t=Math.sqrt,Xt=Math.pow;function Kt(t){return t>=1?zt:t<=-1?-zt:Math.asin(t)}function qt(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 Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 ne{static distancePP(t,e){return $t(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return $t(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=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 ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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 pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(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 ve(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}=ye(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 _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(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 be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(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 Ae(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Te(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Te(t,i),n=Te(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ae(n,i)+Ae(n,s))/2>Ae(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Le(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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=Oe(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(_(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(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.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(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.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)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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 Ne;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class Ue{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 We(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},Xe={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return S(t)?new ei(t>>16,t>>8&255,255&t,1):y(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p($e[t]))return function(t){return S(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}($e[t]);if(p(Xe[t]))return qe(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(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 ei(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=We(u(t)?n.h:mt(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 ei(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=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ai(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 oi(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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):Ai[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=Ai[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:_,group:y,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?xi[8+mi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const Ai={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function As(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ui(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=As(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Bs.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Fi,w=f*x;if(Bs.add(Gi(w*k*qi(M),m*S+w*Yi(M))),a+=T?A+k*Hi:A,T^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var E=us(r,C);fs(E);var B=(T^A>=0?-1:1)*es(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Di||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(Is))}return u}}function Is(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Ls).length&&(Es=Cs,Cs=function(t,e){return Ls(Es(t),e)});var Fs=Os((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?Fi:-Fi,l=Ui(r-i);Ui(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Ui(i-n)Di?Wi((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Ui(t[0]-e[0])>Di){var r=t[0]0,n=Ui(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ui(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var T=gs(p,(-g+v)/f);return ps(T,u),[_,hs(T)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Ui(s[0]-t)0?0:3:Ui(s[0]-i)0?2:1:Ui(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,f,m,v,_,y=a,b=As(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ts(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Us,Ws,Gs,Ys,$s=Li(),Xs=Li(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,$s.add(Ui(Xs)),Xs.reset()},result:function(){var t=$s/2;return $s.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Us=Gs=t,Ws=Ys=e}function Js(t,e){Xs.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Us,Ws)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=Tn,bn.lineEnd=wn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=An}function An(t,e){bn.point=kn,xn(ln=t,hn=e)}function kn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function Tn(){bn.point=Cn}function wn(){En(an,on)}function Cn(t,e){bn.point=En,xn(an=ln=t,on=hn=e)}function En(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var Bn=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Ln,Rn,On,In,Dn,Fn=Li(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Ln&&Hn(Rn,On),zn.point=is},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,Rn=In=t,On=Dn=e}function Hn(t,e){In-=t,Dn-=e,Fn.add(Ji(In*In+Dn*Dn)),In=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Un(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function $n(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return $n(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 Kn(t,e,i){return Xn(t,[[0,0],e],i)}function qn(t,e,i){return $n(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 Zn(t,e,i){return $n(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)}Nn.prototype={_radius:4.5,_circle:Un(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=Un(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Ji(b*b+x*x+S*S),k=es(S/=A),M=Ui(Ui(S)-1)e||Ui((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,E()):[m*Vi,v*Vi,_*Vi]},w.angle=function(t){return arguments.length?(y=t%360*Ni,E()):y*Vi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=tr(o,T=t*t),B()):Ji(T)},w.fitExtent=function(t,e){return Xn(w,t,e)},w.fitSize=function(t,e){return Kn(w,t,e)},w.fitWidth=function(t,e){return qn(w,t,e)},w.fitHeight=function(t,e){return Zn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Ui(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):Xi(i/Yi(e))/Xi(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Ui(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Wi(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Ui(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Er.invert=dr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi($i(t))-zi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+qr(e,6):qr(e,4))+"-"+qr(t.getUTCMonth()+1,2)+"-"+qr(t.getUTCDate(),2)+(r?"T"+qr(i,2)+":"+qr(s,2)+":"+qr(n,2)+"."+qr(r,3)+"Z":n?"T"+qr(i,2)+":"+qr(s,2)+":"+qr(n,2)+"Z":s||i?"T"+qr(i,2)+":"+qr(s,2)+"Z":"")}function Jr(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 $r;if(h)return h=!1,Yr;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(;a0}function ha(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=ia(t));var r=[];switch(t.type){case"GeometryCollection":return ca(t,(function(t){ua(t,s)})),t;case"FeatureCollection":return ha(t,(function(t){ha(ua(t,s),(function(t){r.push(t)}))})),oi(r)}return ua(t,s)}function ua(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ca(t,(function(t){ua(t,e)})),t;case"LineString":return pa(oa(t),e),t;case"Polygon":return ga(oa(t),e),t;case"MultiLineString":return oa(t).forEach((function(t){pa(t,e)})),t;case"MultiPolygon":return oa(t).forEach((function(t){ga(t,e)})),t;case"Point":case"MultiPoint":return t}}function pa(t,e){la(t)===e&&t.reverse()}function ga(t,e){la(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=fa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ya=(t,e={},i)=>{i.type=Wr.GEO;const s=jr(va,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(_a(t))})):e.push(_a(t))})),e})(t);let l=t.features;return o&&(l=da(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ma.bounds(t);t.bbox=e}})),t.features=l,t},ba={},xa=(t,e,i)=>{i.type=Wr.GEO;const s=jr(va,ba,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 Lr(a,t)}))}:Lr(a,o));var a,o;return ya(r,s,i)},Sa=(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 Aa=0;function ka(t="dataset"){return Aa>1e8&&(Aa=0),t+"_"+Aa++}class Ma{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:ka("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()}}class Ta{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ta||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ca={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ea=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ea.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class La{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",Da="inversify:tagged",Fa="inversify:paramtypes";class za{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ja=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 Ha(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ja.hasOwnMetadata(t,e)&&(r=ja.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ja.defineMetadata(t,r,e)}(Da,t,i.toString(),s)}function Va(t){return(e,i,s)=>{Ha(e,0,s,t)}}function Na(t){return e=>(i,s,n)=>Va(new za(t,e))(i,s,n)}const Ua=Na(Oa),Wa=Na(Ia);function Ga(){return function(t){return ja.defineMetadata(Fa,null,t),t}}function Ya(t){return Va(new za(Ra,t))}const $a="Singleton",Xa="Transient",Ka="ConstantValue",qa="DynamicValue",Za="Factory",Ja="Function",Qa="Instance",to="Invalid";class eo{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=to,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new eo(this.serviceIdentifier,this.scope);return t.activated=t.scope===$a&&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 io{getConstructorMetadata(t){return{compilerGeneratedMetadata:ja.getMetadata(Fa,t),userGeneratedMetadata:ja.getMetadata(Da,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const so=(no=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===no&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const oo=Symbol("ContributionProvider");class lo{constructor(t,e){this.serviceIdentifier=t,this.container=e,co.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function ho(t,e){t(oo).toDynamicValue((({container:t})=>new lo(e,t))).inSingletonScope().whenTargetNamed(e)}class co{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}co.store=new Map;class uo{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 po extends uo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const go=Symbol.for("EnvContribution"),fo=Symbol.for("VGlobal");const mo=new class{};let vo=0;class _o{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=mo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++vo,t),this.tryRunAnimationFrameNextFrame(),vo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class yo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var bo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},So=function(t,e){return function(i,s){e(i,s,t)}},Ao=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 ko=class extends yo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new po(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new _o);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Ao(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Mo,To,wo,Co;ko=bo([Ga(),So(0,Ua(oo)),So(0,Ya(go)),xo("design:paramtypes",[Object])],ko),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Mo||(Mo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(To||(To={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Co||(Co={}));const Eo=jt-1e-8;class Bo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Eo)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Lo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ro={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 Io,Do,Fo,zo,jo,Ho;var Vo,No,Uo,Wo,Go,Yo;function $o(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function Xo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const E=Math.ceil(Math.abs(C/(zt+.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 qo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=sl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function rl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new al(i,n),new al(n,s)]}class al extends Zo{constructor(t,e){super(),this.type=Go.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Wo.ROW?Vt(this.p0.x-this.p1.x):t===Wo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ol{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new nl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new al(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Wo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Wo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class ll extends ol{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 hl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function cl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Wo.ROW:Wo.COLUMN;return"monotoneY"===t?new ll(t,s):new ol(t,s)}class dl{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 ul(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=cl("linear",i,t);return function(t,e){hl(t,e,1)}(new dl(n,s),t),n}function pl(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 gl{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&&pl(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:pl(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 fl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ul(t,e);const n=cl("basis",i,t);return function(t,e){hl(t,e,2)}(new gl(n,s),t),n}function ml(t){return t<0?-1:1}function vl(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(ml(r)+ml(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function _l(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function yl(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 bl{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:yl(this,this._t0,_l(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,yl(this,_l(this,e=vl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:yl(this,this._t0,e=vl(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 xl extends bl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ul(t,e);const n=cl("monotoneX",i,t);return function(t,e){hl(t,e,2)}(new bl(n,s),t),n}function Al(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return ul(t,e);const n=cl("monotoneY",i,t);return function(t,e){hl(t,e,2)}(new xl(n,s),t),n}let kl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class Ml extends kl{lineEnd(){this.context.closePath()}}function Tl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ol("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new kl(r,e,n),t),r}function wl(t,e){return hl(t,e,1)}class Cl extends dl{lineEnd(){this.context.closePath()}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=cl("linear",i,t);return function(t,e){hl(t,e,1)}(new Cl(n,s),t),n}function Bl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){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>Dt){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 Pl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return ul(i,n);const o=cl(t,r,i);return hl(new e(o,s,a),i,2),o}}const Ll=Pl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Bl(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 Rl=Pl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Bl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Ol extends Zo{constructor(t,e,i){super(),this.type=Go.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return il(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Jo([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Wo.ROW?Vt(this.p0.x-this.p2.x):t===Wo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=il(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new Ol(i,a,r),new Ol(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Il{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new al(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new Ol(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new nl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Dl(t,e,i){var s,n;switch(e){case"linear":default:return ul(t,i);case"basis":return fl(t,i);case"monotoneX":return Sl(t,i);case"monotoneY":return Al(t,i);case"step":return Tl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ol("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Wo.ROW:Wo.COLUMN);return wl(new Ml(r,e,n),t),r}(t,.5,i);case"stepBefore":return Tl(t,0,i);case"stepAfter":return Tl(t,1,i);case"catmullRom":return Ll(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Rl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return El(t,i)}}class Fl extends Po{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Bo(this.bounds)}get curves(){return this.tryBuildCurves()}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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Il(this);qo(this.commandList,t,0,0,1,1)}return this._curves}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=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`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;tHo){let t,e=Fo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),qo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Wo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Wo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),eh=Object.assign(Object.assign({},$l),{points:[],cornerRadius:0,closePath:!0}),ih=Object.assign(Object.assign({},$l),{width:100,height:100,spikes:5,thickness:.5}),sh=Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},$l),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const nh=Object.assign(Object.assign({},$l),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),rh=Object.assign(Object.assign(Object.assign({},$l),Wl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ah=Object.assign(Object.assign(Object.assign({},$l),Wl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),oh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},$l),{fill:!0,cornerRadius:0,cornerType:"round"}),lh=Object.assign(Object.assign({},oh),{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}),hh=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&&_(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 ch{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(ch.IsGradientStr(t))try{const e=hh(t)[0];if(e){if("linear"===e.type)return ch.ParseLinear(e);if("radial"===e.type)return ch.ParseRadial(e);if("conic"===e.type)return ch.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:ch.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:ch.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const ph={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"}},gh=!0,fh=!1,mh=/\w|\(|\)|-/,vh=/[.?!,;:/,。?!、;:]/,_h=/\S/,yh=(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})};function bh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=mo.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=xh(t,a)),a}function xh(t,e,i=!1){let s=e;for(;mh.test(t[s-1])&&mh.test(t[s])||vh.test(t[s]);)if(s--,s<=0)return i?Sh(t,e):e;return s}function Sh(t,e){let i=e;for(;mh.test(t[i+1])&&mh.test(t[i])||vh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ah(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=mo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var kh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Mh=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=rh.fontSize}){let i=0,s=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=xh(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,a=!1){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=xh(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}};Mh=kh([Ga()],Mh);var Th=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=Symbol.for("TextMeasureContribution");let Ch=class extends Mh{};Ch=Th([Ga()],Ch);const Eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new io}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new eo(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ao(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ka:case Ja:e=t.cache;break;case Qa: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===$a&&(t.cache=e,t.activated=!0)}},Bh=Symbol.for("CanvasFactory"),Ph=Symbol.for("Context2dFactory");function Lh(t){return Eh.getNamed(Bh,mo.global.env)(t)}const Rh=1e-4,Oh=Math.sqrt(3),Ih=1/3;function Dh(t){return t>-Kh&&tKh||t<-Kh}const zh=[0,0],jh=[0,0],Hh=[0,0];function Vh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Nh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Uh(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 Wh(t){return(t%=Ht)<0&&(t+=Ht),t}function Gh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Xh(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(Dh(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 Zh=[-1,-1,-1],Jh=[-1,-1];function Qh(){const t=Jh[0];Jh[0]=Jh[1],Jh[1]=t}function tc(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(Dh(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,Ih):Math.pow(i,Ih),s=s<0?-Math.pow(-s,Ih):Math.pow(s,Ih);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+Oh*Math.sin(e)))/(3*a),h=(-o+i*(s-Oh*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,Zh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Qh(),p=Uh(e,s,r,o,Jh[0]),u>1&&(g=Uh(e,s,r,o,Jh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Dh(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,Zh);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=Nh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Zh[0]=-l,Zh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=Zh[0]+t&&a<=Zh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=Zh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function sc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function nc(t,e){let i=sc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-sc(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;rc[0]=S,rc[1]=A,nc(rc,Boolean(a[6])),S=rc[0],A=rc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Oo.M:u=m,p=v,c=u,d=p;break;case Oo.L:if(i){if(Xh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Oo.C:if(i){if(Yh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=tc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Oo.Q:if(i){if(Gh(c,d,m,v,_,y,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Oo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if($h(m,v,_,k,k+M,T,e,w,n))return!0}else h+=ic(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Oo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Xh(u,p,o,p,e,s,n)||Xh(o,p,o,l,e,s,n)||Xh(o,l,u,l,e,s,n)||Xh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Oo.Z:if(i){if(Xh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},hc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const cc=Symbol.for("VWindow"),dc=Symbol.for("WindowHandlerContribution");let uc=class extends yo{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(){super(),this.hooks={onChange:new po(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Eh.getNamed(dc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=mo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};uc=lc([Ga(),hc("design:paramtypes",[])],uc);var pc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fc=function(t,e){return function(i,s){e(i,s,t)}};let mc=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=mo.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=oc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e,i="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:Wl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Wl.fontFamily,fontSize:Wl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Eh.get(cc),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 vc;mc=pc([Ga(),fc(0,Ua(oo)),fc(0,Ya(wh)),gc("design:paramtypes",[Object])],mc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(vc||(vc={}));const _c=new Ne;let yc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=vc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=vc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(_c.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(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}scale(t,e,i){return this.mode===vc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===vc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return _c.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(_c.a,_c.b,_c.c,_c.d,_c.e,_c.f),this}translate(t,e){return this.mode===vc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===vc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};yc=pc([Ga(),gc("design:paramtypes",[])],yc);const bc={arc:Xl,area:Kl,circle:ql,line:Ql,path:th,symbol:nh,text:rh,rect:sh,polygon:eh,star:ih,richtext:ah,richtextIcon:lh,image:oh,group:Zl,glyph:Jl},xc=Object.keys(bc);function Sc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ac={arc:Object.assign({},bc.arc),area:Object.assign({},bc.area),circle:Object.assign({},bc.circle),line:Object.assign({},bc.line),path:Object.assign({},bc.path),symbol:Object.assign({},bc.symbol),text:Object.assign({},bc.text),rect:Object.assign({},bc.rect),polygon:Object.assign({},bc.polygon),star:Object.assign({},bc.star),richtext:Object.assign({},bc.richtext),richtextIcon:Object.assign({},bc.richtextIcon),image:Object.assign({},bc.image),group:Object.assign({},bc.group),glyph:Object.assign({},bc.glyph)};class kc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},xc.forEach((t=>{this._defaultTheme[t]=Object.create(Ac[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;xc.forEach((s=>{const n=Object.create(Ac[s]);t&&t[s]&&Sc(n,t[s]),i[s]&&Sc(n,i[s]),e[s]&&Sc(n,e[s]),this.combinedTheme[s]=n})),e.common&&xc.forEach((t=>{Sc(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 Mc=new kc;function Tc(t,e){return t.glyphHost?Tc(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)):Mc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Tc(t.attachedThemeGraphic)||Mc.getTheme()}var wc=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 Cc 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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return wc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Pc))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(Ic(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 Pc))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=Ic(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 Pc))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=Ic(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 Pc))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=Ic(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 Pc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Oc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Ic(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(Ic(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,Ic(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 Pc))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"):Ic(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 Lc))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=Oc.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 Dc(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 Pc,this.rootWheelEvent=new Lc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Hc{static GetImage(t,e){var i;const s=Hc.cache.get(t);s?"fail"===s.loadState?mo.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):Hc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Hc.cache.get(t);s?"fail"===s.loadState?mo.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"},Hc.cache.set(t,s),s.dataPromise=mo.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=Hc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Hc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=mo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=mo.global.loadBlob(t):"json"===e&&(i.dataPromise=mo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Hc.isLoading&&Hc.toLoadAueue.length){Hc.isLoading=!0;const t=Hc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Hc.cache.set(i,n),n.dataPromise=mo.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((()=>{Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()})).catch((t=>{console.error(t),Hc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Hc.loading()}))}}),0)}static loadImage(t,e){const i=Vc(t,Hc.toLoadAueue);if(-1!==i)return Hc.toLoadAueue[i].marks.push(e),void Hc.loading();Hc.toLoadAueue.push({url:t,marks:[e]}),Hc.loading()}static improveImageLoading(t){const e=Vc(t,Hc.toLoadAueue);if(-1!==e){const t=Hc.toLoadAueue.splice(e,1);Hc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Vc(t,e){for(let i=0;it?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,Yc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],$c=[1,2,3,0,1,2,3,0];function Xc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;Yc[0].x=i,Yc[1].y=i,Yc[2].x=-i,Yc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Ut(t)*i,Yt(t)*i),s.add(Ut(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;e<$c.length;e++)if(t||n!==$c[e]){if(t&&r===$c[e])break;if(t){const t=Yc[$c[e]];s.add(t.x,t.y)}}else{t=!0;const e=Yc[n];s.add(e.x,e.y)}}}function Kc(t,e,i){const{x:s,y:n}=qt(t.x,t.y,e.x,e.y,i),{x:r,y:a}=qt(t.x1,t.y1,e.x1,e.y1,i),o=new se(s,n,r,a);return o.defined=e.defined,o}function qc(t,e,i){if(!t||!e)return[];Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]);let s=[];if(t.length>e.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Jc.TimeOut=1e3/60;const Qc=new Jc,td=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ed{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 id(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var sd=new class extends ed{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 id(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return id(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 nd=new class extends ed{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 rd(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 ad=new class extends ed{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 rd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return rd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return rd(t,this.parseSize(e)/2+n,i,s,r)}};function od(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ld=new class extends ed{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}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,n=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 cd extends ed{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 hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}}var dd=new cd;var ud=new class extends cd{constructor(){super(...arguments),this.type="triangle"}};const pd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),gd=Math.sin(jt/10)*pd,fd=-Math.cos(jt/10)*pd;function md(t,e,i,s){const n=gd*e,r=fd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 vd=new class extends ed{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 md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return md(t,this.parseSize(e)/2+n,i,s)}};const _d=$t(3);function yd(t,e,i,s){const n=e,r=n/_d,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 bd=new class extends ed{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 yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return yd(t,this.parseSize(e)/2+n,i,s)}};function xd(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 Sd=new class extends ed{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};function Ad(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var kd=new class extends ed{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2+n,i,s)}};const Md=-.5,Td=$t(3)/2,wd=1/$t(12);function Cd(t,e,i,s){const n=e/2,r=e*wd,a=n,o=e*wd+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(Md*n-Td*r+i,Td*n+Md*r+s),t.lineTo(Md*a-Td*o+i,Td*a+Md*o+s),t.lineTo(Md*l-Td*h+i,Td*l+Md*h+s),t.lineTo(Md*n+Td*r+i,Md*r-Td*n+s),t.lineTo(Md*a+Td*o+i,Md*o-Td*a+s),t.lineTo(Md*l+Td*h+i,Md*h-Td*l+s),t.closePath(),!1}var Ed=new class extends ed{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 Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};function Bd(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 Pd=new class extends ed{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 Bd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Bd(t,this.parseSize(e)/2,i,s,n)}};function Ld(t,e,i,s,n=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 Rd=new class extends ed{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 Ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s,n)}};function Od(t,e,i,s,n=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 Id=new class extends ed{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2,i,s,n)}};const Dd=$t(3);function Fd(t,e,i,s){const n=e*Dd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var zd=new class extends ed{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Fd(t,this.parseSize(e)/2/Dd,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2/Dd+n,i,s)}};function jd(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 Hd=new class extends ed{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 jd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/4+n,i,s)}};function Vd(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 Nd=new class extends ed{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 Vd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/4+n,i,s)}};function Ud(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 Wd=new class extends ed{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 Ud(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends ed{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Xd=new class extends ed{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return $d(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return $d(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 Kd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var qd=new class extends ed{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Kd(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 Zd(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 ed{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 Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(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 Qd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function tu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var eu=new class extends ed{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)?tu(t,e,i,s):Qd(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?tu(t,e+2*n,i,s):Qd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const iu=new He;class su{constructor(t,e,i=!1){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(),qo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(qo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{iu.x1=i.bounds.x1*t,iu.y1=i.bounds.y1*t,iu.x2=i.bounds.x2*t,iu.y2=i.bounds.y2*t,e.union(iu)}))}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 nu={};[sd,nd,ad,ld,zd,ud,vd,bd,Sd,kd,Ed,Pd,Rd,dd,Id,Hd,Nd,Wd,Yd,eu,Xd,qd,Jd].forEach((t=>{nu[t.type]=t}));const ru={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class au{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 ou(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function lu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=lu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ou(t,"--\x3e",r+4,"Comment is not closed.");else{const a=lu(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 au(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 au(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 du(t,e){return uu(t)}function uu(t,e){const i={};for(let e=0;exu.set(t,!0)));const Su=new Map;function Au(t){if(xu.has(t))return!0;if(Su.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Su.set(t,!0)));const ku=yu(),Mu=yu(),Tu=yu(),wu=yu(),Cu=yu(),Eu=yu(),Bu=yu(),Pu=yu(),Lu=yu(),Ru=yu();yu();const Ou=yu();yu();const Iu=yu();yu();const Du=yu(),Fu=yu(),zu=Symbol.for("GraphicService"),ju=Symbol.for("GraphicCreator"),Hu={"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"},Vu=Object.keys(Hu),Nu={duration:200,easing:"cubicOut"};function Uu(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 Wu(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 Gu(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 Yu(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function $u(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 Xu{constructor(){this.pools=[]}static identity(t){return Uu(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 Xu.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},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Qu=new Ne(1,0,0,1,0,0),tp={x:0,y:0};let ep=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Fl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Ku.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},tp),function(t,e,i){return ac(t,0,!1,e,i)}(this.path.commandList,tp.x,tp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},tp);const i=dh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return ac(t,e,!0,i,s)}(this.path.commandList,i,tp.x,tp.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Qu,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};ep=Zu([Ga(),Ju("design:paramtypes",[Object,Number])],ep);const ip={WIDTH:500,HEIGHT:500,DPR:1};class sp{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}set nativeCanvas(t){this._nativeCanvas=t}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=ip.WIDTH,height:n=ip.HEIGHT,dpr:r=ip.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var np;sp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(np||(np={}));class rp{static Get(t,e=np.Color1,i=[0,0,0,1]){if(e===np.Color1){const e=rp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];rp.store1[t]=e,rp.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=rp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(rp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],rp.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===np.Color1){if(rp.store1[t])return;rp.store1[t]=i,rp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rp.store255[t])return;rp.store255[t]=i,rp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function ap(t,e=!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 op(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)=>{var a,o;return lp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):lp(t,e,i,s,n)}function lp(t,e,i,s,n){if(!t||!e)return t&&ap(t)||e&&ap(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rp.Get(t,np.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rp.Get(e,np.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:ap(a)})))});return o?op(r,l,i,s,n):op(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:up(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:up(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:up(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),ap(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)}function hp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}rp.store255={},rp.store1={};const cp=[0,0,0,0],dp=[0,0,0,0];function up(t,e,i){return rp.Get(t,np.Color255,cp),rp.Get(e,np.Color255,dp),`rgba(${Math.round(cp[0]+(dp[0]-cp[0])*i)},${Math.round(cp[1]+(dp[1]-cp[1])*i)},${Math.round(cp[2]+(dp[2]-cp[2])*i)},${cp[3]+(dp[3]-cp[3])*i})`}class pp{static GetCanvas(){try{return pp.canvas||(pp.canvas=mo.global.createCanvas({})),pp.canvas}catch(t){return null}}static GetCtx(){if(!pp.ctx){const t=pp.GetCanvas();pp.ctx=t.getContext("2d")}return pp.ctx}}class gp extends Ue{static getInstance(){return gp._instance||(gp._instance=new gp),gp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=pp.GetCanvas(),s=pp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new gp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class fp{static GetSize(t){for(let e=0;e=t)return fp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=fp.GenKey(t,e,i,s,n),l=fp.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=fp.GenKey(t,e,i,s,n);fp.cache[l]?fp.cache[l].push({width:a,height:o,pattern:r}):fp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}fp.cache={},fp.ImageSize=[20,40,80,160,320,640,1280,2560];const mp=new He,vp=new Ne;new He;const _p=["lineWidth","scaleX","scaleY","angle","anchor","visible"],yp=["x","y"],bp=["scaleX","scaleY"],xp=["angle"],Sp=new se,Ap={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class kp extends Cc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=nu[t];if(e)return e;if(e=kp.userSymbolMap[t],e)return e;if(!0===((i=t=ru[t]||t).startsWith("{const e=(new Fl).fromString(t.d),i={};Vu.forEach((e=>{t[e]&&(i[Hu[e]]=t[e])})),n.push({path:e,attribute:i}),mp.union(e.bounds)}));const r=mp.width(),a=mp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new su(t,n,!0);return kp.userSymbolMap[t]=l,l}var i;const s=(new Fl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new su(t,s);return kp.userSymbolMap[t]=o,o}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=Gc(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 Bo(t);return qo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Vo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Vo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Vo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Vo.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&Vo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Vo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===No.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Nu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Uo.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Uo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Uo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Vo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Vo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Vo.UPDATE_SHAPE_AND_BOUNDS)===Vo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Vo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Vo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Vo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Vo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Vo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Vo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Vo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Vo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Hl.x,y:e=Hl.y,scaleX:i=Hl.scaleX,scaleY:s=Hl.scaleY,angle:n=Hl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Ut(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),mo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Hl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=vp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Uo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:mo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new Fl).fromString(t):this.pathProxy=new Fl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),mo.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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||mo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ep(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Mp;kp.userSymbolMap={},kp.mixin(Fc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Mp||(Mp={}));let Tp=class t extends kp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Eu,this._childUpdateTag=Vo.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 kc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new kc)}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===No.GLOBAL){const i=new se(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&Vo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Hl.x,y:e=Hl.y,dx:i=Hl.dx,dy:s=Hl.dy,scaleX:n=Hl.scaleX,scaleY:r=Hl.scaleY,angle:a=Hl.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 Tc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return mo.graphicService.updateTempAABBBounds(i),mo.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&=Vo.CLEAR_BOUNDS,this._childUpdateTag&=Vo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Vo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Vo.UPDATE_BOUNDS||(this._childUpdateTag|=Vo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Vo.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=mo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function wp(t){return new Tp(t)}Tp.NOWORK_ANIMATE_ATTR=Ap;class Cp extends Tp{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 kc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{mo.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=>{mo.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 Ep=Symbol.for("TransformUtil"),Bp=Symbol.for("GraphicUtil"),Pp=Symbol.for("LayerService"),Lp=Symbol.for("StaticLayerHandlerContribution"),Rp=Symbol.for("DynamicLayerHandlerContribution"),Op=Symbol.for("VirtualLayerHandlerContribution");var Ip,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},Fp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let zp=Ip=class{static GenerateLayerId(){return`${Ip.idprefix}_${Ip.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=mo.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(Lp):"dynamic"===t?Eh.get(Rp):Eh.get(Op),e}createLayer(t,e={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 Cp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Ip.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)}};zp.idprefix="visactor_layer",zp.prefix_count=0,zp=Ip=Dp([Ga(),Fp("design:paramtypes",[])],zp);var jp=new La((t=>{t(fo).to(ko).inSingletonScope(),t(cc).to(uc),t(Bp).to(mc).inSingletonScope(),t(Ep).to(yc).inSingletonScope(),t(Pp).to(zp).inSingletonScope()}));function Hp(t,e){return!(!t&&!e)}function Vp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Np(t,e,i){return i&&t*e>0}function Up(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Wp(t,e){return t*e>0}function Gp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Yp(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function $p(t,e,i,s,n){const r=Vt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Yt(c),M=s*Ut(u),T=s*Yt(u);let w,C,E,B;if((b>Dt||_>Dt)&&(w=n*Ut(d),C=n*Yt(d),E=s*Ut(p),B=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Xp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Ut(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Ut(l),s+r*Yt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=$p(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=Yp(g,f,u,p,n,t,Number(c)),l=Yp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Ut(M),s+n*Yt(M));if(!(r>Dt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Dt){const t=Gt(B,T),n=Gt(P,T),o=Yp(S,A,b,x,r,-n,Number(c)),l=Yp(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,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(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,C,E,c):e.moveTo(i+r*Ut(E),s+r*Yt(E))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Yt(o)):e.closePath(),d}const Kp=Symbol.for("ArcRenderContribution"),qp=Symbol.for("AreaRenderContribution"),Zp=Symbol.for("CircleRenderContribution"),Jp=Symbol.for("GroupRenderContribution"),Qp=Symbol.for("ImageRenderContribution"),tg=Symbol.for("PathRenderContribution"),eg=Symbol.for("PolygonRenderContribution"),ig=Symbol.for("RectRenderContribution"),sg=Symbol.for("SymbolRenderContribution"),ng=Symbol.for("TextRenderContribution"),rg=Symbol.for("InteractiveSubRenderContribution");function ag(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function og(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var lg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cg=function(t,e){return function(i,s){e(i,s,t)}};function dg(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Uu(t),Wu(t,t,[n+o,r+l,a+h]),Wu(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),Wu(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]),f){const i=qu.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]}Wu(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),Wu(i,i,[-s[0],-s[1],0]),Yu(t,t,i)}}let ug=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new po(["graphic"]),onSetStage:new po(["graphic","stage"]),onRemove:new po(["graphic"]),onRelease:new po(["graphic"]),onAddIncremental:new po(["graphic","group","stage"]),onClearIncremental:new po(["graphic","group","stage"]),beforeUpdateAABBBounds:new po(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new po(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new po(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Bo(t);return qo(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=og(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=ag(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){vu(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;vu(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};ug=lg([Ga(),cg(0,Ua(ju)),hg("design:paramtypes",[Object])],ug);const pg=(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},gg=["radius","startAngle","endAngle",..._p];class fg extends kp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=wu}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 Tc(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}=mo.graphicService.updateTempAABBBounds(i);return pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,mo.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>Ht-Dt?i.set(-r,-r,r,r):Xc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,gg)}needUpdateTag(t){return super.needUpdateTag(t,gg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Fl,s.arc(0,0,r,a,o),s}clone(){return new fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fg.NOWORK_ANIMATE_ATTR}}function mg(t){return new fg(t)}fg.NOWORK_ANIMATE_ATTR=Ap;class vg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Mo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Fu,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 Tc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new yg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=mo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){vu(n,o/Math.abs(r+a),!0,l),i.union(n)}return mo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||mo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e;const i=this.getGraphicTheme(),s=this.attribute,{fontFamily:n=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,ellipsis:h=i.ellipsis,maxLineWidth:c,stroke:d=i.stroke,wrap:u=i.wrap,measureMode:p=i.measureMode,lineWidth:g=i.lineWidth,whiteSpace:f=i.whiteSpace,suffixPosition:m=i.suffixPosition,ignoreBuf:v=i.ignoreBuf,keepCenterInLine:_=i.keepCenterInLine}=s,y=v?0:this.guessLineHeightBuf(o),b=this.getLineHeight(s,i,y);if("normal"===f||u)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}const x=mo.graphicUtil.textMeasure,S=new vg(n,{fontSize:o,fontWeight:l,fontFamily:n,lineHeight:b},x).GetLayoutByLines(t,r,a,b,!0===h?i.ellipsis:h||void 0,!1,{lineWidth:c,suffixPosition:m,measureMode:p,keepCenterInLine:_}),{bbox:A}=S;return this.cache.layoutData=S,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),d&&this._AABBBounds.expand(g/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s;const n=this.getGraphicTheme(),{fontFamily:r=n.fontFamily,textAlign:a=n.textAlign,textBaseline:o=n.textBaseline,fontSize:l=n.fontSize,ellipsis:h=n.ellipsis,maxLineWidth:c,stroke:d=n.stroke,lineWidth:u=n.lineWidth,wordBreak:p=n.wordBreak,fontWeight:g=n.fontWeight,ignoreBuf:f=n.ignoreBuf,measureMode:m=n.measureMode,suffixPosition:v=n.suffixPosition,heightLimit:_=0,lineClamp:b,keepCenterInLine:x=n.keepCenterInLine}=this.attribute,S=f?0:this.guessLineHeightBuf(l),A=this.getLineHeight(this.attribute,n,S);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(u/2),this._AABBBounds}const k=mo.graphicUtil.textMeasure,M={fontSize:l,fontWeight:g,fontFamily:r,lineHeight:A},T=new vg(r,M,k),w=y(t)?t.map((t=>t.toString())):[t.toString()],C=[],E=[0,0];let B=1/0;if(_>0&&(B=Math.max(Math.floor(_/A),1)),b&&(B=Math.min(B,b)),"number"==typeof c&&c!==1/0){if(c>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const t=ag(v,r),e=this.cache.verticalList.length*m,i=og(_,e,c);return this._AABBBounds.set(i,t,i+e,t+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const y=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(o))if(l){const i=!0===l?s.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,i,!1,f);y[e]=a.verticalList,r=a.width}else{const i=n.clipTextVertical(t,{fontSize:c,fontWeight:d,fontFamily:h},o,!1);y[e]=i.verticalList,r=i.width}else r=0,t.forEach((t=>{const e=t.direction===bu.HORIZONTAL?c:n.measureTextWidth(t.text,{fontSize:c,fontWeight:d,fontFamily:h});r+=e,t.width=e}))})),this.cache.verticalList=y,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);r=Wt(e,r)}));const b=ag(v,r),x=this.cache.verticalList.length*m,S=og(_,x,c);return this._AABBBounds.set(S,b,S+x,b+r),u&&this._AABBBounds.expand(p/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=td(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=_g){return super.needUpdateTags(t,e)}needUpdateTag(t,e=_g){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return yg.baselineMapAlign}getAlignMapBaseline(){return yg.alignMapBaseline}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ap),yg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},yg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const xg=["symbolType","size",..._p];let Sg=class t extends kp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Du}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Tc(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}=mo.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;vu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return mo.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,xg)}needUpdateTag(t){return super.needUpdateTag(t,xg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Fl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Fl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Ag(t){return new Sg(t)}Sg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ap);const kg=["segments","points","curveType","curveTension",..._p];let Mg=class t extends kp{constructor(t={}){super(t),this.type="line",this.numberType=Pu}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=qc(i,s,e))}getGraphicTheme(){return Tc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),mo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return mo.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,kg)}needUpdateTag(t){return super.needUpdateTag(t,kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Fl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ap);const wg=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}},Cg=["width","x1","y1","height","cornerRadius",..._p];class Eg extends kp{constructor(t){super(t),this.type="rect",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Tc(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}=mo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,mo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=wg(e);return t=new Fl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Eg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Eg.NOWORK_ANIMATE_ATTR}}function Bg(t){return new Eg(t)}Eg.NOWORK_ANIMATE_ATTR=Ap;class Pg extends kp{constructor(t){super(t),this.type="glyph",this.numberType=Cu,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,e=!1,i){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 Tc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Pg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Pg.NOWORK_ANIMATE_ATTR}}function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Ap;class Rg{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=ph[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}}}function Og(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ig{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=td(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ah(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ah(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=bh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Og(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=bh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Og(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=bh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ah(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Dg=["width","height","image",..._p];class Fg extends kp{constructor(t){super(t),this.type="image",this.numberType=Bu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 Tc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=mo.graphicService.updateTempAABBBounds(i);return pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,mo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return oh[t]}needUpdateTags(t){return super.needUpdateTags(t,Dg)}needUpdateTag(t){return super.needUpdateTag(t,Dg)}clone(){return new Fg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ap);class jg extends Fg{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=Gc(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=Gc(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=oh.width,height:e=oh.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 Hg{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 jg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=ph[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ig){const e=_h.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 jg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ah(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof jg)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||fh;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,yh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||gh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?uh(t,s,{AABBBounds:i}):s,yh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof jg)break;const{width:n}=Ah(t,s.character,s.ascentDescentMode),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 jg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Vg{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=ph[this.direction]}store(t){if(t instanceof jg){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 Hg(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,e=!1){t instanceof jg?"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||this.newLine)&&("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=bh(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 Ig(i,t.newLine,t.character,t.ascentDescentMode),new Ig(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ng=!1;try{Ng=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ng=!1}const Ug=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",..._p];class Wg extends kp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Iu,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:ah.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:ah.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:ah.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:ah.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:ah.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:ah.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:ah.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:ah.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Tc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Wg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Wg.splitText(t.text).length>1)))}static splitText(t){if(Ng){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Wg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),mo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||mo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,mo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Ug)}needUpdateTag(t){return super.needUpdateTag(t,Ug)}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;e0&&!Wg.AllSingleCharacter(_)&&(_=Wg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Rg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Vg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Wg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Wg.NOWORK_ANIMATE_ATTR}}function Gg(t){return new Wg(t)}Wg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ap);const Yg=["path","customPath",..._p];class $g extends kp{constructor(t){super(t),this.type="path",this.numberType=Lu}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 Fl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Fl?this.cache:t.path)}getGraphicTheme(){return Tc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=mo.graphicService.updateTempAABBBounds(i);pg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return mo.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 Fl).fromString(t.path):t.customPath&&(this.cache=new Fl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Yg)}needUpdateTag(t){return super.needUpdateTag(t,Yg)}toCustomPath(){return(new Fl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new $g(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Xg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ap);const Kg=["segments","points","curveType","curveTension",..._p];class qg extends kp{constructor(t){super(t),this.type="area",this.numberType=Tu}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 Tc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),mo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return mo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Fl;const 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 qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ap);const Jg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",..._p];class Qg extends kp{constructor(t){super(t),this.type="arc",this.numberType=ku}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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(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 Tc(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}=mo.graphicService.updateTempAABBBounds(i);pg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return mo.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<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Xc(l,o,s,i),Xc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Ut(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Ut(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Yt(a),i=l*Ut(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ap);const ef=["points","cornerRadius",..._p];class sf extends kp{constructor(t){super(t),this.type="polygon",this.numberType=Ru}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Tc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),mo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return mo.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=qc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Fl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Ap;class rf extends Tp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function af(t){return new rf(t)}const of=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 lf,hf;function cf(t){return lf||(lf=of.CreateGraphic("text",{})),lf.initAttributes(t),lf.AABBBounds}var df=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},pf=function(t,e){return function(i,s){e(i,s,t)}};class gf{constructor(){this.time=Yo.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Tc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=oc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),oc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const ff=new gf;let mf=class{constructor(t){this.subRenderContribitions=t,this.time=Yo.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)}))}};mf=df([Ga(),pf(0,Ua(oo)),pf(0,Ya(rg)),uf("design:paramtypes",[Object])],mf);const vf=new class{constructor(){this.time=Yo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const _f=new class{constructor(){this.time=Yo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class yf{constructor(){this.time=Yo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=oc.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])),oc.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,Ht),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=oc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Ag({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:dh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Xp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Sf=bf,Af=ff;const kf=new class{constructor(){this.time=Yo.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{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:dh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Mf=bf,Tf=ff;const wf=new class extends gf{constructor(){super(...arguments),this.time=Yo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Cf=Ft/2;function Ef(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Cf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Cf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Cf,Ft,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Cf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Bf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pf{constructor(){this.time=Yo.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,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:dh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Ef(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Lf=class{constructor(){this.time=Yo.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)}};Lf=Bf([Ga()],Lf);let Rf=class{constructor(){this.time=Yo.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,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Ef(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Rf=Bf([Ga()],Rf);const Of=new Pf,If=bf,Df=ff;const Ff=new class extends Pf{constructor(){super(...arguments),this.time=Yo.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)}},zf=ff;const jf=new class{constructor(){this.time=Yo.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:_=l.opacity,x:y=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:dh(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Hf=new class{constructor(){this.time=Yo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Vf=bf,Nf=ff;const Uf={x:0,y:0,z:0,lastModelMatrix:null};class Wf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(vf),this.builtinContributions.push(_f),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===Yo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Yo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Tc(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,_=Np(d,u,h),y=Wp(d,g),b=Hp(h),x=Vp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return qo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Np(o,l,n),p=Wp(o,c),g=Hp(n,r),f=Vp(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,s=!1){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;Uf.x=n,Uf.y=r,Uf.z=a,Uf.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=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(s,d||s,n),Uf.x=0,Uf.y=0,Uf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),qu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Uf.x+=s.x,Uf.y+=s.y,Uf.z=a,i.setTransformForCurrent()}else if(p)Uf.x=0,Uf.y=0,Uf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Uf.x+=s.x,Uf.y+=s.y,this.transformWithoutTranslate(i,Uf.x,Uf.y,Uf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Uf.x=0,Uf.y=0,Uf.z=0;return Uf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&qu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}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},Yf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$f=function(t,e){return function(i,s){e(i,s,t)}};let Xf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ku,this.builtinContributions=[xf,Af,Sf],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(nDt){const t=Gt(b,y),r=Gt(x,y),a=Yp(v,_,f,m,n,t,Number(u)),o=Yp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Dt){const t=Gt(B,w),n=Gt(P,w),a=Yp(M,T,A,k,r,-n,Number(u)),o=Yp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(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*Ut(E),s+r*Yt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Tc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Uc[s]=t,i&&(i=!(null!==(e=Uc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Uc[e]=!!t[e],i&&(i=!!Uc[e]);else Uc[0]=!1,Uc[1]=!1,Uc[2]=!1,Uc[3]=!1;return{isFullStroke:i,stroke:Uc}})(d);if((_||E)&&(e.beginPath(),Xp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Xp(t,e,i,s,k,M,B),C||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(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Ht;for(;i>Ht;)i-=Ht;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),op(o.color,l.color,h,!1)}(0,0,h,n);a||Np&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l||o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Tc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Xf=Gf([Ga(),$f(0,Ua(oo)),$f(0,Ya(Kp)),Yf("design:paramtypes",[Object])],Xf);var 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},qf=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 Jf=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[kf,Tf,Mf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Tc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=Tc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Qf(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]=sl(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 tm(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 em(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=tm(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),Qf(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Wo.ROW:"y"===s?u=Wo.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 sm=class extends Wf{constructor(){super(...arguments),this.numberType=Pu}draw(t,e,i,s){const n=Tc(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;if(!e)return;t.beginPath();em(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Dl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function nm(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),Qf(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),Qf(t,l,1,s),o=!1):o=!0}t.closePath()}sm=im([Ga()],sm);const rm=new class extends yf{constructor(){super(...arguments),this.time=Yo.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Zc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Zc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Zc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Zc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},am=ff;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 Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Tu,this.builtinContributions=[rm,am],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=Tc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=Dl(B(t.points,x),E,{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=Dl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Dl(e,E,{curveTension:b}),n=Dl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Tc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Wo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?Wo.ROW:null==_.y1?Wo.COLUMN:Number.isFinite(S+A)?S>A?Wo.ROW:Wo.COLUMN:Wo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Wo.ROW:Wo.COLUMN,Number.isFinite(c)||(o=Wo.COLUMN),Number.isFinite(d)||(o=Wo.ROW);const u=i*(o===Wo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),em(t,i[0]?e.top:e.bottom,l,x===Wo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};cm=om([Ga(),hm(0,Ua(oo)),hm(0,Ya(qp)),lm("design:paramtypes",[Object])],cm);const dm=bf,um=ff;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},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[um,dm],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:Tc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)qo(t.pathShape.commandList,e,i,s,1,1,f);else{qo((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,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=Tc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};mm=pm([Ga(),fm(0,Ua(oo)),fm(0,Ya(tg)),gm("design:paramtypes",[Object])],mm);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},_m=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Ou,this.builtinContributions=[Of,Df,If],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Tc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Up(g,f,T,w,h),E=Gp(g,v,T,w,M),B=Hp(h,c),P=Vp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Ef(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Tc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};bm=vm([Ga(),ym(0,Ua(oo)),ym(0,Ya(ig)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Am=function(t,e){return function(i,s){e(i,s,t)}};let km=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[jf,Nf,Vf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Tc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Tc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};km=xm([Ga(),Am(0,Ua(oo)),Am(0,Ya(sg)),Sm("design:paramtypes",[Object])],km);const Mm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const Tm=new class extends gf{constructor(){super(...arguments),this.time=Yo.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Mm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=cf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Ef(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Mm.free(E),C()}};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},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Tm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Tc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=td(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Ku.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Ku.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Tc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ag(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Pm(t,e,i,s){if(e&&e.length){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},Fm=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 jm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Im,Om],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Tc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Pm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Pm(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,_=v/m;const y=Lm(d,u),b=Lm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Rm(h,_,y,d,u),A=Rm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Lm(k,M),w=Rm(h,Lm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Tc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};jm=Dm([Ga(),zm(0,Ua(oo)),zm(0,Ya(eg)),Fm("design:paramtypes",[Object])],jm);var Hm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Um=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Eu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Tc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Up(p,m,g,f,c),C=Gp(p,v,g,f),E=Hp(c,u),B=Vp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Ef(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(wf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Yo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Yo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=mo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Tc(t,null==s?void 0:s.theme).group,i=qu.allocate(),n=qu.allocate();dg(n,t,e),Yu(i,p||i,n),a.modelMatrix=i,qu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&qu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Um=Hm([Ga(),Nm(0,Ua(oo)),Nm(0,Ya(Jp)),Vm("design:paramtypes",[Object])],Um);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},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};const $m=["","repeat-x","repeat-y","repeat"];let Xm=class extends Wf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[Ff,zf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Tc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Ef(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,$m[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Hc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Tc(t).image;this._draw(t,a,!1,i)}};Xm=Wm([Ga(),Ym(0,Ua(oo)),Ym(0,Ya(Qp)),Gm("design:paramtypes",[Object])],Xm);const Km=Symbol.for("IncrementalDrawContribution"),qm=Symbol.for("ArcRender"),Zm=Symbol.for("AreaRender"),Jm=Symbol.for("CircleRender"),Qm=Symbol.for("GraphicRender"),tv=Symbol.for("GroupRender"),ev=Symbol.for("LineRender"),iv=Symbol.for("PathRender"),sv=Symbol.for("PolygonRender"),nv=Symbol.for("RectRender"),rv=Symbol.for("SymbolRender"),av=Symbol.for("TextRender"),ov=Symbol.for("RichTextRender"),lv=Symbol.for("GlyphRender"),hv=Symbol.for("ImageRender"),cv=Symbol.for("DrawContribution"),dv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Mu,!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+=Ht;for(;o<0;)o+=Ht;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 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},pv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gv=Symbol.for("DrawItemInterceptor"),fv=new He,mv=new He;class vv{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){fv.copy(s.dirtyBounds),mv.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,Ku.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(fv),s.backupDirtyBounds.copy(mv)),!0}}class _v{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 yv=class{constructor(){this.order=1,this.interceptors=[new vv,new xv,new bv,new _v]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&qu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Sv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kv=function(t,e){return function(i,s){e(i,s,t)}};const Mv=Symbol.for("RenderService");let Tv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Tv=Sv([Ga(),kv(0,Ua(cv)),Av("design:paramtypes",[Object])],Tv);var wv=new La((t=>{t(Mv).to(Tv)}));const Cv=Symbol.for("PickerService"),Ev=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");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};let Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Lv([Ga()],Rv);let Ov=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=Tc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Ku.allocateByObj(a),u=new se(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}};Ov=Lv([Ga()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};Iv=Lv([Ga()],Iv);let Dv=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=dv(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()}};Dv=Lv([Ga()],Dv);var Fv=new La(((t,e,i)=>{i(Cv)||(t(Ev).toSelf(),t(Cv).toService(Ev)),t(Dv).toSelf().inSingletonScope(),t(Bv).toService(Dv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),ho(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),ho(t,Pv)})),zv=new La((t=>{t(zu).to(ug),t(ju).toConstantValue(of)}));const jv=Symbol.for("AutoEnablePlugins"),Hv=Symbol.for("PluginService");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},Nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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(jv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Vv([Ga(),Uv(0,Ua(oo)),Uv(0,Ya(jv)),Nv("design:paramtypes",[Object])],Wv);var Gv=new La((t=>{t(Hv).to(Wv),function(t,e){t(oo).toDynamicValue((({container:t})=>new lo(e,t))).whenTargetNamed(e)}(t,jv)})),Yv=new La((t=>{ho(t,go)})),$v=new La((t=>{t(wh).to(Ch).inSingletonScope(),ho(t,wh)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=mo.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=Lh({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()}};qv=Xv([Ga(),Kv("design:paramtypes",[])],qv);var Zv=new La((t=>{t(qv).toSelf(),t(Lp).toService(qv)}));var Jv=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 Qv(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 t_(t,e,i,s=!1,n=!1){let 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}=Qv(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;t{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}=Qv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}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},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r_=function(t,e){return function(i,s){e(i,s,t)}};let a_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):t_(e,$l.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=mo.global,this.layerService=mo.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:$l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:$l.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Ku.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=i_(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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Mm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Ku.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Mm.free(n),Ku.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(Km);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 l_=class extends sm{constructor(){super(...arguments),this.numberType=Pu}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=Tc(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=Np(u,p,c),_=Wp(u,g),y=Hp(c),b=Vp(d,f);if(!t.valid||!m)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())}};l_=o_([Ga()],l_);var h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 c_=class extends cm{constructor(){super(...arguments),this.numberType=Tu}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=Tc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Np(u,d,c),f=Hp(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())}};c_=h_([Ga()],c_);var d_,u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},g_=function(t,e){return function(i,s){e(i,s,t)}},f_=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"}(d_||(d_={}));let m_=class extends a_{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=d_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new po([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return f_(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 f_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return f_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>f_(this,void 0,void 0,(function*(){if(2!==t.count)yield e_(t,$l.zIndex,((i,s)=>{if(this.status===d_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return f_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return f_(this,void 0,void 0,(function*(){this.rendering&&(this.status=d_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=d_.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 f_(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:()=>f_(this,void 0,void 0,(function*(){yield e_(t,$l.zIndex,(t=>f_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};m_=u_([Ga(),g_(0,Wa(Qm)),g_(1,Ua(l_)),g_(2,Ua(c_)),g_(3,Ua(oo)),g_(3,Ya(gv)),p_("design:paramtypes",[Array,Object,Object,Object])],m_);var v_=new La((t=>{t(gf).toSelf().inSingletonScope(),t(yf).toSelf().inSingletonScope(),t(cv).to(a_),t(Km).to(m_),t(tv).to(Um).inSingletonScope(),t(Qm).toService(tv),ho(t,Jp),t(mf).toSelf().inSingletonScope(),ho(t,rg),ho(t,Qm),t(yv).toSelf().inSingletonScope(),t(gv).toService(yv),ho(t,gv)}));function __(){__.__loaded||(__.__loaded=!0,Eh.load(jp),Eh.load(zv),Eh.load(wv),Eh.load(Fv),Eh.load(Gv),function(t){t.load(Yv),t.load($v),t.load(Zv)}(Eh),function(t){t.load(v_)}(Eh))}__.__loaded=!1,__();const y_=Eh.get(fo);mo.global=y_;const b_=Eh.get(Bp);mo.graphicUtil=b_;const x_=Eh.get(Ep);mo.transformUtil=x_;const S_=Eh.get(zu);mo.graphicService=S_;const A_=Eh.get(Mv);mo.renderService=A_;const k_=Eh.get(Pp);mo.layerService=k_;class M_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class T_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=mo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=mo.global.getRequestAnimationFrame();this.rafId=t((()=>{mo.global.devicePixelRatio!==this.dpr&&(this.dpr=mo.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=mo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class w_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,mo.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 C_=new He;class E_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(C_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(C_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let B_;function P_(){!function(){if(null==B_)try{const t=document.createElement("canvas"),e=t.getContext("2d");B_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),B_&&(B_=!!document.createElement)}catch(t){B_=!1}}();const t=mo.global&&mo.global.env;return t?"browser"===t:B_}let L_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};L_._pluginClasses={};const R_="white";class O_ extends Tp{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:R_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new kc,this.hooks={beforeRender:new po(["stage"]),afterRender:new po(["stage"]),afterClearScreen:new po(["stage"]),afterClearRect:new po(["stage"])},this.global=mo.global,!this.global.env&&P_()&&this.global.setEnv("browser"),this.window=Eh.get(cc),this.renderService=Eh.get(Mv),this.pluginService=Eh.get(Hv),this.layerService=Eh.get(Pp),this.graphicService=Eh.get(zu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:R_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new jc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=L_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=L_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=L_.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 M_))}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 T_))}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 w_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new E_,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=L_.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=L_.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=L_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=Eh.get(cc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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(Cv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var I_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},D_=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 F_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return D_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};F_=I_([Ga()],F_);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 H_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};H_=z_([Ga(),j_("design:paramtypes",[])],H_);var V_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},N_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},U_=function(t,e){return function(i,s){e(i,s,t)}};let W_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=mo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Tc(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 se(e.x,e.y);l.transformPoint(a,a);const o=Tc(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&&qu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Ku.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function G_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function Y_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function J_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),sy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ny=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return sy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return sy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ny(n[0],s,i),ny(n[1],e-s,i)}};let ry=!1;const ay=new La((t=>{ry||(ry=!0,t(Xf).toSelf().inSingletonScope(),t(qm).to(Xf).inSingletonScope(),t(Qm).toService(qm),t(Kp).toService(mf),ho(t,Kp))}));let oy=!1;const ly=new La((t=>{oy||(oy=!0,t(bm).toSelf().inSingletonScope(),t(nv).to(bm).inSingletonScope(),t(Qm).toService(nv),t(Rf).toSelf(),t(Lf).toSelf(),t(ig).toService(Rf),t(ig).toService(Lf),t(ig).toService(mf),ho(t,ig))}));let hy=!1;const cy=new La((t=>{hy||(hy=!0,t(sm).toSelf().inSingletonScope(),t(l_).toSelf().inSingletonScope(),t(ev).to(sm).inSingletonScope(),t(Qm).toService(ev))}));let dy=!1;const uy=new La((t=>{dy||(dy=!0,t(cm).toSelf().inSingletonScope(),t(Zm).to(cm).inSingletonScope(),t(Qm).toService(Zm),t(qp).toService(mf),ho(t,qp),t(c_).toSelf().inSingletonScope())}));let py=!1;const gy=new La((t=>{py||(py=!0,t(km).toSelf().inSingletonScope(),t(rv).to(km).inSingletonScope(),t(Qm).toService(rv),t(sg).toService(mf),ho(t,sg))}));let fy=!1;const my=new La((t=>{fy||(fy=!0,t(Jf).toSelf().inSingletonScope(),t(Jm).to(Jf).inSingletonScope(),t(Qm).toService(Jm),t(Zp).toService(mf),ho(t,Zp))}));let vy=!1;const _y=new La((t=>{vy||(vy=!0,t(av).to(Bm).inSingletonScope(),t(Qm).toService(av),t(ng).toService(mf),ho(t,ng))}));let yy=!1;const by=new La((t=>{yy||(yy=!0,t(mm).toSelf().inSingletonScope(),t(iv).to(mm).inSingletonScope(),t(Qm).toService(iv),t(tg).toService(mf),ho(t,tg))}));let xy=!1;const Sy=new La((t=>{xy||(xy=!0,t(sv).to(jm).inSingletonScope(),t(Qm).toService(sv),t(eg).toService(mf),ho(t,eg))}));var Ay=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ky=class{constructor(){this.numberType=Cu}reInit(){}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=Tc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};ky=Ay([Ga()],ky);let My=!1;const Ty=new La((t=>{My||(My=!0,t(lv).to(ky).inSingletonScope(),t(Qm).toService(lv))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ey=class extends Wf{constructor(){super(),this.numberType=Iu,this.builtinContributions=[Tm],this.init()}drawShape(t,e,i,s,n){const r=Tc(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=Np(o,l,!0),d=Np(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Tc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Ef(e,i-t,s-n,v,_,f,!0)),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=Tc(t).richtext;this._draw(t,s,!1,i)}};Ey=wy([Ga(),Cy("design:paramtypes",[])],Ey);let By=!1;const Py=new La((t=>{By||(By=!0,t(ov).to(Ey).inSingletonScope(),t(Qm).toService(ov))}));let Ly=!1;const Ry=new La((t=>{Ly||(Ly=!0,t(hv).to(Xm).inSingletonScope(),t(Qm).toService(hv),t(Qp).toService(mf),ho(t,Qp))}));function Oy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),Fy=(t,e)=>(d(jy.warnHandler)&&jy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),zy=(t,e,i)=>{if(!d(jy.errorHandler))throw new Error(t);jy.errorHandler.call(null,t,e)},jy={silent:!1,warnHandler:!1,errorHandler:!1},Hy=P_(),Vy=Hy&&globalThis?globalThis.document:void 0;function Ny(t){return("desktop-browser"===t||"mobile-browser"===t)&&Hy}function Uy(t){return Wy(t)||"mobile-browser"===t}function Wy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Gy=0;function Yy(){return Gy>=9999999&&(Gy=0),Gy++}function $y(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Xy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Ky=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class qy extends Tp{constructor(t,e){super(t),this._skipRenderAttributes=Ky,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},kb=(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,e={}){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.startTime=Oc.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=Oc.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||Ab(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=kb(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=Oc.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=kb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Ab(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("pointerleave",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("pointerleave",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=Oc.now()-i>this.config.press.time&&kb(s[0],t){mo.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){if(!this.element)return;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},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Cb=[0,0,0];let Eb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Vl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Ul),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Wl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Ku.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&&(Ku.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Ku.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Ht;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(f,-2*y),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&&fp.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&&($u(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[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&&($u(Cb,[t,e,i],this.modelMatrix),t=Cb[0],e=Cb[1],i=Cb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&($u(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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,e=mo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=mo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Wl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Wl.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&&($u(Cb,[e,i,s],this.modelMatrix),e=Cb[0],i=Cb[1],s=Cb[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=uh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:dh(this,a,this.dpr),r.strokeStyle=uh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Ku.free(t))),this.stack.length=0}};Eb.env="browser",Eb=Tb([Ga(),wb("design:paramtypes",[Object,Number])],Eb);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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Lb=class extends sp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=mo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Eb(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 Rb(t,e){return new La((i=>{i(Bh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Ph).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Lb.env="browser",Lb=Bb([Ga(),Pb("design:paramtypes",[Object])],Lb);const Ob=Rb(Lb,Eb);var Ib=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Fb=function(t,e){return function(i,s){e(i,s,t)}};let zb=class extends W_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=oc.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 Hb=class{constructor(){this.type="group",this.numberType=Eu}contains(t,e,i){return!1}};Hb=jb([Ga()],Hb);const Vb=new La(((t,e,i,s)=>{Vb.__vloaded||(Vb.__vloaded=!0,t(xb).to(Hb).inSingletonScope(),t(Sb).toService(xb),ho(t,Sb))}));Vb.__vloaded=!1;var Nb=Vb;const Ub=new La(((t,e,i,s)=>{i(zb)||t(zb).toSelf().inSingletonScope(),i(Cv)?s(Cv).toService(zb):t(Cv).toService(zb)}));var Wb,Gb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let $b=Wb=class extends H_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Wb.idprefix}_${Wb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=mo.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Wb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Lb(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 Lb({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)}};$b.env="browser",$b.idprefix="visactor_window",$b.prefix_count=0,$b=Wb=Gb([Ga(),Yb("design:paramtypes",[])],$b);const Xb=new La((t=>{t($b).toSelf(),t(dc).toDynamicValue((t=>t.container.get($b))).whenTargetNamed($b.env)}));var Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zb=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 Jb{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 Qb(t,e=!1){const i=document.createElement("img");if(mo.global.isImageAnonymous&&(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 tx=class extends F_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Jb(t)}return new He}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 Qb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Qb(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:Pa.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(...t){}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}}loadFont(t,e,i){return Zb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};tx=Kb([Ga(),qb("design:paramtypes",[])],tx);const ex=new La((t=>{ex.isBrowserBound||(ex.isBrowserBound=!0,t(tx).toSelf().inSingletonScope(),t(go).toService(tx))}));function ix(t,e=!0){ix.__loaded||(ix.__loaded=!0,t.load(ex),t.load(Ob),t.load(Xb),e&&function(t){t.load(Nb),t.load(Ub)}(t))}ex.isBrowserBound=!1,ix.__loaded=!1;var sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},rx=function(t,e){return function(i,s){e(i,s,t)}};let ax=class extends W_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 ep(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}};ax=sx([Ga(),rx(0,Ua(oo)),rx(0,Ya(Zy)),rx(1,Ua(oo)),rx(1,Ya(Bv)),rx(2,Ua(oo)),rx(2,Ya(Pv)),nx("design:paramtypes",[Object,Object,Object])],ax);const ox=new La((t=>{ox.__vloaded||(ox.__vloaded=!0,ho(t,Zy))}));ox.__vloaded=!1;var lx=ox;class hx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:dh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}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 hx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};px=cx([Ga(),ux(0,Ua(qm)),dx("design:paramtypes",[Object])],px);let gx=!1;const fx=new La(((t,e,i,s)=>{gx||(gx=!0,t(Jy).to(px).inSingletonScope(),t(Zy).toService(Jy))}));var mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_x=function(t,e){return function(i,s){e(i,s,t)}};let yx=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Tu}};yx=mx([Ga(),_x(0,Ua(Zm)),vx("design:paramtypes",[Object])],yx);let bx=!1;const xx=new La(((t,e,i,s)=>{bx||(bx=!0,t(Qy).to(yx).inSingletonScope(),t(Zy).toService(Qy))}));var Sx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},kx=function(t,e){return function(i,s){e(i,s,t)}};let Mx=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};Mx=Sx([Ga(),kx(0,Ua(Jm)),Ax("design:paramtypes",[Object])],Mx);let Tx=!1;const Cx=new La(((t,e,i,s)=>{Tx||(Tx=!0,t(tb).to(Mx).inSingletonScope(),t(Zy).toService(tb))}));class Ex{constructor(){this.type="glyph",this.numberType=Cu}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 Bx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lx=function(t,e){return function(i,s){e(i,s,t)}};let Rx=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Rx=Bx([Ga(),Lx(0,Ua(lv)),Px("design:paramtypes",[Object])],Rx);let Ox=!1;const Ix=new La(((t,e,i,s)=>{Ox||(Ox=!0,t(lb).to(Rx).inSingletonScope(),t(Rx).toService(lb))}));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=Bu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Ga()],Fx);let zx=!1;const jx=new La(((t,e,i,s)=>{zx||(zx=!0,t(eb).to(Fx).inSingletonScope(),t(Fx).toService(eb))}));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},Vx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nx=function(t,e){return function(i,s){e(i,s,t)}};let Ux=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};Ux=Hx([Ga(),Nx(0,Ua(ev)),Vx("design:paramtypes",[Object])],Ux);let Wx=!1;const Gx=new La(((t,e,i,s)=>{Wx||(Wx=!0,t(ib).to(Ux).inSingletonScope(),t(Zy).toService(ib))}));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 hx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};Kx=Yx([Ga(),Xx(0,Ua(sv)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new La(((t,e,i,s)=>{qx||(qx=!0,t(ob).to(Kx).inSingletonScope(),t(Zy).toService(ob))}));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 hx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Lu}};eS=Jx([Ga(),tS(0,Ua(iv)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new La(((t,e,i,s)=>{iS||(iS=!0,t(sb).to(eS).inSingletonScope(),t(Zy).toService(sb))})),nS=new He;class rS{constructor(){this.type="rect",this.numberType=Ou}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:dh(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([Ga(),lS(0,Ua(nv)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new La(((t,e,i,s)=>{cS||(cS=!0,t(nb).to(hS).inSingletonScope(),t(Zy).toService(nb))}));let uS=!1;const pS=new La(((t,e,i,s)=>{uS||(uS=!0,t(eb).to(Fx).inSingletonScope(),t(Fx).toService(eb))}));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},fS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}};vS=gS([Ga(),mS(0,Ua(rv)),fS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new La(((t,e,i,s)=>{_S||(_S=!0,t(rb).to(vS).inSingletonScope(),t(Zy).toService(rb))}));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=Fu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Ga()],xS);let SS=!1;const AS=new La(((t,e,i,s)=>{SS||(SS=!0,t(ab).to(xS).inSingletonScope(),t(Zy).toService(ab))})),kS=new La(((t,e,i,s)=>{i(ax)||t(ax).toSelf().inSingletonScope(),i(Cv)?s(Cv).toService(ax):t(Cv).toService(ax)}));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},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let wS=class extends Eb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};wS.env="node",wS=MS([Ga(),TS("design:paramtypes",[Object,Number])],wS);var CS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BS=class extends sp{constructor(t){super(t)}init(){this._context=new wS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};BS.env="node",BS=CS([Ga(),ES("design:paramtypes",[Object])],BS);const PS=Rb(BS,wS);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},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OS=function(t,e){return function(i,s){e(i,s,t)}};let IS=class extends H_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new BS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new BS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};IS.env="node",IS=LS([Ga(),OS(0,Ua(fo)),RS("design:paramtypes",[Object])],IS);const DS=new La((t=>{t(IS).toSelf(),t(dc).toDynamicValue((t=>t.container.get(IS))).whenTargetNamed(IS.env)}));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};let zS=class extends F_{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 Qc.call(t)}}getCancelAnimationFrame(){return t=>{Qc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};zS=FS([Ga()],zS);const jS=new La((t=>{jS.isNodeBound||(jS.isNodeBound=!0,t(zS).toSelf().inSingletonScope(),t(go).toService(zS))}));function HS(t,e=!0){HS.__loaded||(HS.__loaded=!0,t.load(jS),t.load(PS),t.load(DS))}jS.isNodeBound=!1,HS.__loaded=!1;var VS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 NS=class extends Eb{draw(){}createPattern(t,e){return null}};NS.env="wx",NS=VS([Ga()],NS);var US=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let GS=class extends sp{constructor(t){super(t)}init(){this._context=new NS(this,this._dpr)}release(...t){}};GS.env="wx",GS=US([Ga(),WS("design:paramtypes",[Object])],GS);const YS=Rb(GS,NS);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)}};class qS{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 H_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new qS}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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new GS(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 GS({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=$S([Ga(),KS(0,Ua(fo)),XS("design:paramtypes",[Object])],ZS);const JS=new La((t=>{t(ZS).toSelf(),t(dc).toDynamicValue((t=>t.container.get(ZS))).whenTargetNamed(ZS.env)}));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},tA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eA=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 iA=class extends F_{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,a){return eA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 Qc.call(t)}}getCancelAnimationFrame(){return t=>{Qc.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};iA=QS([Ga(),tA("design:paramtypes",[])],iA);const sA=new La((t=>{sA._isWxBound||(sA._isWxBound=!0,t(iA).toSelf().inSingletonScope(),t(go).toService(iA))}));function nA(t,e=!0){nA.__loaded||(nA.__loaded=!0,t.load(sA),t.load(YS),t.load(JS),e&&function(t){t.load(lx),t.load(kS),t.load(fx),t.load(xx),t.load(Cx),t.load(Ix),t.load(jx),t.load(Gx),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(AS)}(t))}sA._isWxBound=!1,nA.__loaded=!1;var rA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oA=function(t,e){return function(i,s){e(i,s,t)}};let lA=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=ku}};lA=rA([Ga(),oA(0,Ua(qm)),aA("design:paramtypes",[Object])],lA);let hA=!1;const cA=new La(((t,e,i,s)=>{hA||(hA=!0,t(hb).to(lA).inSingletonScope(),t(Sb).toService(hb))}));var dA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pA=function(t,e){return function(i,s){e(i,s,t)}};let gA=class extends rS{constructor(t){super(),this.canvasRenderer=t}};gA=dA([Ga(),pA(0,Ua(nv)),uA("design:paramtypes",[Object])],gA);let fA=!1;const mA=new La(((t,e,i,s)=>{fA||(fA=!0,t(fb).to(gA).inSingletonScope(),t(Sb).toService(fb))}));class vA extends Wf{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:dh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var _A=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bA=function(t,e){return function(i,s){e(i,s,t)}};let xA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Pu}};xA=_A([Ga(),bA(0,Ua(ev)),yA("design:paramtypes",[Object])],xA);let SA=!1;const AA=new La(((t,e,i,s)=>{SA||(SA=!0,t(pb).to(xA).inSingletonScope(),t(Sb).toService(pb))}));var kA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TA=function(t,e){return function(i,s){e(i,s,t)}};let wA=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Tu}};wA=kA([Ga(),TA(0,Ua(Zm)),MA("design:paramtypes",[Object])],wA);let CA=!1;const EA=new La(((t,e,i,s)=>{CA||(CA=!0,t(cb).to(wA).inSingletonScope(),t(Sb).toService(cb))}));class BA extends Wf{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&&qu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var PA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RA=function(t,e){return function(i,s){e(i,s,t)}};let OA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Du}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:dh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&qu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};OA=PA([Ga(),RA(0,Ua(rv)),LA("design:paramtypes",[Object])],OA);let IA=!1;const DA=new La(((t,e,i,s)=>{IA||(IA=!0,t(mb).to(OA).inSingletonScope(),t(Sb).toService(mb))}));var FA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jA=function(t,e){return function(i,s){e(i,s,t)}};let HA=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=wu}};HA=FA([Ga(),jA(0,Ua(Jm)),zA("design:paramtypes",[Object])],HA);let VA=!1;const NA=new La(((t,e,i,s)=>{VA||(VA=!0,t(db).to(HA).inSingletonScope(),t(Sb).toService(db))}));var UA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GA=function(t,e){return function(i,s){e(i,s,t)}};let YA=class extends BA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Fu}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=og(a,u,n),v=ag(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&&qu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};YA=UA([Ga(),GA(0,Ua(av)),WA("design:paramtypes",[Object])],YA);let $A=!1;const XA=new La(((t,e,i,s)=>{$A||($A=!0,t(vb).to(YA).inSingletonScope(),t(Sb).toService(vb))}));var KA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ZA=function(t,e){return function(i,s){e(i,s,t)}};let JA=class extends vA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Lu}};JA=KA([Ga(),ZA(0,Ua(iv)),qA("design:paramtypes",[Object])],JA);let QA=!1;const tk=new La(((t,e,i,s)=>{QA||(QA=!0,t(gb).to(JA).inSingletonScope(),t(Sb).toService(gb))}));var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sk=function(t,e){return function(i,s){e(i,s,t)}};let nk=class extends hx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ru}};nk=ek([Ga(),sk(0,Ua(sv)),ik("design:paramtypes",[Object])],nk);let rk=!1;const ak=new La(((t,e,i,s)=>{rk||(rk=!0,t(_b).to(nk).inSingletonScope(),t(Sb).toService(_b))}));var ok=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hk=function(t,e){return function(i,s){e(i,s,t)}};let ck=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};ck=ok([Ga(),hk(0,Ua(lv)),lk("design:paramtypes",[Object])],ck);let dk=!1;const uk=new La(((t,e,i,s)=>{dk||(dk=!0,t(bb).to(ck).inSingletonScope(),t(Sb).toService(bb))}));var pk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Iu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};mk=pk([Ga(),fk(0,Ua(ov)),gk("design:paramtypes",[Object])],mk);let vk=!1;const _k=new La(((t,e,i,s)=>{vk||(vk=!0,t(yb).to(mk).inSingletonScope(),t(Sb).toService(yb))}));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 hx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Bu}};Sk=yk([Ga(),xk(0,Ua(hv)),bk("design:paramtypes",[Object])],Sk);let Ak=!1;const kk=new La(((t,e,i,s)=>{Ak||(Ak=!0,t(ub).to(Sk).inSingletonScope(),t(Sb).toService(ub))})),Mk=P_();function Tk(){Tk.__loaded||(Tk.__loaded=!0,of.RegisterGraphicCreator("arc",tf),Eh.load(ay),Eh.load(Mk?cA:fx))}Tk.__loaded=!1;const wk=Tk;function Ck(){Ck.__loaded||(Ck.__loaded=!0,of.RegisterGraphicCreator("area",Zg),Eh.load(uy),Eh.load(Mk?EA:xx))}Ck.__loaded=!1;const Ek=Ck;function Bk(){Bk.__loaded||(Bk.__loaded=!0,of.RegisterGraphicCreator("circle",mg),Eh.load(my),Eh.load(Mk?NA:Cx))}Bk.__loaded=!1;const Pk=Bk;function Lk(){Lk.__loaded||(Lk.__loaded=!0,of.RegisterGraphicCreator("glyph",Lg),Eh.load(Ty),Eh.load(Mk?uk:Ix))}Lk.__loaded=!1;const Rk=Lk;function Ok(){Ok.__loaded||(Ok.__loaded=!0,of.RegisterGraphicCreator("group",wp))}Ok.__loaded=!1;const Ik=Ok;function Dk(){Dk.__loaded||(Dk.__loaded=!0,of.RegisterGraphicCreator("image",zg),Eh.load(Ry),Eh.load(Mk?kk:jx))}Dk.__loaded=!1;const Fk=Dk;function zk(){zk.__loaded||(zk.__loaded=!0,of.RegisterGraphicCreator("line",Tg),Eh.load(cy),Eh.load(Mk?AA:Gx))}zk.__loaded=!1;const jk=zk;function Hk(){Hk.__loaded||(Hk.__loaded=!0,of.RegisterGraphicCreator("path",Xg),Eh.load(by),Eh.load(Mk?tk:sS))}Hk.__loaded=!1;const Vk=Hk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,of.RegisterGraphicCreator("polygon",nf),Eh.load(Sy),Eh.load(Mk?ak:Zx))}Nk.__loaded=!1;const Uk=Nk;function Wk(){Wk.__loaded||(Wk.__loaded=!0,of.RegisterGraphicCreator("rect",Bg),Eh.load(ly),Eh.load(Mk?mA:dS))}Wk.__loaded=!1;const Gk=Wk;function Yk(){Yk.__loaded||(Yk.__loaded=!0,of.RegisterGraphicCreator("richtext",Gg),Eh.load(Py),Eh.load(Mk?_k:pS))}Yk.__loaded=!1;const $k=Yk;function Xk(){Xk.__loaded||(Xk.__loaded=!0,of.RegisterGraphicCreator("shadowRoot",af))}Xk.__loaded=!1;const Kk=Xk;function qk(){qk.__loaded||(qk.__loaded=!0,of.RegisterGraphicCreator("symbol",Ag),Eh.load(gy),Eh.load(Mk?DA:yS))}qk.__loaded=!1;const Zk=qk;function Jk(){Jk.__loaded||(Jk.__loaded=!0,of.RegisterGraphicCreator("text",bg),Eh.load(_y),Eh.load(Mk?XA:AS))}Jk.__loaded=!1;const Qk=Jk;function tM(){Ik(),Gk()}const eM=-.5*Math.PI,iM=1.5*Math.PI,sM="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 nM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(nM||(nM={}));const rM={[nM.selectedReverse]:{},[nM.selected]:{},[nM.hover]:{},[nM.hoverReverse]:{}},aM={container:"",width:30,height:30,style:{}},oM="scrollDrag";function lM(){return"browser"===y_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const hM={debounce:bt,throttle:xt};tM();let cM=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=lM(),a="browser"===y_.env?y_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:hM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(oM,{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",hM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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]=ni(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)}_clearDragEvents(){const t=lM(),e="browser"===y_.env?y_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};cM.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};var dM,uM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 pM=dM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=dM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(oM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new cM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(pM)||(t(pM).toSelf(),t(jv).toService(pM))}));function fM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&fM(t,e)}))}const mM=t=>!u(t)&&!1!==t.visible;function vM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function _M(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 bM=["#ffffff","#000000"];function xM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return SM(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(...bM);for(const n of a)if(t!==n&&SM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function SM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=kM(t),s=kM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function kM(t){const e=ii(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 MM(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 TM(t,e){return[t[0]*e,t[1]*e]}function wM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function CM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:sM,fontSize:14},s),getTextBounds:i?void 0:cf,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function BM(t,e,i={}){if(!t)return{width:0,height:0};const s=cf({text:t,fontFamily:e.fontFamily||i.fontFamily||sM,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 PM(t,e="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 LM(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 RM(t,e="type"){const i=PM(t,e);return"rich"===i?of.richtext(LM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),of.text(t))}function OM(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 IM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function DM(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 FM(t,e){const{dx:i,dy:s}=DM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function zM(){Ik(),Gk(),Zk(),$k(),Qk()}var jM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=jM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Fl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},HM.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))}}HM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const VM={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}},NM={poptip:j({},VM)};var UM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Gt(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Gt(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}qM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var ZM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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{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={};j(s,qM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new qM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,NM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};JM=ZM([Ga()],JM);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};class tT{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 eT=class extends tT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};eT=QM([Ga()],eT);let iT=class extends tT{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)}};iT=QM([Ga()],iT);const sT=new La(((t,e,i,s)=>{i(JM)||(t(JM).toSelf().inSingletonScope(),t(rg).toService(JM)),i(eT)||(t(eT).toSelf(),t(jv).toService(eT)),i(iT)||(t(iT).toSelf(),t(jv).toService(iT))}));class nT extends qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ik(),jk();class rT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ik(),Gk();class aT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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})}}aT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ik(),wk();class oT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}oT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ik(),wk();class lT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=eM,endAngle:s=iM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}lT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ik(),Vk();class hT extends nT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function cT(){Ik(),jk(),Uk(),Zk()}function dT(){Ik(),jk(),wk(),Zk()}hT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},cT();class uT extends qy{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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(k(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=of.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),P(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=of.line;Y(i)[0].cornerRadius&&(t=of.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=of.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}uT.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}}},dT();class pT extends uT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=of.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var gT,fT;!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"}(gT||(gT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(fT||(fT={}));const mT={[fT.selectedReverse]:{},[fT.selected]:{},[fT.hover]:{},[fT.hoverReverse]:{}},vT={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}}},_T={size:8,stroke:"#000",lineWidth:1,zIndex:1};const yT=Math.sin(Math.PI/10);function bT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function xT(t,e=yT){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function ST(t){const e={};return fM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function AT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function kT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/wM(r))}function MT(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 wT(t,e,i){var s;if(xT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function CT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(nM.hover,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.hoverReverse,!0)})),s):i},BT=(t,e,i)=>i?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),null):i,PT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(nM.selected)?(fM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(nM.selectedReverse),t.removeState(nM.selected))})),null):s.name&&!P(s.states)?(s.addState(nM.selected,!0),fM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(nM.selectedReverse,!0)})),s):i};class LT extends qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const RT={type:"default",duration:300,easing:"linear"};class OT extends LT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=ET(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=of.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._prepare(),this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=of.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(RT)}_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=of.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=gT.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=of.group({x:0,y:0,pickable:!1});t.name=gT.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=of.group({x:0,y:0,pickable:!1});i.name=gT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=of.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=gT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=rM;else{const t=this.data[s],e=j({},rM,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=of.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=gT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=rM;else{const i=j({},rM,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=of.group({x:0,y:0,pickable:!1});return r.name=`${gT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=RM(this._getLabelAttribute(t,e,n,i));if(a.name=gT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=rM;else{const s=j({},rM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new HM(Object.assign({},e));i.name=gT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return AT(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},vT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},fM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const IT={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&&wT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function DT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function FT(t,e,i,s,n=!1){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:IT[n]||IT.parity;if(s.length>=3&&CT(s,r)){do{s=a(s,r)}while(s.length>=3&&CT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);wT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),FT(l,s,n,(t=>wT(t,l,r))),FT(h,s,o,(t=>wT(t,h,r)||!(!n||t===l)&&wT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function jT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},NT(t,e.attribute.angle)),{angle:VT(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({},UT(t,e.attribute.angle)),{angle:VT(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=ke({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 VT(t=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 NT(t,e=0){let 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=VT(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 UT(t,e=0){let 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=VT(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 WT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=xT(h),m=bT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 GT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class YT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=wM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $T{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-$T.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$T.bounceIn(2*t):.5*$T.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){$T[t]=e}}function XT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$T.quadIn=$T.getPowIn(2),$T.quadOut=$T.getPowOut(2),$T.quadInOut=$T.getPowInOut(2),$T.cubicIn=$T.getPowIn(3),$T.cubicOut=$T.getPowOut(3),$T.cubicInOut=$T.getPowInOut(3),$T.quartIn=$T.getPowIn(4),$T.quartOut=$T.getPowOut(4),$T.quartInOut=$T.getPowInOut(4),$T.quintIn=$T.getPowIn(5),$T.quintOut=$T.getPowOut(5),$T.quintInOut=$T.getPowInOut(5),$T.backIn=$T.getBackIn(1.7),$T.backOut=$T.getBackOut(1.7),$T.backInOut=$T.getBackInOut(1.7),$T.elasticIn=$T.getElasticIn(1,.3),$T.elasticOut=$T.getElasticOut(1,.3),$T.elasticInOut=$T.getElasticInOut(1,.3*1.5),$T.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$T.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$T.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$T[`flicker${t}`]=e=>XT(e,t);for(let t=2;t<10;t++)$T[`aIn${t}`]=e=>t*e*e+(1-t)*e;function KT(t,e,i){return t+(e-t)*i}const qT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=KT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=KT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=KT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=KT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=KT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=KT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=KT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=KT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=KT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=op(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?hp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=op(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?hp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=KT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=KT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=KT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=KT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=KT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=KT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=KT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=KT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=KT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=qc(e,i,s),r.addUpdateBoundTag()}}};function ZT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$T[s])&&void 0!==n?n:$T.linear:$T.linear,"wait"===t&&(this.onUpdate=JT),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=JT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=rp.Get(i,np.Color255),r=rp.Get(s,np.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(qT["fill"===e?"fillPure":"strokePure"])}else qT[e]?t.push(qT[e]):t.push(ZT)}else qT[e]?t.push(qT[e]):t.push(ZT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class tw extends QT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class ew extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Co.END?this.removeAnimate(t,!0):t.status!==Co.RUNNING&&t.status!==Co.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const iw=new ew;iw.isGlobal=!0;class sw{constructor(t=Pa.GenAutoIncrementId(),e=iw,i){this.id=t,this.status=Co.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new QT(wo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new tw(wo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new QT(wo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Co.RUNNING&&(this.status=Co.PAUSED)}resume(){this.status===Co.PAUSED&&(this.status=Co.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Co.END&&this.onEnd(),this.status=Co.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Co.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Co.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Co.END);this.status=Co.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const nw=new _o;class rw{constructor(){this.released=!1}tick(t,e){nw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class aw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===To.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=To.INITIAL,mo.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),mo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new rw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==To.INITIAL&&(this.status=To.PAUSE,!0)}resume(){return this.status!==To.INITIAL&&(this.status=To.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===To.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===To.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=To.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=To.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===To.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===To.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}lw.getInstance();class hw{static registerBuiltInAnimate(t,e){hw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:hw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:hw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:hw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t){for(;this._animates.length>0;){const e=this._animates.pop();null==e||e.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,this.onEnd())}}hw.builtInAnimateMap={};const cw="appear",dw="disappear",uw="update",pw="highlight",gw="unhighlight";class fw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class mw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=lw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new hw(this.graphic)})})),n.forEach((t=>{t.executor.stop()})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyDisappearState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyUpdateState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyHighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop()})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class vw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new mw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new fw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new vw)._getAnimationStateManager(t),t}}class _w{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new sw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:iw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new ew}createTicker(t){return new aw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new hw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function yw(){G(kp,vw),G(kp,_w)}class bw extends QT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class xw extends bw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Sw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new hw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Aw(t){return new Sw(t)}class kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Mw=1e3,Tw="quadInOut",ww=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Cw=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=op(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Ew=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Z_(t):[],n=Z_(e);i&&s&&(i.fromTransform&&J_(s,i.fromTransform.clone().getInverse()),J_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Pw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Lw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Pw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?rp.Get(t,np.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Rw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Ew(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Cw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Ow=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Bw(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Lw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Rw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Mw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Tw);return c.play(d),c};class Iw extends bw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Ew(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&Cw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Dw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>ww.includes(t))(i)||(e[i]=t[i])})),e},Fw=(t,e,i)=>{const s=Dw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=mo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},zw=(t,e,i)=>{const s=[],n=i?null:Dw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Dw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=wg(t.attribute),n=ty(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(mo.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=ty(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(mo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=ty(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(mo.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ey(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ey(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(mo.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:iy(i)}];const s=[];return ny(i,e,s),s})(t,e).forEach((t=>{s.push(mo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return ny(l,e,h),h})(t,e).forEach((t=>{s.push(mo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Z_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(mo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(mo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Fw(t,s,e),s};class Hw extends bw{constructor(t,e,i,s,n){super(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(){super.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:Uo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Uo.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:Uo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vw extends Hw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=mo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Nw extends Hw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=mo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Uw extends bw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Kc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class $w extends Gw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Xw=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Kw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class qw extends Kw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Xw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class Zw extends Kw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Jw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Qw extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const tC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class eC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const sC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class nC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Kc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class rC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:sC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class aC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:sC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const oC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class lC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class hC extends nC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const cC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class dC extends nC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:cC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends nC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:cC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const pC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class gC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fC extends gC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=pC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class mC extends gC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const vC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class _C extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class bC extends xw{onBind(){var t;const e=Aw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class xC extends xw{onBind(){const t=Aw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function SC(){Ik(),jk(),$k(),Qk(),hw.registerBuiltInAnimate("axisEnter",bC),hw.registerBuiltInAnimate("axisUpdate",xC)}var AC=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=of.group({zIndex:999});e.name=gT.axisBreak,e.id=this._getNodeId(`${gT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},_T,s),a=null!==(e=r.size)&&void 0!==e?e:_T.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=of.symbol(Object.assign({x:s.x,y:s.y},o));l.name=gT.axisBreakSymbol;const h=of.symbol(Object.assign({x:n.x,y:n.y},o));h.name=gT.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=of.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=gT.background,n.id=this._getNodeId("background"),n.states=j({},mT,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=AC(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];P(l)||(c.state={line:j({},mT,l),symbol:j({},mT,l)});const d=new uT(c);d.name=gT.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=AC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=CM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},mT,c.text),shape:j({},mT,c.shape),panel:j({},mT,c.background)}});return E.angle=w,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 NT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return UT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=re(e)})),HT(i,t),!jT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=xT(a),l=bT(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=GT(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);k(i)&&(c=Gt(c,i))}}else{if(l){const i=GT(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);k(i)&&(c=Gt(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&&k(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);WT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&zT(t,{orient:o,method:m,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(k(c)&&(!k(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=of.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=gT.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=BM(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=ni(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}}kC.defaultAttributes=vT,G(kC,YT);class MC{isInValidValue(t){const{startAngle:e=eM,endAngle:i=iM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=eM,endAngle:i=iM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return kT(t,i,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 TC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=TC(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 EC=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),k(l)&&l>=3){const t=MT(n,l,c,e,i);h=of.path(Object.assign(Object.assign({},a.style),{path:TT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=of.circle(t)}h.name=gT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},mT,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=EC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},mT,d.text),shape:j({},mT,d.shape),panel:j({},mT,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}=TC(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&&wC(e,c,i)}else e.AABBBounds.width()>r&&wC(e,r,i)}else o>a.x&&h.x2>n.x2?(wC(e,n.x2-o,i),r&&CC(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}}BC.defaultAttributes=vT,G(BC,MC);const PC=t=>t.map(((t,e)=>({index:e,value:t}))),LC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},RC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{DC[t]=!0}));const VC=t=>-Math.log(-t),NC=t=>-Math.exp(-t),UC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,WC=t=>10===t?UC:t===Math.E?Math.exp:e=>Math.pow(t,e),GC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),YC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),$C=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function XC(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function KC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function qC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function ZC(t,e,i,s){return 1===i&&(i=0),qC(t,i,s)*(e/(1-i))}function JC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function QC(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]{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 eE{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=JC(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=mt(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 iE=Symbol("implicit");class sE extends eE{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=IC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=iE}clone(){const t=(new sE).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!==iE)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 nE(t,e,r,n)}class aE extends sE{constructor(t){super(),this.type=IC.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=ZC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:rE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return rE(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 aE(!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:oE}=si;function lE(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=ti.parseColorString(e)){const e=oE(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?oE(t,e):e instanceof ti?oE(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 hE extends eE{constructor(t=HC,e=HC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=HC,this._piecewise=KC,this._interpolate=lE}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=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=_t(i[0],i[r-1])),this._piecewise=r>2?QC:KC,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:HC),this.rescale(i)):this._clamp!==HC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 cE=Math.sqrt(50),dE=Math.sqrt(10),uE=Math.sqrt(2),pE=[1,2,5,10],gE=(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=_E(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?mE(0,-(e-1)/s,s):mE((e-1)/s,0,s)},fE=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 gE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return gE(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=mE(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=mE(t,e,l);return n&&r.reverse(),r})),_E=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=pE[0];return i>=cE?s=pE[3]:i>=dE?s=pE[2]:i>=uE&&(s=pE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function yE(t,e,i){const s=(e-t)/Math.max(0,i);return _E(s)}function bE(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;e0;){if(s=yE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function SE(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 AE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),kE=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})),ME=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=vE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?AE(t,e,n):AE(t,e,tE(n)),h=AE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),TE=ft(((t,e,i,s,n)=>bE(s(t),s(e),i).map((t=>tE(n(t))))));class wE extends hE{constructor(){super(...arguments),this.type=IC.Linear}clone(){var t;const e=new wE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return fE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=vE(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(t=10){const e=this.calculateVisibleDomain(this._range);return bE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 EE(t){return e=>-t(-e)}function BE(t=Number.EPSILON){return e=>Math.max(e,t)}class PE extends hE{constructor(){super(GC(10),WC(10)),this.type=IC.Log,this._limit=BE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new PE).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=GC(this._base),s=WC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=EE(i),this._pows=EE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=VC,this.untransformer=NC):(this._logs=i,this._pows=s,this._limit=BE(),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 HC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return kE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(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))))}}}G(PE,CE);class LE extends wE{constructor(){super(YC(1),$C(1)),this.type=IC.Symlog,this._const=1}clone(){return(new LE).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=YC(t),this.untransformer=$C(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return kE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return TE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(LE,CE);class RE{constructor(){this.type=IC.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)&&k(+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 RE).domain(this._domain).range(this._range).unknown(this._unknown)}}function OE(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 IE(t,e,i,s,n=!1){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,n,r;if(!FC(t.type))return PC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return PC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=OE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=OE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=OE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=OC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=OC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?FE.greedy:FE.parity;for(;l.length>=3&&CT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;wT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),IE(t,l,a,(e=>wT(e,t,i))),IE(n,l,o,(e=>wT(e,n,i)||!(!a||e===t)&&wT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return PC(m)},FE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&wT(i,t,e)||(i=t,0))))}},zE=(t,e,i,s)=>{const n=OC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},jE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,HE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?PC([s[s.length-1]]):PC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=zE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=NE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=zE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!jE(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?HE(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=EM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=AT(r,kT(s,r,e,n));return o=a,l=kT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 PC(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=UE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=GE(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 PC(c)},GE=(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&&LC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},YE=new Uint32Array(33),$E=new Uint32Array(33);$E[0]=0,YE[0]=~$E[0];for(let t=1;t<=32;++t)$E[t]=$E[t-1]<<1|1,YE[t]=~$E[t];function XE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&YE[31&o]&$E[1+(31&l)])return!0}else{if(i[h]&YE[31&o])return!0;if(i[c]&$E[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,YE[31&o]&$E[1+(31&l)]);else for(s(h,YE[31&o]),s(c,$E[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,$E[31&a]|YE[1+(31&o)]);else for(n(l,$E[31&a]),n(h,YE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 KE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function qE(t,e,i=!1){return i?KE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function ZE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=qE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=KE(t,r)),e.getRange(r)))}function JE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return JE(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 JE(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 JE(t,e,n,s,h,c)}return!1}const tB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],eB=["top","inside-top","inside"];function iB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const sB={mode:"same-time",duration:300,easing:"linear"};function nB(t){return 3===t||4===t}function rB(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 aB=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 oB(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)}}var lB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const dB=(t,e)=>Math.ceil(t)>Math.floor(e),uB=([t,e],[i,s])=>s>t&&e>i;function pB(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 gB=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||P(e.states)||(e.addState(nM.hover,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(fM(this,(t=>{P(t.states)||(t.removeState(nM.hoverReverse),t.removeState(nM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void fM(this,(t=>{P(t.states)||(t.removeState(nM.selectedReverse),t.removeState(nM.selected))}));P(e.states)||(e.addState(nM.selected,!0),fM(this,(t=>{t===e||P(t.states)||t.addState(nM.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)===Uo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Uo.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(xe(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[oB(g,f,c,d,a,o),oB(-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=of.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Fl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return RM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&dB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&dB(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(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(pB([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])&&!uB([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 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},h),{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(qE(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(qE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(qE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{mB[t]=e};var _B=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{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,i,s)}}yB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const bB=()=>{vB("symbol",yB),vB("line-data",yB)};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);n{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}}}SB.tag="rect-label",SB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var AB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};kB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const MB=()=>{vB("line",kB),vB("area",kB)};var TB=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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=pe(h.endAngle-u/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new wB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):nB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(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=nB(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=nB(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=nB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?nB(t.quadrant)?"left":"right":nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(nB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 PB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 LB(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=TT(t,!!n),o=TT(r,!!n);const h=ne.distancePP(s,l),c=ne.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=PB(e,t,!1,!!n),o=PB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=TT(t,!!n),o=TT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}BB.defaultAttributes={pickable:!1};class RB extends qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&ST(this._innerView),this.removeAllChild(!0),this._innerView=of.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 AT(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?`${gT.grid}-sub`:`${gT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=TT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=PB(t,o,!1,!!a)}const u=of.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:RB.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=TT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=of.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:RB.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}}RB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ik(),Vk();class OB extends RB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RB.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=eM,endAngle:r=iM}=this.attribute;i=MT(t,s,ne.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=j({},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})}}G(OB,YT);var IB=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"})}}G(DB,MC);const FB="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",zB={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:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},jB={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 HB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HB||(HB={}));var VB=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._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=HB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===y_.env?y_:this.stage,s=lM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===HB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HB.endHandler):h+=l:this._activeTag===HB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===y_.env?y_:this.stage,e=lM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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:mt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HB.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:mt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HB.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=VB(c,["formatMethod"]),{formatMethod:g}=d,f=VB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 je).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},jB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},jB.horizontal),V),{pickable:!U&&(null===(b=V.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},jB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},jB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},jB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},jB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},jB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},jB.vertical),{pickable:!U}),"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 HM(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)}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var WB,GB,YB,$B;function XB(){Ik(),zM(),yw()}UB.defaultAttributes=zB,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"}(WB||(WB={})),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"}(GB||(GB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YB||(YB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($B||($B={}));class KB extends qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=ET(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=BT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=PT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=of.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=of.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=of.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 qB(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 ZB(t,e,i,s){t&&(qB(t.startSymbol,e,i,s),t.lines.forEach((t=>qB(t,e,i,s))),qB(t.line,e,i,s),qB(t.endSymbol,e,i,s))}function JB(t,e,i,s){t&&(qB(t.getTextShape(),e,i,s),qB(t.getBgRect(),e,i,s))}function QB(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 tP(t,e,i,s){t&&(QB(t.startSymbol,e,i,s),t.lines.forEach((t=>QB(t,e,i,s))),QB(t.line,e,i,s),QB(t.endSymbol,e,i,s))}function eP(t,e,i,s){t&&(QB(t.getTextShape(),e,i,s),QB(t.getBgRect(),e,i,s))}function iP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qB(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)})),qB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;qB(t.getTextShape(),e,l,n),qB(t.getBgRect(),e,l,n)}))}function sP(t,e,i,s,n){ZB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function nP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function rP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{JB(t,s,i,n)}))}function aP(t,e,i,s,n,r){var a;ZB(t,n,s,r),qB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JB(i,n,s,r):qB(i,n,s,r)}function oP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qB(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)})),qB(e,n+o+l,h,r),qB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qB(i.getTextShape(),n+o+l+h+c,d,r),qB(i.getBgRect(),n+o+l+c,d,r)):qB(i,n+o+l+c,d,r)}function lP(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?iP(t,e,s,r,a):"fadeIn"===i&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iP(t,e,s,n,a):"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tP(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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&&rP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{eP(t,s,i,n)}))}(t,e,i,s,n)}}function dP(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?aP(n,r,e,i,s,o):"callIn"===t&&oP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aP(n,r,e,i,s,a):"callIn"===t&&oP(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;tP(t,n,s,r),QB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eP(i,n,s,r):QB(i,n,s,r)}(n,r,e,t,i,s)}}const uP={type:"clipIn",duration:500,easing:"linear",delay:0},pP={type:"fadeIn",duration:500,easing:"linear",delay:0},gP={type:"callIn",duration:500,easing:"linear",delay:0},fP={type:"fadeOut",duration:500,easing:"linear",delay:0};class mP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new HM(Object.assign(Object.assign({},h),{state:{panel:j({},rM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},rM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},rM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},rM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class vP extends KB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=fP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;FM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(vP,mP);const _P=.001,yP={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:WB.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]}},bP={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"}}},xP={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:{autoRotate:!0,position:YB.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]}},SP={interactive:!0,label:{position:GB.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}},AP={interactive:!0,label:{autoRotate:!0,position:YB.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}},kP={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"}},MP={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"}},TP={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 wP(){CP._animate=lP}XB(),cT(),yw();class CP extends vP{markerAnimate(t){CP._animate&&this._animationConfig&&CP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},CP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(vM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return _M(Math.abs(e),Math.PI/2,_P)||_M(Math.abs(e),3*Math.PI/2,_P)?yM(i,e,t):vM(e)?bP.postiveXAxis[t]:bP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new uT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==a?void 0:a.line),startSymbol:j({},rM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},rM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",CP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(CP.defaultAttributes.label)}}function EP(){BP._animate=hP}CP.defaultAttributes=yP,XB(),Uk(),yw();class BP extends KB{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},MP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=of.polygon(Object.assign({points:e},i));n.states=j({},rM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",BP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},rM,null==i?void 0:i.area)),this._updateMarkLabels(BP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}BP.defaultAttributes=SP,G(BP,mP),XB(),dT(),yw();class PP extends vP{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case YB.arcInnerStart:l=n;case YB.arcOuterStart:l=n;break;case YB.arcInnerEnd:l=r;case YB.arcOuterEnd:l=r;break;case YB.center:case YB.arcInnerMiddle:case YB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new pT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,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:j({},rM,null==o?void 0:o.line),startSymbol:j({},rM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},rM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",PP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(PP.defaultAttributes.label)}}PP.defaultAttributes=xP,XB(),wk(),yw();class LP extends KB{markerAnimate(t){LP._animate&&this._animationConfig&&LP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=fP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case YB.center:h=(s+n)/2,c=(r+a)/2;break;case YB.arcInnerStart:h=s,c=r;break;case YB.arcOuterStart:h=n,c=r;break;case YB.arcInnerEnd:h=s,c=a;break;case YB.arcOuterEnd:h=n,c=a;break;case YB.arcInnerMiddle:h=s,c=(r+a)/2;break;case YB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;FM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=of.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},rM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",LP.defaultAttributes.label)}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=j({},rM,null==o?void 0:o.area)),this._updateMarkLabels(LP.defaultAttributes.label)}isValidPoints(){return!0}}function RP(){OP._animate=dP}LP.defaultAttributes=AP,G(LP,mP),XB(),cT(),dT(),Zk(),Fk(),jk(),yw();class OP extends KB{markerAnimate(t){OP._animate&&this._animationConfig&&OP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gP,this.defaultExitAnimation=fP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return _M(Math.abs(s),Math.PI/2,_P)||_M(Math.abs(s),3*Math.PI/2,_P)?yM(t,s,n):vM(s)?TP.postiveXAxis[n]:TP.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,style:d,position:u=$B.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},rM,null==p?void 0:p.textBackground),text:j({},rM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},rM,null==p?void 0:p.itemContent));const v=vM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=of.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"text"===n?o=new HM(Object.assign(Object.assign({},i),{state:{panel:j({},rM,null==s?void 0:s.textBackground),text:j({},rM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=of.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"image"===n?(o=of.image(Object.assign(Object.assign({},i),r)),o.states=j({},rM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},rM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=_M(c,0,_P)||_M(d,0,_P),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=IM(e-u,t-d),o=IM(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(UP.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(UP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===UP.focus||"focus"===o){const s=a.hasState(VP.focus);a.toggleState(VP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover,VP.focus],t),this._setLegendItemState(e,VP.selected,t)})):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover,VP.focus],t),this._setLegendItemState(e,VP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(VP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(VP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[VP.selected,VP.selectedHover],t),this._setLegendItemState(a,VP.unSelected,t)):(this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t))}else this._setLegendItemState(a,VP.selected,t),this._removeLegendItemState(a,[VP.unSelected,VP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[VP.selected,VP.selectedHover],t),this._setLegendItemState(e,VP.unSelected,t))}))}this._dispatchLegendEvent(NP.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,VP.selected),this._removeLegendItemState(e,[VP.unSelected,VP.unSelectedHover])):(this._removeLegendItemState(e,[VP.selected,VP.selectedHover]),this._setLegendItemState(e,VP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=zP,spaceRow:l=jP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=of.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ni(c);let w;!1===x.visible?(w=of.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,UP.item,t,w)):(w=of.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,UP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?VP.selected:VP.unSelected);const C=of.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=of.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,UP.itemShape,t,w,S.state),s.addState(e?VP.selected:VP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=of.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,UP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=RM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,UP.itemLabel,t,w,A.state),D.addState(e?VP.selected:VP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=RM(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,UP.itemValue,t,w,k.state),r.addState(e?VP.selected:VP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 FP(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 FP(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 cM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new cM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=zP,spaceRow:o=jP}=n,l=this._itemsContainer,{space:h=HP,defaultCurrent:c=1}=r,d=$P(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;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,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),_=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,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=of.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=zP,spaceRow:a=jP}=s,o=this._itemsContainer,{space:l=HP,defaultCurrent:h=1}=n,c=$P(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 _=of.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=of.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(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(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(VP.selected)?this._setLegendItemState(t,VP.selectedHover,e):this._setLegendItemState(t,VP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===UP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(VP.unSelectedHover)||t.hasState(VP.selectedHover))&&(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(VP.unSelectedHover)&&!t.hasState(VP.selectedHover)||(i=!0),t.removeState(VP.unSelectedHover),t.removeState(VP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===UP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NP.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!==UP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NP.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!==UP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(VP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},XP,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(VP.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 qP;function ZP(t){return y(t)?t:[t,t]}function JP(t){return t?"ew-resize":"ns-resize"}KP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:zP,spaceRow:jP,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:HP,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"}(qP||(qP={})),GP();class QP extends qy{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:j({},QP.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===y_.env?y_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=lM(),n="browser"===y_.env?y_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:ZP(d)[0],endValue:ZP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=of.group({x:0,y:0});f.name=qP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=of.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)),m.name=qP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=of.group({x:g?v:0,y:g?0:v});f.add(_);const y=of.group({x:0,y:0});let b;if(y.name=qP.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=of.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=qP.endText,f.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=of.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=qP.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,f]=ZP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(v.name=qP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=qP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":JP(p)},r));if(i.name=qP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=qP.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=mt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=of.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=qP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":JP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=of.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=qP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return of.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":JP(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),of.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=of.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=of.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),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=lM(),e="browser"===y_.env?y_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===qP.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===qP.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===qP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===qP.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}}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}QP.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}}},YP(),GP();class tL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function eL(t="bottom"){let 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`}tL.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"}}},YP(),GP(),Vk();class iL extends WP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},iL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=of.group({x:0,y:0});this._innerView.add(x);const S=new QP({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:eL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=of.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}iL.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)"}},Ik(),Qk(),$k();let sL=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},aM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},aM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};sL.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 nL={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"}}};Ik(),Qk(),$k();let rL=class extends qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(nL,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=RM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=BM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 aL extends Sg{constructor(t){super(t)}}var oL,lL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oL||(oL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lL||(lL={}));class hL extends qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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"},hL.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"},hL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},hL.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 aL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new aL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new aL(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(oL.OnPlay)},this.pause=()=>{this._dispatchEvent(oL.OnPause)},this.forward=()=>{this._dispatchEvent(oL.OnForward)},this.backward=()=>{this._dispatchEvent(oL.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()}}hL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hL.defaultAttributes={[lL.Start]:{},[lL.Pause]:{},[lL.Backward]:{},[lL.Forward]:{}};const cL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dL=[200,10];var uL,pL;!function(t){t.Default="default",t.Reverse="reverse"}(uL||(uL={})),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"}(pL||(pL={}));const gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),fL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===uL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===uL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),mL=t=>"top"===t||"bottom"===t;class vL extends qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},vL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(mL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:dL[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:dL[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 QP(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=mL(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 hL(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=mL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mL(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:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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:mL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mL(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:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mL(this._orient)?t+s:(this._size.width-r)/2,y:mL(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 _L(){GP(),Ik(),Zk()}vL.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({},cL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cL),{key:"backward",position:"start"})}},_L();class yL extends vL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:uL.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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=y_.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(pL.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(pL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=y_.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(),y_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.change),this.dispatchCustomEvent(pL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var bL,xL=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())}))};_L();class SL extends vL{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(oL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oL.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(pL.change))},this.play=()=>xL(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(pL.play),this._rafId=y_.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=y_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pL.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(pL.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(pL.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.brushActive="brushActive",t.brushClear="brushClear"}(bL||(bL={}));const AL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},kL=5;const ML={debounce:bt,throttle:xt};Ik(),Uk();let TL=class t extends qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=AL.updateTrigger,endTrigger:i=AL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:ML[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=AL.trigger,resetTrigger:e=AL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(bL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(bL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=kL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(bL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(bL.brushActive,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._dispatchBrushEvent(bL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=kL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(bL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=AL.updateTrigger,endTrigger:e=AL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=of.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};TL.defaultAttributes=AL;const wL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},CL=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}},EL={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:sM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:sM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},BL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ik(),Gk(),Zk(),Qk(),$k();let PL=class t extends qy{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=ni(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:mM(u)&&mM(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:mM(u)&&mM(u.value)},CL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:mM(u)&&mM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:mM(u)&&mM(u.value)},CL(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},aM),u.value),visible:mM(u)&&mM(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=mM(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 _=mM(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(!mM(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)+(mM(n.key)?r+n.key.spacing:0)+(mM(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&&(OM(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:mM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),OM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(mM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=td(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(mM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},CL(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},CL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},aM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(mM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},CL(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},CL(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=>BL.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)&&mM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=mM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(mM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(mM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&nu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 wL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PL.defaultAttributes=EL;const LL=ut;function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function OL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function IL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function DL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function FL(t,e){const i=DL(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 zL(t,e){const i=jL(t),s=jL(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 jL(t,e={x:0,y:0}){return ne.distancePP(t,e)}function HL(t){return k(t.x)&&k(t.y)}function VL(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 NL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const UL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function GL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&GL(t[i],e)}}var YL,$L,XL;function KL(t){var e,i;const{type:s}=t;return s===$L.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(YL||(YL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}($L||($L={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(XL||(XL={}));const qL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},ZL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function JL(t,e){var i;if(!t)return[];const s=rR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?sR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>iR(i)?tR(t,i,e):i)).filter(p)}))):i.map((i=>iR(i)?tR(t,i,e):i)).filter(p):[]}return[]}function QL(t,e){var i,s;return sR(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 tR(t,e,i){var s;const n=rR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=qL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=ZL[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 ti(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=We(n,r,e.l),l=new ti(`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 eR=(t,e)=>{if(e&&iR(t)){const i=tR(e,t);if(i)return i}return t};function iR(t){return t&&"palette"===t.type&&!!t.key}function sR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function nR(t){return y(t)?{dataScheme:t}:t}function rR(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=KL(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 aR extends sE{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(!sR(this._range))return void super.range(this._range);const t=QL(this._range,this._domain);super.range(t)}}const oR={linear:wE,band:aE,point:class extends aE{constructor(t){super(!1),this.type=IC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:sE,threshold:RE,colorOrdinal:aR};function lR(t){const e=oR[t];return e?new e:null}function hR(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 cR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function dR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function uR(t){return!!_(t)&&(!!t.endsWith("%")&&$y(t.substring(0,t.length-1)))}function pR(t){return!!g(t)&&("percent"in t||"offset"in t)}function gR(t,e,i,s=0){var n,r;return S(t)?t:uR(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 fR(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]=gR(t[s],e.size,i)}))})),o}function mR(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}}function vR(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)||uR(t)||d(t)||pR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function _R(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const yR=(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},bR=[{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"]}];function xR(t,e){return t&&e.key in t?t[e.key]:e.default}function SR(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%"},kR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:bR,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"}}},token:AR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},MR={name:"dark",colorScheme:{default:{dataScheme:bR,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}}}}}},TR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>TR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>TR(t[i],e[i])))),wR=(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]={}),wR(t[s],e.slice(1),i))},CR=t=>t instanceof Ta||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 ER(t,e=["data"]){return I(t,CR,e)}function BR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=nR(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)})}PR._charts={},PR._series={},PR._components={},PR._graphicComponents={},PR._marks={},PR._regions={},PR._animations={},PR._implements={},PR._chartPlugin={},PR._vChartPlugin={},PR._componentPlugin={},PR.transforms={fields:Gr,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}},PR.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=jr(ea,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Jr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,ta(t))},PR._layout={},PR._grammarTransforms={},PR._stageEventPlugins={},PR.registerStageEventPlugin=(t,e)=>{PR._stageEventPlugins[t]=e},PR.getStageEventPlugin=t=>PR._stageEventPlugins[t],PR._interactionTriggers={},PR.registerInteractionTrigger=(t,e)=>{PR._interactionTriggers[t]=e},PR._composedEventMap={},PR.registerComposedEvent=(t,e)=>{PR._composedEventMap[t]=e},PR._tooltipProcessors={},PR.registerTooltipProcessor=(t,e)=>{PR._tooltipProcessors[t]=e},PR.createTooltipProcessor=(t,e)=>{const i=PR._tooltipProcessors[t];return i?new i(e):null};const OR=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},IR=OR(),DR={[kR.name]:kR},FR=kR.name,zR=new Map(Object.keys(DR).map((t=>[t,DR[t]]))),jR=new Map,HR=new Map(Object.keys(DR).map((t=>[t,t===FR]))),VR=(t,e)=>{if(!t)return;const i=GR(e);zR.set(t,i),HR.set(t,!0)},NR=(t=FR)=>(HR.has(t)&&!HR.get(t)&&VR(t,zR.get(t)),zR.get(t)),UR=t=>zR.delete(t)&&jR.delete(t)&&HR.delete(t),WR=t=>!!_(t)&&zR.has(t),GR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:FR;return LR({},NR(i),t)};class YR{static registerInstance(t){YR.instances.set(t.id,t)}static unregisterInstance(t){YR.instances.delete(t.id)}static getInstance(t){return YR.instances.get(t)}static instanceExist(t){return YR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return YR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}YR.instances=new Map;class $R{static registerTheme(t,e){VR(t,e)}static getTheme(t,e=!1){return NR(t)}static removeTheme(t){return UR(t)}static themeExist(t){return WR(t)}static getDefaultTheme(){return $R.themes.get(FR)}static setCurrentTheme(t){$R.themeExist(t)&&($R._currentThemeName=t,YR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return $R.getTheme($R._currentThemeName,t)}static getCurrentThemeName(){return $R._currentThemeName}}function XR(t){return _(t)?$R.themeExist(t)?$R.getTheme(t):{}:g(t)?t:{}}$R.themes=zR,$R._currentThemeName=FR;const KR=["animationThreshold","colorScheme","name","padding"];function qR(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];KR.includes(n)?s[n]=r:m(r)?iR(r)?s[n]=eR(r,e):SR(r)?s[n]=xR(i,r):s[n]=qR(r,e,i):s[n]=r})),s}function ZR(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]=ZR(t[s],e)}return i}return y(t)?t.map((t=>ZR(t,e))):t}function JR(t,e){if(!t)return t;if(m(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]=JR(t[s],e)}return i}return y(t)?t.map((t=>JR(t,e))):t}const QR=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:AR.fontFamily,fontSize:AR.fontSize}))(e,i,s).measure(t),tO="__VCHART",eO=500,iO=500,sO=`${tO}_MEASURE_CANVAS_ID`,nO=`${tO}_DEFAULT_DATA_INDEX`,rO=`${tO}_DEFAULT_DATA_KEY`,aO=`${tO}_DEFAULT_DATA_SERIES_FIELD`,oO=`${tO}_DEFAULT_SERIES_STYLE_NAME`,lO=`${tO}_STACK_KEY`,hO=`${tO}_STACK_START`,cO=`${tO}_STACK_END`,dO=`${tO}_STACK_START_PERCENT`,uO=`${tO}_STACK_END_PERCENT`,pO=`${tO}_STACK_START_OffsetSilhouette`,gO=`${tO}_STACK_END_OffsetSilhouette`,fO=`${tO}_STACK_TOTAL`,mO=`${tO}_STACK_TOTAL_PERCENT`,vO=`${tO}_STACK_TOTAL_TOP`,_O=`${tO}_STACK_TOTAL_BOTTOM`,yO=`${tO}_MOSAIC_VALUE_START_PERCENT`,bO=`${tO}_MOSAIC_VALUE_END_PERCENT`,xO=`${tO}_MOSAIC_CAT_START_PERCENT`,SO=`${tO}_MOSAIC_CAT_END_PERCENT`,AO=`${tO}_SEGMENT_START`,kO=`${tO}_SEGMENT_END`,MO=`${tO}_KEY`;function TO(t,e){for(let i=0;it.key===e))}function CO(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 EO(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:{}},OO(t,a,n[o],l,e,r))})),s?BO(n):n}function BO(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))):BO(t[e].nodes);return t}function PO(t,e){if("values"in t&&t.values.length){const i=IL(t.values,e),s=OL(t.values,uO);t.values.forEach((t=>{t[fO]=i,t[mO]=s}))}else for(const i in t.nodes)PO(t.nodes[i],e)}function LO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][cO]/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)RO(t.nodes[r],e,i,s,n)}function OO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[cO]=function(t){if(k(t))return t;const e=+t;return k(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)),OO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const IO=(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]=FO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function zO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>VO(t.style(e,i,s,n)):P(t.style)||(e.style=VO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>VO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=VO(t.state[e]))})),e.state=i}return e}function jO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>VO(t[i](e,s,n,r)):P(t[i])||(e[i]=VO(t[i]))})),e}function HO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),VO(i)}function VO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const NO=t=>"line"===t||"area"===t,UO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return NO(i)?e:null==e?void 0:e[0]},WO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let GO=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},n=PR.getComposedEvent(t);if(n){const e=new n(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(PR.getComposedEvent(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()}};var YO;!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"}(YO||(YO={}));const $O=["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 XO,KO,qO;t.ChartEvent=void 0,(XO=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",XO.rendered="rendered",XO.renderFinished="renderFinished",XO.animationFinished="animationFinished",XO.regionSeriesDataFilterOver="regionSeriesDataFilterOver",XO.afterInitData="afterInitData",XO.afterInitEvent="afterInitEvent",XO.afterInitMark="afterInitMark",XO.rawDataUpdate="rawDataUpdate",XO.viewDataFilterOver="viewDataFilterOver",XO.viewDataUpdate="viewDataUpdate",XO.viewDataStatisticsUpdate="viewDataStatisticsUpdate",XO.markDeltaYUpdate="markDeltaYUpdate",XO.viewDataLabelUpdate="viewDataLabelUpdate",XO.scaleDomainUpdate="scaleDomainUpdate",XO.scaleUpdate="scaleUpdate",XO.dataZoomChange="dataZoomChange",XO.drill="drill",XO.layoutStart="layoutStart",XO.layoutEnd="layoutEnd",XO.layoutRectUpdate="layoutRectUpdate",XO.playerPlay="playerPlay",XO.playerPause="playerPause",XO.playerEnd="playerEnd",XO.playerChange="playerChange",XO.playerForward="playerForward",XO.playerBackward="playerBackward",XO.scrollBarChange="scrollBarChange",XO.brushStart="brushStart",XO.brushChange="brushChange",XO.brushEnd="brushEnd",XO.brushClear="brushClear",XO.brushActive="brushActive",XO.legendSelectedDataChange="legendSelectedDataChange",XO.legendFilter="legendFilter",XO.legendItemClick="legendItemClick",XO.legendItemHover="legendItemHover",XO.legendItemUnHover="legendItemUnHover",XO.tooltipShow="tooltipShow",XO.tooltipHide="tooltipHide",XO.tooltipRelease="tooltipRelease",XO.afterResize="afterResize",XO.afterRender="afterRender",XO.afterLayout="afterLayout",XO.afterMarkLayoutEnd="afterMarkLayoutEnd",XO.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(KO||(KO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(qO||(qO={}));const ZO=[qO.mark,qO.model,qO.chart,qO.vchart];class JO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(qO.vchart,[]),this._levelNodes.set(qO.chart,[]),this._levelNodes.set(qO.model,[]),this._levelNodes.set(qO.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 QO={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 tI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>UO(t)))};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)||KO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||KO.chart);o.get(t)||o.set(t,new JO);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)||KO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||KO.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)||KO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||KO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?ZO.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[KO.chart,KO.window,KO.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&&L(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 QO[a]&&(a=QO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?qO.model:qO.vchart:qO.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=KO.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!==qO.model&&s!==qO.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=qO.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 KO.chart:return this._viewBubbles;case KO.window:return this._windowBubbles;case KO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case KO.chart:return this._viewListeners;case KO.window:return this._windowListeners;case KO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return $O.includes(t)||Object.values(YO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&PR.hasInteractionTrigger(e)}}function eI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function iI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const sI=new Map;let nI;function rI(){nI||(nI=new Ma,iI(nI,"geojson",ya),iI(nI,"topojson",xa),eI(nI,"simplify",Ur))}function aI(t,e,i={type:"geojson",centroid:!0}){sI.has(t)&&Fy(`map type of '${t}' already exists, will be overwritten.`),rI();const s=new Ta(nI),n=j({},{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}),sI.set(t,s)}function oI(t){sI.has(t)?sI.delete(t):Fy(`map type of '${t}' does not exists.`)}function lI(t,e=!1){let i=e;return t.latestData instanceof Ta&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const hI=(t,e)=>0===t.length?[]:1===t.length?lI(t[0],null==e?void 0:e.deep):t.map((t=>lI(t,null==e?void 0:e.deep)));function cI(e,i,s){eI(i=i instanceof Ma?i:e.dataSet,"copyDataView",hI);const n=new Ta(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function dI(t,e,i=[]){var s;if(t instanceof Ta)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 Ta(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Fy(`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 Fy(`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([]),Fy("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 uI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var pI,gI,fI,mI;t.TransformLevel=void 0,(pI=t.TransformLevel||(t.TransformLevel={}))[pI.copyDataView=-10]="copyDataView",pI[pI.treemapFilter=-8]="treemapFilter",pI[pI.treemapFlatten=-7]="treemapFlatten",pI[pI.dotObjFlat=-7]="dotObjFlat",pI[pI.linkDotInfo=-7]="linkDotInfo",pI[pI.sankeyLayout=-7]="sankeyLayout",pI[pI.dataZoomFilter=-6]="dataZoomFilter",pI[pI.legendFilter=-5]="legendFilter",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"}(gI||(gI={})),function(t){t.data="data",t.mark="mark"}(fI||(fI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(mI||(mI={}));const vI=["line","area","trail"];function _I(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(MO,i?t.slice().sort(i):t.slice()),{keys:[MO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const yI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function bI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{bI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function SI(t,e,i,s){const n=_I(t,(t=>i(t))),r=_I(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 AI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;y_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new O_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=wp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Uy(o))&&!1!==c&&PR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=mI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(y_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=y_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>bI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>bI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{bI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Dy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===mI.before&&(this._layoutState=mI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=mI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Dy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=xI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=SI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=SI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=_I(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=_I(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===KO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:UO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===KO.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===KO.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===KO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===KO.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===KO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{bI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=xI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Ny(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return mu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{mo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{bI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=y_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){y_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function kI(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:zy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function MI(t){t.crosshair=Y(t.crosshair||{}).map((e=>BR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function TI(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Ny(e.mode)){let t;t=_(h)?y_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(Wy(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 wI(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 CI(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}}var EI,BI,PI,LI,RI,OI;t.LayoutZIndex=void 0,(EI=t.LayoutZIndex||(t.LayoutZIndex={}))[EI.SeriesGroup=0]="SeriesGroup",EI[EI.Axis_Grid=50]="Axis_Grid",EI[EI.CrossHair_Grid=100]="CrossHair_Grid",EI[EI.Region=450]="Region",EI[EI.Mark=300]="Mark",EI[EI.Node=400]="Node",EI[EI.Axis=100]="Axis",EI[EI.MarkLine=500]="MarkLine",EI[EI.MarkArea=100]="MarkArea",EI[EI.MarkPoint=500]="MarkPoint",EI[EI.DataZoom=500]="DataZoom",EI[EI.ScrollBar=500]="ScrollBar",EI[EI.Player=500]="Player",EI[EI.Legend=500]="Legend",EI[EI.CrossHair=500]="CrossHair",EI[EI.Indicator=500]="Indicator",EI[EI.Title=500]="Title",EI[EI.Label=500]="Label",EI[EI.Brush=500]="Brush",EI[EI.CustomMark=500]="CustomMark",EI[EI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(BI=t.LayoutLevel||(t.LayoutLevel={}))[BI.Indicator=10]="Indicator",BI[BI.Region=20]="Region",BI[BI.Axis=30]="Axis",BI[BI.DataZoom=40]="DataZoom",BI[BI.Player=40]="Player",BI[BI.ScrollBar=40]="ScrollBar",BI[BI.Legend=50]="Legend",BI[BI.Title=70]="Title",BI[BI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(PI=t.AttributeLevel||(t.AttributeLevel={}))[PI.Default=0]="Default",PI[PI.Theme=1]="Theme",PI[PI.Chart=2]="Chart",PI[PI.Base_Series=3]="Base_Series",PI[PI.Series=4]="Series",PI[PI.Mark=5]="Mark",PI[PI.User_Chart=6]="User_Chart",PI[PI.User_Series=7]="User_Series",PI[PI.User_Mark=8]="User_Mark",PI[PI.User_SeriesStyle=9]="User_SeriesStyle",PI[PI.Built_In=99]="Built_In";class II{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({},II.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]))))}}II.defaultMarkInfo={};class DI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class FI{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=>BR({},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 zI extends DI{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=FI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new II,this._lastLayoutRect=null,this.id=Yy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new GO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${tO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=PR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class jI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=fR(vR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:gR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:gR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:gR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:gR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:gR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:gR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=gR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=gR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=gR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(mR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class HI extends zI{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,this._transformLayoutPadding=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 jI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 VI extends FI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class NI extends HI{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(e,i){var s;super(e,i),this.transformerConstructor=VI,this.modelType="region",this.specKey="region",this.type=NI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function UI(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 WI(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 GI(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 YI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=qI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),GI(d,!0,p,l),s&&WI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function $I(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=qI(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=qI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),GI(d,!1,p,o),s&&WI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function KI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=qI(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=qI(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=UI(t);n.length&&YI(n,e,i,!1,"left",s),r.length&&YI(r,e,i,!0,"left",s),a.length&&$I(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=UI(t);n.length&&XI(n,e,i,!1,"top",s),r.length&&XI(r,e,i,!0,"top",s),a.length&&KI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=UI(t);n.length&&YI(n,e,i,!1,"right",s),r.length&&YI(r,e,i,!0,"right",s),a.length&&$I(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=UI(t);n.length&&XI(n,e,i,!1,"bottom",s),r.length&&XI(r,e,i,!0,"bottom",s),a.length&&KI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=qI(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=qI(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:zy)("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}}}ZI.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(LI||(LI={})),t.STATE_VALUE_ENUM=void 0,(RI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",RI.STATE_HOVER="hover",RI.STATE_HOVER_REVERSE="hover_reverse",RI.STATE_DIMENSION_HOVER="dimension_hover",RI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",RI.STATE_SELECTED="selected",RI.STATE_SELECTED_REVERSE="selected_reverse",RI.STATE_SANKEY_EMPHASIS="selected",RI.STATE_SANKEY_EMPHASIS_REVERSE="blur",RI.STATE_HIGHLIGHT="highlight",RI.STATE_BLUR="blur",RI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(OI||(OI={}));const JI=["linear","radial","conical"],QI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const tD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{tD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class eD extends DI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class iD extends eD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,vI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!tD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(tO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(tO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(FC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class sD extends DI{constructor(){super(...arguments),this.id=Yy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=PR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class nD extends sD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const rD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,aD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=rD(l.delay,n,a,o),d=rD(l.duration,n,a,o),u=rD(l.oneByOne,n,a,o),p=rD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Ow(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?zw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:jw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Bw(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Lw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Uo.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Rw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Mw,null!==(l=i.easing)&&void 0!==l?l:Tw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Uo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Iw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Mw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Tw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Ow(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},oD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},lD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class hD extends sD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new nD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=wp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Fl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==LI.enter&&t.context.diffState!==LI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new iD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,re)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&BR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(zC(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=lR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):JI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):zC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=QL(JL(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({},QI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ti.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)JI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=QL(JL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return _I(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return PR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[rO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=_I(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{lD(t),s.push(...t.getGraphics())})),e.forEach((t=>{lD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);aD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=oD(e,n),r=oD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===gI.exit?gI.exit:i===gI.update?gI.update:gI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===LI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===LI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=LI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=LI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=LI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=gI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=gI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return yI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=yI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=WO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=PR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=PR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===mI.before||(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===LI.exit&&!e.isExiting)if(e.context.animationState===LI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:LI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=wp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var cD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(cD||(cD={}));class dD extends hD{constructor(){super(...arguments),this.type=dD.type,this._marks=[],this._diffState=LI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Fy("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?(Fy("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))}getMarkInUserId(t){let e;return bI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===LI.update){const t=this.hasAnimation(),e=WO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=LI.update}render(){this._isCommited&&(Dy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}dD.type="group";const uD={measureText:QR};class pD{static instance(){return pD.instance_||(pD.instance_=new pD),pD.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 gD{constructor(){this.id=Yy(),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))?Fy("不要重复添加相同的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 fD extends gD{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}}const mD={type:"fadeIn"};function vD(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 mD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const _D={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"}},yD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},bD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},xD=()=>{PR.registerAnimation("scaleInOut",(()=>yD))},SD=()=>{PR.registerAnimation("fadeInOut",(()=>bD))},AD=(t,e)=>({appear:vD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Uw,duration:_D.update.duration,easing:_D.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),kD=()=>{PR.registerAnimation("line",AD)},MD=()=>{hw.registerBuiltInAnimate("growPointsIn",rC),hw.registerBuiltInAnimate("growPointsOut",aC),hw.registerBuiltInAnimate("growPointsXIn",lC),hw.registerBuiltInAnimate("growPointsXOut",hC),hw.registerBuiltInAnimate("growPointsYIn",dC),hw.registerBuiltInAnimate("growPointsYOut",uC),hw.registerBuiltInAnimate("clipIn",Yw),hw.registerBuiltInAnimate("clipOut",$w)},TD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class wD{constructor(t){this._markSet=new II,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 CD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class ED extends wD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},CD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}ED.type="element-highlight",ED.defaultOptions=CD;const BD=()=>{PR.registerInteractionTrigger(ED.type,ED)},PD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class LD extends wD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},PD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}LD.type="element-select",LD.defaultOptions=PD;const RD=()=>{PR.registerInteractionTrigger(LD.type,LD)};class OD extends gD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class ID{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>PR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>PR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>PR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return PR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>PR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){PR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&pD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&pD.instance().unregisterFunction(t)}static getFunction(t){return t?pD.instance().getFunction(t):null}static getFunctionList(){return pD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=PR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=PR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,sI.get(e);var e}static registerSVG(t,e,i){const s=PR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=PR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){YR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Yy(),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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=wI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?PR.getSeriesBuiltInTheme(e):PR.getComponentBuiltInTheme(e);i=i?BR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=qR({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},GL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Ny(v);if(S?ix(Eh):"node"===v&&HS(Eh),S&&f&&(this._container=_(f)?y_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=$R.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new AI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new tI(this,this._compiler),this._event=new GO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),YR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=BR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=ZR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;ID.getFunctionList()&&ID.getFunctionList().length&&(t=JR(t,ID)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=PR.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=PR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=PR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 TI(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:eO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:iO})}_initDataSet(t){this._dataSet=t instanceof Ma?t:new Ma,iI(this._dataSet,"dataview",Sa),iI(this._dataSet,"array",s),eI(this._dataSet,"copyDataView",hI);for(const t in PR.transforms)eI(this._dataSet,t,PR.transforms[t]);for(const t in PR.dataParser)iI(this._dataSet,t,PR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?gI.none:gI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,YR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ta?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=dI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?BR({},t[n][e.index],i):i):t[n]=s?BR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?BR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?BR({},t[n],i):i)}))}(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=BR({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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=LR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=XR(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=LR({},XR(this._currentThemeName),XR(n),XR(r));this._currentTheme=o(a,t)}else{const t=LR({},XR(this._currentThemeName),XR(n),XR(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(NM.poptip,VM,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=!!Ny(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.getTheme("background")||this._option.background}getCurrentTheme(){return XR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!$R.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 kI(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(!Ny(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;this._chart.resetLayoutItemTag(),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)?y_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?_R(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Fy("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?_R(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Fy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return pD.instance().getFunction(t)}registerFunction(t,e){t&&e&&pD.instance().registerFunction(t,e)}unregisterFunction(t){t&&pD.instance().unregisterFunction(t)}getFunctionList(){return pD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=PR.getChartPlugins();t.length>0&&(this._chartPlugin=new fD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=PR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new OD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}ID.InstanceManager=YR,ID.ThemeManager=$R,ID.globalConfig={uniqueTooltip:!0},ID.Utils=uD,ID.vglobal=y_;PR.registerRegion("region",NI),PR.registerLayout("base",ZI),Kk(),Ik(),PR.registerMark(dD.type,dD),PR.registerStageEventPlugin("gesture",Mb),BD(),RD(),VR(MR.name,MR);const DD="monotone",FD="linear",zD="bevel";function jD(t,e){return e("component",t)}function HD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=PR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const VD=(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},ND=(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)))},UD=(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},WD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=HD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},GD=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const YD=(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 $D(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=KD(WD(h,r,a,c),d,g),o.value=KD(WD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=WD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function XD(t,e,i,s,n,r,a){if(d(e)){$D(t,e(n,a),i,s,r,a)}else e&&$D(t,e,i,s,r,a)}const KD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class qD{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 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=>{y(t)?t.forEach((t=>{XD(a,t,e,i,s,n,r)})):d(t)?XD(a,t,e,i,s,n,r):t&&$D(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:WD(r.visible,t,n),value:KD(WD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:WD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=WD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&YD(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 ZD={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}},JD=(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 QD(a,n,o)},QD=(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)=>{$y(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=>{$y(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=ZD[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},tF=(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=>{$y(t[e])||(t[e]=0)}))})),t},eF=`${tO}_HIERARCHY_DEPTH`,iF=`${tO}_HIERARCHY_ROOT`,sF=`${tO}_HIERARCHY_ROOT_INDEX`;function nF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function rF(t,e,i){t&&(i.needDefaultSeriesField&&(t[aO]=i.defaultSeriesField),t[nO]=e,t[rO]=i.getKey(t,e,i))}function aF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function oF(t,e,i,s=0,n,r){void 0===r&&(r=e),rF(t,e,i),t[eF]=s,t[iF]=n||t[i.categoryField],t[sF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>oF(e,s,i,t[eF]+1,t[iF],r)))}const lF={label:{name:"label",type:"text"}},hF=`${tO}_rect_x`,cF=`${tO}_rect_x1`,dF=`${tO}_rect_y`,uF=`${tO}_rect_y1`,pF={data:!0},gF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},fF=[...Object.keys(_D),"normal"];function mF(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 xF(n)&&delete n.type,n.oneByOne&&(n=_F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=BR({},o[e],a);return xF(n)&&delete n.type,n.oneByOne&&(n=_F(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:yF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function vF(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;const i=["custom","customParameters"];return t=I(t,null,i),SF(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}),i),t}(h,i)}function _F(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function yF(t,e){var i;return null!==(i=null==t?void 0:t[nO])&&void 0!==i?i:e.context.graphicIndex}function bF(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 xF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function SF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),SF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),SF(t[s],e,i))}function AF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class kF extends FI{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=KL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=PR.getSeriesMarkMap(o)?function(t,e,i){const s=PR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=BR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return BR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=BR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>BR({},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 MF extends zI{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:`${tO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=kF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=AF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(eI(this._rawData.dataSet,"invalidTravel",tF),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=dI(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=cI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=cI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new nD(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=QD(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(){eI(this._dataSet,"dimensionStatistics",JD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ta(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){eI(this._dataSet,"dimensionStatistics",JD);const s=new Ta(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 Ta(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)&&(eI(this._rawData.dataSet,"addVChartProperty",UD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:nF.bind(this),call:rF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=mF({},vF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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)||Wy(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=BR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=BR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=TD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=TD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=TD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:aO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:oO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,oO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new qD(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},pF),gF),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=>gF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ta||uI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();AF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:aO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new aR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return JL(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:aO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,BR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:rO}_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!==cO&&t!==uO&&t!==hO&&t!==dO||(t=this.getStackValueField()),null!==(e=CO(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=>$y(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:aO]}}function TF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();FC(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 wF(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}}}MF.mark=lF,MF.transformerConstructor=kF;class CF extends MF{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);FC(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:`${tO}_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(cO),this.setFieldX2(hO)):(this.setFieldY(cO),this.setFieldY2(hO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(uO),this.setFieldX2(dO)):(this.setFieldY(uO),this.setFieldY2(dO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(gO),this.setFieldX2(pO)):(this.setFieldY(gO),this.setFieldY2(pO))}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(t.ChartEvent.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)&&(TF("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)}}function EF(t){return"bottom"===t||"top"===t}function BF(t){return"left"===t||"right"===t}function PF(t){return"z"===t}function LF(t,e){return dR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function RF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function OF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?EF(t)?"linear":"band":EF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const IF=(t,e,i)=>{var s;const n=null!==(s="band"===e?jD("axisBand",i):["linear","log","symlog"].includes(e)?jD("axisLinear",i):{})&&void 0!==s?s:{},r=EF(t)?jD("axisX",i):BF(t)?jD("axisY",i):jD("axisZ",i);return BR({},jD("axis",i),n,r)};class DF{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:zy)("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:zy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>jC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return EF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class FF extends DF{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:KO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const zF=(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))},jF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},HF=(t,e,i,s)=>{var n;const r=e.getScale(),a=jC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:VF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,NF=(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};class UF extends DF{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)=>!zF(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:KO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:KO.canvas}),callback:this.onMouseOut}),Uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:KO.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})}}var WF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(WF||(WF={}));const GF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class YF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(GF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:zD,curveType:FD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===DD?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(GF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:bF(this._spec,GF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ta(this._option.dataSet,{name:`${tO}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(WF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[GF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(WF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,BR({},this._spec[GF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const $F=Object.assign(Object.assign({},lF),GF),XF=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>XF(t,e[i])));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]))},KF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class qF extends hD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return KF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(zC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?XF(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:LI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[rO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class ZF extends qF{constructor(){super(...arguments),this.type=ZF.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)===$L.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}ZF.type="line";const JF=()=>{PR.registerMark(ZF.type,ZF),Kk(),jk(),MB(),bB(),MD(),PR.registerGraphicComponent("line",Tg)};class QF extends hD{constructor(){super(...arguments),this.type=QF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}QF.type="symbol";const tz=()=>{PR.registerMark(QF.type,QF),Kk(),Zk(),bB(),PR.registerGraphicComponent("symbol",Ag)};class ez extends kF{_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 iz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function sz(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:!k(o.min),extendable_max:!k(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 nz(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 rz(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 az(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 oz(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 lz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return PC(v)};class hz{constructor(t){this.id=Yy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class cz extends hz{constructor(){super(cz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!FC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&iz(c)&&iz(d)))return;const u=sz(t,c),p=sz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!rz(u,p))return}else if(0===y&&0===b){if(!rz(p,u))return}else if(_||A)if(_&&!A){if(!nz(u,p))return}else if(A&&!_){if(!nz(p,u))return}else{if(f===b)return;if(f>b){if(!az(u,p))return}else if(!az(p,u))return}else{if(0===f&&0===y){if(!oz(u,p))return}else if(0===b&&0===g&&!oz(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){eI(e.getOption().dataSet,"tickAlign",lz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}cz.pluginType="component",cz.type="AxisSyncPlugin";const dz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function uz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function pz(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 gz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const fz=t=>"band"===t||"ordinal"===t||"point"===t;function mz(t,e){return{id:t,label:t,value:e,rawValue:t}}function vz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class _z extends gD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const yz=`${tO}_ARC_TRANSFORM_VALUE`,bz=`${tO}_ARC_RATIO`,xz=`${tO}_ARC_START_ANGLE`,Sz=`${tO}_ARC_END_ANGLE`,Az=`${tO}_ARC_K`,kz=`${tO}_ARC_MIDDLE_ANGLE`,Mz=`${tO}_ARC_QUADRANT`,Tz=`${tO}_ARC_RADIAN`,wz=-Math.PI/2,Cz=3*Math.PI/2,Ez=.6,Bz=(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 ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Pz=(t,e,i)=>{var s;const n=null!==(s="band"===e?jD("axisBand",i):"linear"===e?jD("axisLinear",i):{})&&void 0!==s?s:{},r=jD("angle"===t?"axisAngle":"axisRadius",i);return BR({},jD("axis",i),n,r)};function Lz(t,e,i,s){switch(t){case r.cartesianBandAxis:return IF(LF(i,["z"]),"band",e);case r.cartesianLinearAxis:return IF(LF(i,["z"]),"linear",e);case r.cartesianLogAxis:return IF(LF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return IF(LF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return IF(LF(i),void 0,e);case r.polarBandAxis:return Pz(i.orient,"band",e);case r.polarLinearAxis:return Pz(i.orient,"linear",e);case r.polarAxis:return Pz(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,trigger:c,triggerOff:d}=null!==(s=jD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>EF(t.orient)));let g;g=p(u)?BR({},fz(u.type)?a:o,l):l;const f=n.find((t=>BF(t.orient)));let m;return m=p(f)?BR({},jC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=jD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?BR({},fz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?BR({},jC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Rz(i,jD(t,e));default:return jD(t,e)}}const Rz=(t,e)=>{var i;const s=BR({},e,e[RF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Oz extends FI{getTheme(t,e){return Lz(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({},vR(e)),{[s]:0}))}}class Iz extends HI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Oz,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:KO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 _z(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Dz,Fz;Iz.transformerConstructor=Oz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Dz||(Dz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Fz||(Fz={}));class zz extends hD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=PR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(YO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}zz.type="component";const jz=()=>{PR.registerMark(zz.type,zz)},Hz=t=>t;class Vz extends Iz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Dz.circleAxis:Dz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Fz.circleAxisGrid:Fz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=mF(null===(h=PR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new nD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return VL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?FC(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 VL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=NL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(VL(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=zO(s=t.domainLine)).startSymbol=zO(s.startSymbol),s.endSymbol=zO(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 VO(BR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:VO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>VO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=VO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 VO(BR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:VO(t.tick.style)),t.tick.state&&(i.tick.state=jO(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 VO(BR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:VO(t.subTick.style)),t.subTick.state&&(i.subTick.state=jO(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=dz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:BR({},d,VO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:VO(h.style)}),h.state&&(i.title.state.shape=jO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:VO(o.style)}),o.state&&(i.title.state.background=jO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=jO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=VO(t.background.style)),t.background.state&&(i.panel.state=jO(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 VO(BR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:VO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:VO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=HD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){iI(this._option.dataSet,"scale",Hz);const i=this.registerTicksTransform();return new Ta(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)}getDatum(t){var e;return t&&t.name===gT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Vz.specKey="axes";const Nz=()=>{jz(),PR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Uz=[cz];class Wz extends Vz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),VL(this._regions,(t=>{const e=this.getOrient();EF(e)?vz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):BF(e)?vz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):PF(e)&&vz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=BR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(BR({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=EF(this.getOrient()),n=t=>{var e;return(s?!EF(t.getOrient()):EF(t.getOrient()))&&FC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=LF(i,["z"]),PF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!gz(e))return null;const{axisType:t,componentName:s}=OF(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=>BF(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(!gz(t))return;const{axisType:s,componentName:n}=OF(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=PR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return EF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):PF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(Uz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){EF(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&&!EF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!PF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;BF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=gR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=EF(this.getOrient())?t.fieldX:PF(this.getOrient())?t.fieldZ:t.fieldY,FC(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:FC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(YO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(EF(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=EF(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)}))}collectScale(){const t=[];return VL(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]:EF(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();VL(this._regions,(e=>{EF(t)?vz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):BF(t)?vz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):PF(t)&&vz(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=EF(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=EF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=BR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=EF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return mz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:FC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Wz.type=r.cartesianAxis,Wz.specKey="axes";const Gz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Yz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Xz=(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 Kz(t,e,i="count"){const s=Xz(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const qz=Math.sqrt(50),Zz=Math.sqrt(10),Jz=Math.sqrt(2);class Qz{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=pz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=EF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort($z),e.sort($z),{domain:Yz(t,e),scope:Kz(t,e,i)}}(r,Oy(t),this._spec.breaks[0].scopeType);e=Oy(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}=pz(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>=qz?10:n>=Zz?5:n>=Jz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const tj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},ej={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}}},ij={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}}},sj={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}}};class nj extends Wz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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=EF(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=uR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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=Oy(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 eI(this._option.dataSet,t,DE),t}}nj.type=r.cartesianLinearAxis,nj.specKey="axes",nj.builtInTheme={axis:sj,axisLinear:tj,axisX:ej,axisY:ij},G(nj,Qz);const rj=()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),Nz(),PR.registerComponent(nj.type,nj)};class aj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new nD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=mz(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=>mz(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 oj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class lj extends Wz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new aE}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 eI(this._option.dataSet,t,VE),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=ZC(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{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),Nz(),PR.registerComponent(lj.type,lj,!1)};class cj extends nj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{EF(this.getOrient())?vz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):vz(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=BR({},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 Ta(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 nD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>mz(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=>mz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return eI(this._option.dataSet,t,DE),t}transformScaleDomain(){}}cj.type=r.cartesianTimeAxis,cj.specKey="axes",cj.builtInTheme={axis:sj,axisX:ej,axisY:ij};class dj extends nj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new PE}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 eI(this._option.dataSet,t,DE),t}transformScaleDomain(){}}dj.type=r.cartesianLogAxis,dj.specKey="axes",dj.builtInTheme={axis:sj,axisLinear:tj,axisX:ej,axisY:ij},G(dj,Qz);class uj extends nj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new LE}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 eI(this._option.dataSet,t,DE),t}transformScaleDomain(){}}uj.type=r.cartesianSymlogAxis,uj.specKey="axes",uj.builtInTheme={axis:sj,axisLinear:tj,axisX:ej,axisY:ij},G(uj,Qz);const pj=`${tO}_hide_`;function gj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const fj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[pj]&&(gj(t,!0),t[pj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[pj]=!0,gj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},mj=()=>{PR.registerGrammarTransform("symbolOverlap",{transform:fj,runType:"afterEncode"})},vj={min:K,max:X,average:DL,sum:IL};function _j(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function yj(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 bj(t,e,i,s){return yj(t,e,i,"min",s)}function xj(t,e,i,s){return yj(t,e,i,"max",s)}function Sj(t,e,i,s){return yj(t,e,i,"average",s)}function Aj(t,e,i,s){return yj(t,e,i,"sum",s)}const kj=(t,e)=>{let i=d(t.size)?t.size():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=_j;if("min"===n?l=bj:"max"===n?l=xj:"average"===n?l=Sj:"sum"===n&&(l=Aj),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[]},Mj=()=>{PR.registerGrammarTransform("dataSampling",{transform:kj})};class Tj extends CF{constructor(){super(...arguments),this.type=$L.line,this.transformerConstructor=ez,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(mF(null===(i=PR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),vF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=wF(this);this._symbolMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Tj.type=$L.line,Tj.mark=$F,Tj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Tj.transformerConstructor=ez,G(Tj,YF);class wj{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)=>{uI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ta)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];Fy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Fy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Cj{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)=>{Xy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{TO(e,[{key:t,operations:FC(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:FC(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?lR("colorOrdinal"):lR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Xy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Xy(s.domain)?e.reRender=!0:U(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(!Xy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=FC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=FC(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;FC(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(FC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=FC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));FC(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 Ej{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Bj extends DI{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Yy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:eO,height:iO},this._viewRect={width:eO,height:iO},this._viewBox={x1:0,y1:0,x2:eO,y2:iO},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=vR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new GO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new wj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Ej;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=PR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=PR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=PR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof zI)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 hD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof hD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&uI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=TI(this._spec,this._option,{width:eO,height:iO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=JL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Cj(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){wI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=JL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{wI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,wI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):wI(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()];wI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=fR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(YO.AFTER_MARK_RENDER_END,e)};this._event.on(YO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:UO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(NO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===WF.dimensionHover||s===WF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>jC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Pj=(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 Lj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):wR(t,a,c.spec),wR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Pj(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=Pj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(PR.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(PR.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=PR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=PR.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=PR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):VD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=VD(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"];return 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}))}_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 Rj extends Lj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&BR(i,CI(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 Oj extends Rj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),MI(t)}}const Ij=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=EO(t,!0);for(const e in o)for(const i in o[e].nodes)RO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)LO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&PO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Fj{_beforeInit(){this._dataSet&&eI(this._dataSet,"stackSplit",Ij)}_initStack(){this._stack=new Dj(this),this._stack.init()}}const zj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:WF.dimensionHover};class jj extends wD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},zj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=UO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}jj.type="dimension-hover",jj.defaultOptions=zj;const Hj=()=>{PR.registerInteractionTrigger(jj.type,jj)},Vj=()=>{PR.registerComposedEvent(WF.dimensionHover,UF),PR.registerComposedEvent(WF.dimensionClick,FF)},Nj=t=>t.fieldX[0],Uj=t=>t.fieldY[0],Wj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Gj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Yj=(t,e)=>t?e?Nj:Wj:e?Uj:Gj,$j=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=NF(t,(t=>EF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=NF(t,(t=>BF(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=>{jC(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=Xj(t,i,Yj(e,jC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=Xj(t,i,Yj(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},Xj=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Kj(t,s,i)},Kj=(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=HF(e,t,"cartesian",null!=i?i:EF(t.getOrient())?Nj:Uj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},qj=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(jC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(FC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=uz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Jj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&Zj(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),Zj=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=HD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Jj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},Qj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=tH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},tH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},eH=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return qj(c,r,e),c.xField.cacheInfo?Qj(c.xField):c.yField.cacheInfo?Qj(c.yField):void 0},iH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],sH=(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])&&iH.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(nH(s).every((t=>{var e;return!YD("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},nH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},rH={dom:`${tO}_TOOLTIP_HANDLER_DOM`,canvas:`${tO}_TOOLTIP_HANDLER_CANVAS`},aH={key:"其他",value:"..."};var oH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(oH||(oH={}));class lH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=sH(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({},aH),t):aH;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)&&YD(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 hH extends lH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!jC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const cH=()=>{PR.registerTooltipProcessor("dimension",hH)};class dH extends lH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,No.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(UO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const uH=()=>{PR.registerTooltipProcessor("mark",dH)};class pH extends lH{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 gH=()=>{PR.registerTooltipProcessor("group",pH)};class fH extends Bj{constructor(){super(...arguments),this.transformerConstructor=Oj,this.type="line",this.seriesType=$L.line}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}fH.type="line",fH.seriesType=$L.line,fH.transformerConstructor=Oj,G(fH,Fj);const mH=[...KF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class vH extends qF{constructor(){super(...arguments),this.type=vH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return mH}_getIgnoreAttributes(){return[]}}vH.type="area";const _H=()=>{PR.registerMark(vH.type,vH),Kk(),Ek(),MB(),bB(),MD(),PR.registerGraphicComponent("area",Zg)};class yH extends qD{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 bH=Object.assign(Object.assign(Object.assign({},lF),GF),{area:{name:"area",type:"area"}}),xH=()=>{PR.registerAnimation("area",AD),kD(),xD()};class SH extends ez{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=BR({},f.style,g.style),l.state=BR({},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 AH extends CF{constructor(){super(...arguments),this.type=$L.area,this.transformerConstructor=SH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(AH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===DD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return hR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[cO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(mF(null===(e=PR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),vF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(mF(null===(i=PR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),vF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=wF(this);this._symbolMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),vF("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 yH(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(){super.onLayoutEnd(),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}}}AH.type=$L.area,AH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},AH.mark=bH,AH.transformerConstructor=SH,G(AH,YF);class kH extends Rj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),MI(t)}}class MH extends Bj{constructor(){super(...arguments),this.transformerConstructor=kH,this.type="area",this.seriesType=$L.area}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}MH.type="area",MH.seriesType=$L.area,MH.transformerConstructor=kH,G(MH,Fj);function TH(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 wH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:TH(t,e)}),CH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:TH(t,e)}),EH={type:"fadeIn"},BH={type:"growCenterIn"};function PH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return EH;case"scaleIn":return BH;default:return wH(t)}}class LH extends hD{constructor(){super(...arguments),this.type=LH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}LH.type="rect";const RH=()=>{Kk(),Gk(),vB("rect",SB),PR.registerMark(LH.type,LH),hw.registerBuiltInAnimate("growHeightIn",eC),hw.registerBuiltInAnimate("growHeightOut",iC),hw.registerBuiltInAnimate("growWidthIn",_C),hw.registerBuiltInAnimate("growWidthOut",yC),hw.registerBuiltInAnimate("growCenterIn",Jw),hw.registerBuiltInAnimate("growCenterOut",Qw),PR.registerGraphicComponent("rect",Bg)},OH=Object.assign(Object.assign({},lF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function IH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=yR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[hF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):hR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[cF]):hR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=hR(this._dataToPosX(t),e,i),n=hR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[dF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):hR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[uF]):hR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=hR(this._dataToPosY(t),e,i),n=hR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},zH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:bF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(zH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(eI(this._option.dataSet,"addVChartProperty",UD),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};eI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Ta(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:nF.bind(this),call:rF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new nD(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=uF,s=dF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=cF,s=hF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=EO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)IH(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=hR(this[r](t),l,i),u=hR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[hO],n=t[cO],r=t[dO],h=t[uO];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]),{[hO]:i,[cO]:s}),a?{[dO]:o,[uO]: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(Bg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>hR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>hR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=wF(this);this._barMark.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),vF(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=yR(this._spec.barWidth,a)),l&&(c=Math.max(c,yR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,yR(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=yR(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=FC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}zH.type=$L.bar,zH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},zH.mark=OH,zH.transformerConstructor=FH;const jH=()=>{Mj(),RH(),PR.registerAnimation("bar",((t,e)=>({appear:PH(t,e),enter:wH(t,!1),exit:CH(t,!1),disappear:CH(t)}))),hj(),rj(),PR.registerSeries(zH.type,zH)};class HH extends Rj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),MI(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 VH extends Bj{constructor(){super(...arguments),this.transformerConstructor=HH,this.type="bar",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}VH.type="bar",VH.seriesType=$L.bar,VH.transformerConstructor=HH,G(VH,Fj);const NH=[10,20],UH=IC.Linear,WH="circle",GH=IC.Ordinal,YH=["circle","square","triangle","diamond","star"],$H=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XH=Object.assign(Object.assign({},lF),{point:{name:"point",type:"symbol"}});class KH extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qH extends CF{constructor(){super(...arguments),this.type=$L.scatter,this.transformerConstructor=KH,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=`${tO}_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=`${tO}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:UH,defaultRange:NH},"size")}getShapeAttribute(t,e){return u(e)?WH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:GH,defaultRange:YH},"shape")}initMark(){this._symbolMark=this._createMark(qH.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bF(this._spec,qH.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=wF(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(mF(null===(i=PR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),vF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qH.type=$L.scatter,qH.mark=XH,qH.builtInTheme={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"}}}}},qH.transformerConstructor=KH;const ZH=()=>{tz(),PR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$H(0,e)},yD))),hj(),rj(),PR.registerSeries(qH.type,qH)};class JH extends Rj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class QH extends Bj{constructor(){super(...arguments),this.transformerConstructor=JH,this.type="scatter",this.seriesType=$L.scatter}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}QH.type="scatter",QH.seriesType=$L.scatter,QH.transformerConstructor=JH,G(QH,Fj);class tV extends MF{constructor(){super(...arguments),this.type=$L.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=`${tO}_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 eV=`${tO}_MAP_LOOK_UP_KEY`,iV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[nO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[eV]=e.nameMap[n]:t[eV]=n})),t.features);class sV extends qD{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 nV extends hD{constructor(){super(...arguments),this.type=nV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}nV.type="path";const rV=()=>{PR.registerMark(nV.type,nV),Kk(),Vk(),PR.registerGraphicComponent("path",Xg)},aV=Object.assign(Object.assign({},lF),{area:{name:"area",type:"path"}});class oV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ca[i]?(wa[i]||(wa[i]=Ba(i,Ca[i])),wa[i]):null}(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 lV{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(){}}class hV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 cV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:lV}:Uy(e)||Wy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:hV}:null}const dV={debounce:bt,throttle:xt};class uV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Uy(this._renderMode)||Wy(this._renderMode),cV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return cV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:qO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:qO.chart,consume:!1}];l.on(...c,dV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,dV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||cV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||cV(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:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:qO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:qO.chart,consume:!1}];l.on(...c,dV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,dV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){cV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||cV(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:qO.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:qO.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||cV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:qO.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||cV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:qO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:qO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:qO.chart,source:KO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:qO.chart,source:KO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=dV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=dV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:qO.chart})}));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:qO.chart,source:KO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:qO.chart,source:KO.chart},this._handleDragMouseUp)}))}}function pV(t,e){return`${tO}_${e}_${t}`}class gV extends Iz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:pV(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=BR(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 oV(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===$L.map||e.type===$L.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),VL(this._regions,(t=>{var e;if(t.type===$L.map||t.type===$L.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==$L.map&&e.type!==$L.pictogram||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[eV],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}gV.type=r.geoCoordinate,G(gV,uV);const fV=()=>{PR.registerComponent(gV.type,gV)};class mV extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class vV extends tV{constructor(){super(...arguments),this.type=$L.map,this.transformerConstructor=mV,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 !`),sI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),eI(this._dataSet,"copyDataView",hI),eI(this._dataSet,"map",iV),eI(this._dataSet,"lookup",ND);const s=sI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Ta(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:eV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new nD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(vV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:bF(this._spec,vV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:aO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:aO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(mF(null===(t=PR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),vF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new sV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[nO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[nO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 nO}getActiveMarks(){return[this._pathMark]}}vV.type=$L.map,vV.mark=aV,vV.builtInTheme={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"}}}}},vV.transformerConstructor=mV;const _V=`${tO}_waterfall_default_seriesField`,yV=(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=!0===e.stackInverse?o[t].reverse():o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[vO]=!0:delete t[vO]})),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=bV([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 f=g[0];let{start:m,end:v}=xV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ee(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=bV(a,t,n,r,h,l,i,e),r.push(n)})),r};function bV(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}=xV(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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(u(p)||p===_V)&&(t[_V]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function xV(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?Fy("total.collectCountField error"):n=e[a].start;o<0?Fy("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=ee(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 SV=(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)=>ee(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},AV={type:"fadeIn"},kV={type:"growCenterIn"};function MV(t,e){switch(e){case"fadeIn":return AV;case"scaleIn":return kV;default:return wH(t,!1)}}class TV extends hD{constructor(){super(...arguments),this.type=TV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Tg(t)}}TV.type="rule";const wV=()=>{PR.registerMark(TV.type,TV),Kk(),jk(),PR.registerGraphicComponent("line",Tg)},CV=Object.assign(Object.assign({},OH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),EV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:BV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function BV(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)=>BV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class PV{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 Ta(e instanceof Ma?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),eI(e,"dimensionTree",EV),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 LV extends FH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const RV={rect:jV,symbol:FV,arc:VV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=FV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:NV,line:UV,area:UV,rect3d:jV,arc3d:VV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function OV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=RV[t])&&void 0!==i?i:RV.point;return e.series.type===$L.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=DV(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:WV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function IV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==$L.sankey){const{formatFunc:t,args:n}=HD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function DV(t){return d(t)?e=>t(e.data):t}function FV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=DV(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:zV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function zV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function jV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=DV(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:HV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function HV(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 VV(t){var e;const{labelSpec:i}=t,s=null!==(e=DV(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 NV(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=IV(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),bg(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 UV(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}))):[{index:0,[aO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function WV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class GV extends zH{constructor(){super(...arguments),this.type=$L.waterfall,this.transformerConstructor=LV,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 PV(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=_V)}getSeriesKeys(){return this._seriesField===_V?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),eI(this._dataSet,"waterfallFillTotal",SV),eI(this._dataSet,"waterfall",yV),(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,stackInverse:this.getRegion().getStackInverse()}},!1));const e=cI(this.getViewData(),this._dataSet,{name:`${tO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new nD(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:hO,endAs:cO,total:this._spec.total,groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=wF(this);this._barMark.setAnimationConfig(mF(null===(i=PR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),vF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vF("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(){super.initMark();const t=this._createMark(GV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return NV(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?hR(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):hR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}GV.type=$L.waterfall,GV.mark=CV,GV.builtInTheme={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}}}},GV.transformerConstructor=LV;const YV=()=>{wV(),RH(),PR.registerAnimation("waterfall",((t,e)=>({appear:MV(t,e),enter:wH(t,!1),exit:CH(t,!1),disappear:CH(t,!1)}))),SD(),hj(),rj(),PR.registerSeries(GV.type,GV)},$V=`${tO}_BOX_PLOT_OUTLIER_VALUE`;var XV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XV||(XV={}));const KV=(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={[$V]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class qV extends qD{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XV.OUTLIER)return this.series.getOutliersField();if(t===XV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XV.MIN:return this.series.getMinField();case XV.MAX:return this.series.getMaxField();case XV.MEDIAN:return this.series.getMedianField();case XV.Q1:return this.series.getQ1Field();case XV.Q3:return this.series.getQ3Field();case XV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XV.OUTLIER)return e[$V];if(t===XV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XV.MIN:return e[this.series.getMinField()];case XV.MAX:return e[this.series.getMaxField()];case XV.MEDIAN:return e[this.series.getMedianField()];case XV.Q1:return e[this.series.getQ1Field()];case XV.Q3:return e[this.series.getQ3Field()];case XV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[$V])}getDefaultContentList(t){return[{key:this.getContentKey(XV.OUTLIER),value:this.getContentValue(XV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(XV.MAX),value:this.getContentValue(XV.MAX)},{key:this.getContentKey(XV.Q3),value:this.getContentValue(XV.Q3)},{key:this.getContentKey(XV.MEDIAN),value:this.getContentValue(XV.MEDIAN)},{key:this.getContentKey(XV.Q1),value:this.getContentValue(XV.Q1)},{key:this.getContentKey(XV.MIN),value:this.getContentValue(XV.MIN)},{key:this.getContentKey(XV.SERIES_FIELD),value:this.getContentValue(XV.SERIES_FIELD)}]}}class ZV extends hD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==LI.enter&&t.context.diffState!==LI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Lg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=PR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const JV=()=>{PR.registerGraphicComponent("glyph",Lg),Kk(),Rk()},QV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],tN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class eN extends ZV{constructor(){super(...arguments),this.type=eN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=QV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=tN,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}eN.type="boxPlot";const iN=Object.assign(Object.assign({},lF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),sN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},nN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},rN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),aN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=rN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=rN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=rN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=rN(t,"box").attribute.width,i=rN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=rN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=rN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=rN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=rN(t,"box").attribute.height,i=rN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},oN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=rN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=rN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=rN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=rN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=rN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=rN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=rN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=rN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=rN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=rN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class lN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return sN(aN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class hN extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return nN(aN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class cN extends lN{computeAttribute(){return sN(oN)(this.target,this.params,this.params.options)}}class dN extends hN{computeAttribute(){return nN(oN)(this.target,this.params,this.params.options)}}class uN extends CF{constructor(){super(...arguments),this.type=$L.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(){this._boxPlotMark=this._createMark(uN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(uN.mark.outlier,{key:nO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>hR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>hR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>hR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>hR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>hR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>hR(e(this.getDatumPositionValues(t,$V),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>hR(e(this.getDatumPositionValues(t,$V),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;eI(this._dataSet,"foldOutlierData",KV),eI(this._dataSet,"addVChartProperty",UD);const t=new Ta(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${tO}_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:nF.bind(this),call:rF}},!1),this._outlierDataView=new nD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=wF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=PR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(vF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(mF(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(mF(null===(a=PR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new qV(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]}}uN.type=$L.boxPlot,uN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},uN.mark=iN;const pN=()=>{JV(),jk(),Gk(),PR.registerGraphicComponent("line",(t=>Tg(t))),PR.registerGraphicComponent("rect",(t=>Bg(t))),PR.registerMark(eN.type,eN),tz(),xD(),hj(),rj(),hw.registerBuiltInAnimate("boxplotScaleIn",lN),hw.registerBuiltInAnimate("boxplotScaleOut",hN),hw.registerBuiltInAnimate("barBoxplotScaleIn",cN),hw.registerBuiltInAnimate("barBoxplotScaleOut",dN),PR.registerSeries(uN.type,uN)};class gN extends hD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=gN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Gg(t):bg(t)}}gN.type="text";const fN=()=>{PR.registerMark(gN.type,gN),Kk(),Qk(),$k(),PR.registerGraphicComponent("text",bg),PR.registerGraphicComponent("richtext",Gg)};class mN extends qD{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 vN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_N={type:"fadeIn"},yN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bN(t,e){return"fadeIn"===e?_N:vN(t)}const xN=Object.assign(Object.assign({},OH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class SN extends FH{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 AN extends zH{constructor(){super(...arguments),this.type=$L.rangeColumn,this._barMarkType="rect",this._barName=$L.bar,this.transformerConstructor=SN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bF(this._spec,AN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(AN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(AN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=wF(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(mF(null===(i=PR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),vF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(mF(null===(n=PR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),vF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new mN(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)}}AN.type=$L.rangeColumn,AN.mark=xN,AN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},AN.transformerConstructor=SN;const kN=()=>{RH(),fN(),PR.registerAnimation("rangeColumn",((t,e)=>({appear:bN(t,e),enter:vN(t),exit:yN(t),disappear:yN(t)}))),SD(),hj(),rj(),PR.registerSeries(AN.type,AN)};var MN,TN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(MN||(MN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(TN||(TN={}));class wN extends qD{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 CN=Object.assign({},bH);class EN extends AH{constructor(){super(...arguments),this.type=$L.rangeArea}initMark(){this._areaMark=this._createMark(EN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new wN(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))}}EN.type=$L.rangeArea,EN.mark=CN;class BN extends MF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Ez,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:[]};FC(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:[]};FC(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(t.ChartEvent.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)&&TF(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 PN(t){return $y(t)?Number.parseFloat(t):0}const LN=(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&&RN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[yz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[yz]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},RN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===PN(t[e])))||!i&&0===t.reduce(((t,i)=>t+PN(i[e])),0)));function ON(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const IN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:ON(t,!0,gI.appear)}),DN={type:"fadeIn"},FN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:ON(t,!0,gI.enter)}),zN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:ON(t,!0,gI.exit)}),jN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:ON(t,!0,gI.exit)});function HN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DN;case"growRadius":return IN(Object.assign(Object.assign({},t),{growField:"radius"}));default:return IN(Object.assign(Object.assign({},t),{growField:"angle"}))}}class VN extends hD{constructor(t,e){super(t,e),this.type=NN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[kz])[t]+s,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 NN extends VN{constructor(){super(...arguments),this.type=NN.type}}NN.type="arc";const UN=()=>{Kk(),wk(),vB("arc",CB),hw.registerBuiltInAnimate("growRadiusIn",fC),hw.registerBuiltInAnimate("growRadiusOut",mC),hw.registerBuiltInAnimate("growAngleIn",qw),hw.registerBuiltInAnimate("growAngleOut",Zw),PR.registerGraphicComponent("arc",tf),PR.registerMark(NN.type,NN)},WN=Object.assign(Object.assign({},lF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class GN extends kF{_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=BR({},this._theme,i,t);const n=(t,e)=>BR({},"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 YN=`${tO}_LABEL_VISIBLE`;class $N extends BN{constructor(){super(...arguments),this.transformerConstructor=GN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:gR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:gR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=wz,this._endAngle=Cz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[kz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(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)?re(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?re(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;eI(this._dataSet,"pie",LN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:xz,asEndAngle:Sz,asRatio:bz,asMiddleAngle:kz,asRadian:Tz,asQuadrant:Mz,asK:Az,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ta(this._dataSet,{name:`${tO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new nD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},$N.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:rO,groupKey:this._seriesField,isSeriesMark:!0},{morph:bF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return WL(xz)(t)}endAngleScale(t){return WL(Sz)(t)}_computeLayoutRadius(){return Bz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:cR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:cR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:WL(YN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[kz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===gI.appear)return this._startAngle;if(i===gI.disappear)return this._endAngle;const r=[gI.disappear,gI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[nO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[nO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[nO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[nO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[kz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[kz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[kz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[kz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=mF(null===(i=PR.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]}}$N.transformerConstructor=GN,$N.mark=WN,$N.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class XN extends $N{constructor(){super(...arguments),this.type=$L.pie}}XN.type=$L.pie;const KN=()=>{UN(),PR.registerAnimation("pie",((t,e)=>({appear:HN(t,e),enter:FN(t),exit:zN(t),disappear:jN(t)}))),PR.registerAnimation("emptyCircle",((t,e)=>({appear:HN(t,e)}))),PR.registerSeries(XN.type,XN)};function qN(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const ZN=t=>({type:qN(t.growField),options:{overall:!0}}),JN={type:"fadeIn"},QN=t=>({type:qN(t.growField)}),tU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},eU=tU;function iU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return JN;case"growAngle":return ZN(Object.assign(Object.assign({},t),{growField:"angle"}));default:return ZN(Object.assign(Object.assign({},t),{growField:"radius"}))}}class sU extends BN{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(cO),this.setInnerRadiusField(hO)}setValueFieldToPercent(){this.setRadiusField(uO),this.setInnerRadiusField(dO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const nU=Object.assign(Object.assign({},lF),{rose:{name:"rose",type:"arc"}});class rU extends kF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class aU extends Vz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=PR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=wz,this._endAngle=Cz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),VL(this._regions,(t=>{"radius"===this.getOrient()?vz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):vz(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:gR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:gR(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=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:uz(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(){VL(this._regions,(t=>{"radius"===this.getOrient()?vz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):vz(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 FC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:FC(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(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=>mz(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",scale:this._scale});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=ne.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",scale:this._scale.clone()});(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 Bz((()=>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=Ez,e=0;const i=this.getChart().getSpec();return VL(this.getRegions(),(s=>{const n=s;if(r=n.type,[$L.rose,$L.radar,$L.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(BR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(BR({},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)}}aU.type=r.polarAxis,aU.specKey="axes";const oU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},lU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class hU extends aU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new wE}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 eI(this._option.dataSet,t,DE),t}}hU.type=r.polarLinearAxis,hU.specKey="axes",hU.builtInTheme={axis:sj,axisLinear:tj,axisAngle:lU,axisRadius:oU},G(hU,Qz);const cU=()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),PR.registerGraphicComponent(Dz.circleAxis,((t,e)=>new BC(t,e))),PR.registerGraphicComponent(Fz.circleAxisGrid,((t,e)=>new DB(t,e))),Nz(),PR.registerComponent(hU.type,hU)};class dU extends aU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new aE}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 eI(this._option.dataSet,t,WE),t}transformScaleDomain(){}}dU.type=r.polarBandAxis,dU.specKey="axes",dU.builtInTheme={axis:sj,axisBand:oj,axisAngle:lU,axisRadius:oU},G(dU,aj);const uU=()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),PR.registerGraphicComponent(Dz.circleAxis,((t,e)=>new BC(t,e))),PR.registerGraphicComponent(Fz.circleAxisGrid,((t,e)=>new DB(t,e))),Nz(),PR.registerComponent(dU.type,dU)};class pU extends sU{constructor(){super(...arguments),this.type=$L.rose,this.transformerConstructor=rU,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(){this._roseMark=this._createMark(pU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:bF(this._spec,pU.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=>hR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=hR(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(mF(null===(i=PR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),vF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}pU.type=$L.rose,pU.mark=nU,pU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},pU.transformerConstructor=rU;const gU=()=>{PR.registerSeries(pU.type,pU),UN(),PR.registerAnimation("rose",((t,e)=>({appear:iU(t,e),enter:QN(t),exit:tU(t),disappear:eU(t)}))),uU(),cU()};class fU extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,LL(this._fromAngle,this._toAngle)&&LL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class mU extends Uw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!HL(t)&&!HL(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({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 se(s,n,r,a);return o.defined=e.defined,o}}const vU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function _U(t,e,i){return"fadeIn"===e?vU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yU(t,e,i){return"fadeIn"===e?vU(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 bU=(t,e)=>({custom:Vw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),xU=Object.assign(Object.assign(Object.assign({},lF),GF),{area:{name:"area",type:"area"}});class SU extends sU{constructor(){super(...arguments),this.type=$L.radar,this.transformerConstructor=ez,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(SU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:FD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?re(this._spec.startAngle):wz},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(mF(null===(s=PR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),vF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=PR.getAnimationInKey(e);t.setAnimationConfig(mF(null==i?void 0:i(n,r),vF(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}}}SU.type=$L.radar,SU.mark=xU,SU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},SU.transformerConstructor=ez,G(SU,YF);const AU=()=>{PR.registerSeries(SU.type,SU),_H(),JF(),tz(),PR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:_U(t,e,"in"),enter:_U(t,e,"in"),exit:_U(t,e,"out"),disappear:"clipIn"===e?void 0:_U(t,e,"out"),update:[{channel:["points","center"],custom:mU,customParameters:t,duration:_D.update.duration,easing:_D.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),PR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:yU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yU(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:fU,customParameters:t,duration:_D.update.duration,easing:_D.update.easing}]}))),PR.registerAnimation("radarGroup",((t,e)=>({appear:bU(t,"in"),disappear:bU(t,"out")}))),wk(),uU(),cU()};class kU extends qD{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=>gi.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 MU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(tO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[nO]:r,[rO]:`${s}_${e}`})),r++}))})),n},TU={fill:"#bbb",fillOpacity:.2},wU=Object.assign(Object.assign({},lF),{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 CU extends CF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),eI(this._option.dataSet,"objFlat",MU),eI(this._option.dataSet,"copyDataView",hI),iI(this._option.dataSet,"dataview",Sa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(BR(TU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(CU.mark.group),this._containerMark=this._createMark(CU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(CU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(CU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(CU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(CU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(CU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(CU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:aO}}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 aR).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:aO}}initTooltip(){this._tooltipHelper=new kU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}CU.type=$L.dot,CU.mark=wU,CU.builtInTheme={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"}}}}};class EU extends qD{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=>gi.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 BU=Object.assign(Object.assign({},lF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),PU=(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 LU extends CF{constructor(){super(...arguments),this.type=$L.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 e;super.initData(),eI(this._option.dataSet,"linkDotInfo",PU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(LU.mark.group),this._containerMark=this._createMark(LU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(LU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(LU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:aO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new EU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}LU.type=$L.link,LU.mark=BU,LU.builtInTheme={link:{arrow:{style:{size:10}}}};const RU=Object.assign(Object.assign({},lF),{group:{name:"group",type:"group"}});class OU extends BN{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()?hO:AO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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()?cO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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)?re(n):wz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?re(r):Cz,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=hR(this.angleAxisHelper.dataToPosition([t[hO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=hR(this.angleAxisHelper.dataToPosition([t[cO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?hR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(OU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return tf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Bg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 zU=()=>{PR.registerAnimation("circularProgress",((t,e)=>({appear:FU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class jU extends kF{constructor(){super(...arguments),this._supportStack=!0}}class HU extends OU{constructor(){super(...arguments),this.type=$L.circularProgress,this.transformerConstructor=jU,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(k(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(k(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(){return this._progressMark=this._createMark(HU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:bF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(HU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?hO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?cO: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",t.AttributeLevel.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(mF(null===(i=PR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),vF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}HU.type=$L.circularProgress,HU.mark=IU,HU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},HU.transformerConstructor=jU;const VU=()=>{PR.registerSeries(HU.type,HU),UN(),zU(),SD(),uU(),cU()};function NU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const UU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:NU(t)}),WU={type:"fadeIn"};function GU(t,e="grow"){return!1===e?{}:"fadeIn"===e?WU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:NU(t)}))(t)}class YU extends qD{enableByType(t){return"dimension"!==t}}const $U=Object.assign(Object.assign({},lF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class XU extends CF{constructor(){super(...arguments),this.type=$L.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;return this._progressMark=this._createMark(XU.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return hR(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+n},y1:t=>{var e,i;return hR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return hR(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 e,s;return hR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?hR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(XU.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return hR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return hR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(mF(null===(i=PR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),vF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),vF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new YU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}XU.type=$L.linearProgress,XU.mark=$U,XU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const KU=()=>{RH(),PR.registerAnimation("linearProgress",((t,e)=>({appear:GU(t,e),enter:GU(t),disappear:UU(t)}))),SD(),PR.registerSeries(XU.type,XU)},qU=[0],ZU=[20,40],JU=[200,500],QU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},tW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],eW=`${tO}_WORD_CLOUD_TEXT`,iW=Object.assign(Object.assign({},lF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),sW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class nW extends MF{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=ZU}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:JU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:qU,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)?eW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:QU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Ny(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:qU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!tW.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 e;this._wordMark=this._createMark(nW.mark.word,{key:rO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(nW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(mF(PR.getAnimationInKey("wordCloud")(n,s),vF("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 aR).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:aO])}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 wE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new wE).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[nO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:rO,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,createCanvas:y_.createCanvas.bind(y_),getTextBounds:cf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:zg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nW.mark=iW,nW.builtInTheme={wordCloud:sW};function rW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||_D.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=aW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},oW=(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=oW(t.children,e,t,n))})),s},lW=(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=lW(t.children,e,t,n)),n=e(t,s,i,n)})),n},hW=(t,e=[],i)=>{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):hW(t.children,e,i)))})),e};function cW(t,e){let i,s;if(pW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function pW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function vW(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 _W(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 yW(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 bW(t){return{_:t,next:null,prev:null}}function xW(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];vW(n,s,r);let a,o,l,h,c,d,u,p=bW(s),g=bW(n),f=bW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=aW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Tt)/Tt}(),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:MW.defaultOpionts.nodeSort;oW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)oW([o],SW(h)),lW([o],AW(this._getPadding,.5,a)),oW([o],kW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);oW([o],SW(MW.defaultOpionts.setRadius)),lW([o],AW(Pt,1,a)),c&&lW([o],AW(this._getPadding,o.radius/t,a)),oW([o],kW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}MW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const TW=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=TW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function wW(t){return t.depth}function CW(t,e){return e-1-t.endDepth}const EW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),BW=(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},PW={left:wW,right:CW,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:wW,end:CW},LW=_t(0,1);class RW{constructor(t){this._ascendingSourceBreadth=(t,e)=>EW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>EW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},RW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):PW[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)};"vertical"===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<=0)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))),"vertical"===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=[];TW(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:kt(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+=kt(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=[BW(s[t.source]),BW(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=mt(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*LW(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(EW),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(EW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];OW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),IW);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({},DW.defaultOpionts,t):Object.assign({},DW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(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=>Bt(t,n))):Bt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Bt(t,n))):Bt(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=Bt(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=aW(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=le({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)}}}function FW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:OW,slice:FW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?FW:OW)(t,e,i,s,n)}};class HW{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({},HW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?zW(this.options.aspectRatio):null!==(e=jW[this.options.splitType])&&void 0!==e?e:jW.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=aW(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)}))}}function VW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=VW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ti(o.map(Ti))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=NW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function KW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ei((function(i){return-1*qW({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},JW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||WW,s=e.lossFunction||UW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:ZW(l),arcs:l})}))},QW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:tG,triangle:tG,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 tG(){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 eG(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 iG=t=>QW[t]?QW[t]():QW.circle(),sG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function nG(t){return d(t)?t:function(){return t}}class rG{constructor(t){var e,i;switch(this.options=j({},rG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=iG(this.options.shape),this.getText=null!==(e=nG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=nG(this.options.fontWeight),this.getTextFontSize=nG(this.options.fontSize),this.getTextFontStyle=nG(this.options.fontStyle),this.getTextFontFamily=nG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>sG(10,50);break;case"random-light":this.getTextColor=()=>sG(50,90);break;default:this.getTextColor=nG(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 re(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():Mt(e);return re(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 oG extends rG{constructor(t){var e;super(j({},oG.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<=oG.defaultOptions.minFontSize&&(this.options.minFontSize=oG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=aG[this.options.spiral])&&void 0!==e?e:aG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=nG(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}=eG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(dG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(cG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}dG(p,this._size)&&(p=uG(p,this._size))}else if(dG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||hG(p,i))&&(!i||!lG(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 lG(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 hG(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,dG=(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 uG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},gG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},fG=(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()},mG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=eG(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=iG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)fG(n,gG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)fG(n,gG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)fG(n,gG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)fG(n,gG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)fG(n,gG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=gG({x:l,y:h},o,-Math.PI/2,5),e=gG({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]);fG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var T=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 w=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 B=Object.prototype.hasOwnProperty;function P(t){if(u(t))return!0;if(b(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(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]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){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])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){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 V(t){return Object.prototype.toString.call(t)}function N(t){return Object.keys(t)}function U(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(V(t)!==V(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(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=N(t),n=N(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(!U(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;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;ne?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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){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,i=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,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function kt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const Tt=4294967296;const wt=t=>e=>L(e,t),Ct=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||wt)(i)},Et=(t,e={})=>{if(y(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Bt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Pt=t=>0,Lt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ot(t,e,i,s,n){let r=0,a=0;return Rt(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function It(t,e=(t=>t.x),i=(t=>t.y)){let s=0,n=0,r=0,a=0,o=0;Rt(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:Ot(t,e,i,n,h)}}const Dt=1e-12,Ft=Math.PI,zt=Ft/2,jt=2*Ft,Ht=2*Math.PI,Vt=Math.abs,Nt=Math.atan2,Ut=Math.cos,Wt=Math.max,Gt=Math.min,Yt=Math.sin,$t=Math.sqrt,Xt=Math.pow;function Kt(t){return t>=1?zt:t<=-1?-zt:Math.asin(t)}function qt(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 Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 ne{static distancePP(t,e){return $t(Xt(t.x-e.x,2)+Xt(t.y-e.y,2))}static distanceNN(t,e,i,s){return $t(Xt(t-i,2)+Xt(e-s,2))}static distancePN(t,e,i){return $t(Xt(e-t.x,2)+Xt(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=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 ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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 pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(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 ve(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}=ye(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 _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(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 be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(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 Ae(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ke({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Te(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[ke({x:t.x1,y:t.y1},i,s),ke({x:t.x2,y:t.y1},i,s),ke({x:t.x2,y:t.y2},i,s),ke({x:t.x1,y:t.y2},i,s)]}function we(t,e,i=!1){const s=Te(t,i),n=Te(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Ae(n,i)+Ae(n,s))/2>Ae(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Ee(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Le(t,e){return Math.abs(t-e){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 Oe(t,e={},i){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 Ie{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=Oe(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(_(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(Ie.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Ie.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(Ie.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Ie.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Ie.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)}}Ie.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Ie.NUMBERS_CHAR_SET="0123456789",Ie.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return we(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[ke({x:this.x1,y:this.y1},this.angle,t),ke({x:this.x2,y:this.y1},this.angle,t),ke({x:this.x1,y:this.y2},this.angle,t),ke({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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 Ne;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(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class Ue{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 We(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,$e={transparent:4294967040},Xe={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return S(t)?new ei(t>>16,t>>8&255,255&t,1):y(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p($e[t]))return function(t){return S(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}($e[t]);if(p(Xe[t]))return qe(Xe[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(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 ei(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=We(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=We(u(t)?n.h:mt(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 ei(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=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=Xe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function ai(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 oi(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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):Ai[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=Ai[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:_,group:y,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?xi[8+mi/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?_+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=y(k,1/0));let M=S.length+k.length+A.length,T=M>1)+S+k+A+T.slice(M);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const Ai={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 ki(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();wi(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function As(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ks(t,e){return Ui(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 ws(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Rs(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 Os(t,e,i,s){return function(n){var r,a,o,l=e(n),h=As(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Rs(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Bs.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>Fi,w=f*x;if(Bs.add(Gi(w*k*qi(M),m*S+w*Yi(M))),a+=T?A+k*Hi:A,T^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var E=us(r,C);fs(E);var B=(T^A>=0?-1:1)*es(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Di||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(Is))}return u}}function Is(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Ls).length&&(Es=Cs,Cs=function(t,e){return Ls(Es(t),e)});var Fs=Os((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?Fi:-Fi,l=Ui(r-i);Ui(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Ui(i-n)Di?Wi((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Ui(t[0]-e[0])>Di){var r=t[0]0,n=Ui(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Ui(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var T=gs(p,(-g+v)/f);return ps(T,u),[_,hs(T)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Os(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ks(e,p)||ks(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&ks(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Ui(s[0]-t)0?0:3:Ui(s[0]-i)0?2:1:Ui(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,f,m,v,_,y=a,b=As(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Rs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Ts(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 A(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Us,Ws,Gs,Ys,$s=Li(),Xs=Li(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,$s.add(Ui(Xs)),Xs.reset()},result:function(){var t=$s/2;return $s.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Us=Gs=t,Ws=Ys=e}function Js(t,e){Xs.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Us,Ws)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=Tn,bn.lineEnd=wn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=An}function An(t,e){bn.point=kn,xn(ln=t,hn=e)}function kn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function Tn(){bn.point=Cn}function wn(){En(an,on)}function Cn(t,e){bn.point=En,xn(an=ln=t,on=hn=e)}function En(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var Bn=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Ln,Rn,On,In,Dn,Fn=Li(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Ln&&Hn(Rn,On),zn.point=is},polygonStart:function(){Ln=!0},polygonEnd:function(){Ln=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,Rn=In=t,On=Dn=e}function Hn(t,e){In-=t,Dn-=e,Fn.add(Ji(In*In+Dn*Dn)),In=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Un(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Wn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(Bn)),Bn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function $n(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function Xn(t,e,i){return $n(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 Kn(t,e,i){return Xn(t,[[0,0],e],i)}function qn(t,e,i){return $n(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 Zn(t,e,i){return $n(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)}Nn.prototype={_radius:4.5,_circle:Un(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=Un(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Ji(b*b+x*x+S*S),k=es(S/=A),M=Ui(Ui(S)-1)e||Ui((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,E()):[m*Vi,v*Vi,_*Vi]},w.angle=function(t){return arguments.length?(y=t%360*Ni,E()):y*Vi},w.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},w.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},w.precision=function(t){return arguments.length?(a=tr(o,T=t*t),B()):Ji(T)},w.fitExtent=function(t,e){return Xn(w,t,e)},w.fitSize=function(t,e){return Kn(w,t,e)},w.fitWidth=function(t,e){return qn(w,t,e)},w.fitHeight=function(t,e){return Zn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Ui(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):Xi(i/Yi(e))/Xi(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Ui(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Wi(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Ui(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Er.invert=dr((function(t){return 2*Wi(t)})),Br.invert=function(t,e){return[-e,2*Wi($i(t))-zi]};var Rr={exports:{}},Or=function(t,e){this.p1=t,this.p2=e};Or.prototype.rise=function(){return this.p2[1]-this.p1[1]},Or.prototype.run=function(){return this.p2[0]-this.p1[0]},Or.prototype.slope=function(){return this.rise()/this.run()},Or.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Or.prototype.isVertical=function(){return!isFinite(this.slope())},Or.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Or.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Or.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Or.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)},Or.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Ir=Or,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Ir(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Wr;!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"}(Wr||(Wr={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+qr(e,6):qr(e,4))+"-"+qr(t.getUTCMonth()+1,2)+"-"+qr(t.getUTCDate(),2)+(r?"T"+qr(i,2)+":"+qr(s,2)+":"+qr(n,2)+"."+qr(r,3)+"Z":n?"T"+qr(i,2)+":"+qr(s,2)+":"+qr(n,2)+"Z":s||i?"T"+qr(i,2)+":"+qr(s,2)+"Z":"")}function Jr(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 $r;if(h)return h=!1,Yr;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(;a0}function ha(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=ia(t));var r=[];switch(t.type){case"GeometryCollection":return ca(t,(function(t){ua(t,s)})),t;case"FeatureCollection":return ha(t,(function(t){ha(ua(t,s),(function(t){r.push(t)}))})),oi(r)}return ua(t,s)}function ua(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ca(t,(function(t){ua(t,e)})),t;case"LineString":return pa(oa(t),e),t;case"Polygon":return ga(oa(t),e),t;case"MultiLineString":return oa(t).forEach((function(t){pa(t,e)})),t;case"MultiPolygon":return oa(t).forEach((function(t){ga(t,e)})),t;case"Point":case"MultiPoint":return t}}function pa(t,e){la(t)===e&&t.reverse()}function ga(t,e){la(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=fa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ya=(t,e={},i)=>{i.type=Wr.GEO;const s=jr(va,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(_a(t))})):e.push(_a(t))})),e})(t);let l=t.features;return o&&(l=da(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ma.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ma.bounds(t);t.bbox=e}})),t.features=l,t},ba={},xa=(t,e,i)=>{i.type=Wr.GEO;const s=jr(va,ba,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 Lr(a,t)}))}:Lr(a,o));var a,o;return ya(r,s,i)},Sa=(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 Aa=0;function ka(t="dataset"){return Aa>1e8&&(Aa=0),t+"_"+Aa++}class Ma{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:ka("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()}}class Ta{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ka("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ta||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Wn();const wa={},Ca={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ea=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ba(t,e){return function i(){const s=e();return s.type=t,s.path=Wn().projection(s),s.copy=s.copy||function(){const t=i();return Ea.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Pa{static GenAutoIncrementId(){return Pa.auto_increment_id++}}Pa.auto_increment_id=0;class La{constructor(t){this.id=Pa.GenAutoIncrementId(),this.registry=t}}const Ra="named",Oa="inject",Ia="multi_inject",Da="inversify:tagged",Fa="inversify:paramtypes";class za{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Ra?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ja=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 Ha(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ja.hasOwnMetadata(t,e)&&(r=ja.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ja.defineMetadata(t,r,e)}(Da,t,i.toString(),s)}function Va(t){return(e,i,s)=>{Ha(e,0,s,t)}}function Na(t){return e=>(i,s,n)=>Va(new za(t,e))(i,s,n)}const Ua=Na(Oa),Wa=Na(Ia);function Ga(){return function(t){return ja.defineMetadata(Fa,null,t),t}}function Ya(t){return Va(new za(Ra,t))}const $a="Singleton",Xa="Transient",Ka="ConstantValue",qa="DynamicValue",Za="Factory",Ja="Function",Qa="Instance",to="Invalid";class eo{constructor(t,e){this.id=Pa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=to,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new eo(this.serviceIdentifier,this.scope);return t.activated=t.scope===$a&&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 io{getConstructorMetadata(t){return{compilerGeneratedMetadata:ja.getMetadata(Fa,t),userGeneratedMetadata:ja.getMetadata(Da,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const so=(no=Ra,t=>{const e=e=>{if(null==e)return!1;if(e.key===no&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const oo=Symbol("ContributionProvider");class lo{constructor(t,e){this.serviceIdentifier=t,this.container=e,co.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function ho(t,e){t(oo).toDynamicValue((({container:t})=>new lo(e,t))).inSingletonScope().whenTargetNamed(e)}class co{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}co.store=new Map;class uo{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 po extends uo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const go=Symbol.for("EnvContribution"),fo=Symbol.for("VGlobal"),mo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Xa,this.options=e,this.id=Pa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new io}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,Ra,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new eo(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ao(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[Oa],multiInject:s[Ia]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ka:case Ja:e=t.cache;break;case Qa: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===$a&&(t.cache=e,t.activated=!0)}},vo=Symbol.for("RenderService");const _o=new class{get renderService(){return this._renderService||(this._renderService=mo.get(vo)),this._renderService}};let yo=0;class bo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=_o.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++yo,t),this.tryRunAnimationFrameNextFrame(),yo}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class xo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=t=>{const i=this._eventListenerTransformer(t);"function"==typeof e?e(i):e.handleEvent&&e.handleEvent(i)};this._listenerMap.has(t)||this._listenerMap.set(t,new Map),this._listenerMap.get(t).set(e,s),this._nativeAddEventListener(t,s,i)}removeEventListener(t,e,i){var s;if(!e)return;const n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e);n&&(this._nativeRemoveEventListener(t,n,i),this._listenerMap.get(t).delete(e),0===this._listenerMap.get(t).size&&this._listenerMap.delete(t))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t,void 0)}))})),this._listenerMap.clear()}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var So=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ao=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ko=function(t,e){return function(i,s){e(i,s,t)}},Mo=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 To=class extends xo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Pa.GenAutoIncrementId(),this.hooks={onSetEnv:new po(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new bo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}loadFont(t,e,i){return Mo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var wo,Co,Eo,Bo;To=So([Ga(),ko(0,Ua(oo)),ko(0,Ya(go)),Ao("design:paramtypes",[Object])],To),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(wo||(wo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Co||(Co={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Bo||(Bo={}));const Po=jt-1e-8;class Lo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Po)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Oo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Io={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},Do={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Fo,zo,jo,Ho,Vo,No;var Uo,Wo,Go,Yo,$o,Xo;function Ko(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),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+f,A=i+m,k=S+y*m,M=A-y*f;return[h*b+c*x,d*b+u*x,h*k+c*M,d*k+u*M,h*S+c*A,d*S+u*A]}function qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let A=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const M=.5*(y+x)-k*(S-b),T=.5*(b+S)+k*(x-y),w=Math.atan2(b-T,y-M);let C=Math.atan2(S-T,x-M)-w;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const E=Math.ceil(Math.abs(C/(zt+.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 Jo(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=rl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Wt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ol(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new ll(i,n),new ll(n,s)]}class ll extends Qo{constructor(t,e){super(),this.type=$o.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Yo.ROW?Vt(this.p0.x-this.p1.x):t===Yo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class hl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new al(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ll(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Yo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Yo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class cl extends hl{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 dl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function ul(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Yo.ROW:Yo.COLUMN;return"monotoneY"===t?new cl(t,s):new hl(t,s)}class pl{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 gl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ul("linear",i,t);return function(t,e){dl(t,e,1)}(new pl(n,s),t),n}function fl(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 ml{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&&fl(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:fl(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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return gl(t,e);const n=ul("basis",i,t);return function(t,e){dl(t,e,2)}(new ml(n,s),t),n}function _l(t){return t<0?-1:1}function yl(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(_l(r)+_l(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function bl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function xl(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 Sl{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:xl(this,this._t0,bl(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,xl(this,bl(this,e=yl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:xl(this,this._t0,e=yl(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 Al extends Sl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function kl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return gl(t,e);const n=ul("monotoneX",i,t);return function(t,e){dl(t,e,2)}(new Sl(n,s),t),n}function Ml(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return gl(t,e);const n=ul("monotoneY",i,t);return function(t,e){dl(t,e,2)}(new Al(n,s),t),n}let Tl=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};class wl extends Tl{lineEnd(){this.context.closePath()}}function Cl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new hl("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Yo.ROW:Yo.COLUMN);return El(new Tl(r,e,n),t),r}function El(t,e){return dl(t,e,1)}class Bl extends pl{lineEnd(){this.context.closePath()}}function Pl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ul("linear",i,t);return function(t,e){dl(t,e,1)}(new Bl(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){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>Dt){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,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return gl(i,n);const o=ul(t,r,i);return dl(new e(o,s,a),i,2),o}}const Ol=Rl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(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 Il=Rl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Dl extends Qo{constructor(t,e,i){super(),this.type=$o.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return nl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,tl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Yo.ROW?Vt(this.p0.x-this.p2.x):t===Yo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Wt(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=nl(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new Dl(i,a,r),new Dl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Fl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ll(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new Dl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new al(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function zl(t,e,i){var s,n;switch(e){case"linear":default:return gl(t,i);case"basis":return vl(t,i);case"monotoneX":return kl(t,i);case"monotoneY":return Ml(t,i);case"step":return Cl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new hl("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Yo.ROW:Yo.COLUMN);return El(new wl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Cl(t,0,i);case"stepAfter":return Cl(t,1,i);case"catmullRom":return Ol(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Il(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Pl(t,i)}}class jl extends Ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Do.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Do.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Do.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([Do.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([Do.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([Do.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([Do.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([Do.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Do.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this._curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this._curves.length=0}beginPath(){this.clear()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Fl(this);Jo(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Do.M]=t=>`M${t[1]} ${t[2]}`,t[Do.L]=t=>`L${t[1]} ${t[2]}`,t[Do.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Do.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Do.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Do.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;tNo){let t,e=jo;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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Jo(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Yo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Yo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),sh=Object.assign(Object.assign({},Kl),{points:[],cornerRadius:0,closePath:!0}),nh=Object.assign(Object.assign({},Kl),{width:100,height:100,spikes:5,thickness:.5}),rh=Object.assign(Object.assign({},Kl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Kl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const ah=Object.assign(Object.assign({},Kl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),oh=Object.assign(Object.assign(Object.assign({},Kl),Yl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),lh=Object.assign(Object.assign(Object.assign({},Kl),Yl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),hh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Kl),{fill:!0,cornerRadius:0,cornerType:"round"}),ch=Object.assign(Object.assign({},hh),{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}),dh=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&&_(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 uh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(uh.IsGradientStr(t))try{const e=dh(t)[0];if(e){if("linear"===e.type)return uh.ParseLinear(e);if("radial"===e.type)return uh.ParseRadial(e);if("conic"===e.type)return uh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:uh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:uh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=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?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=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,c,p,g,d,u))}return h||"orange"}const fh={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"}},mh=!0,vh=!1,_h=/\w|\(|\)|-/,yh=/[.?!,;:/,。?!、;:]/,bh=/\S/,xh=(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})};function Sh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=_o.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=Ah(t,a)),a}function Ah(t,e,i=!1){let s=e;for(;_h.test(t[s-1])&&_h.test(t[s])||yh.test(t[s]);)if(s--,s<=0)return i?kh(t,e):e;return s}function kh(t,e){let i=e;for(;_h.test(t[i+1])&&_h.test(t[i])||yh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Mh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=_o.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Th=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=oh.fontSize}){let i=0,s=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=Ah(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,a=!1){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=Ah(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}};wh=Th([Ga()],wh);var Ch=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Eh=Symbol.for("TextMeasureContribution");let Bh=class extends wh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Bh=Ch([Ga()],Bh);const Ph=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Rh(t){return mo.getNamed(Ph,_o.global.env)(t)}const Oh=1e-4,Ih=Math.sqrt(3),Dh=1/3;function Fh(t){return t>-qh&&tqh||t<-qh}const jh=[0,0],Hh=[0,0],Vh=[0,0];function Nh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Uh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Wh(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 Gh(t){return(t%=Ht)<0&&(t+=Ht),t}function Yh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Kh(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(Fh(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 Jh=[-1,-1,-1],Qh=[-1,-1];function tc(){const t=Qh[0];Qh[0]=Qh[1],Qh[1]=t}function ec(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(Fh(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,Dh):Math.pow(i,Dh),s=s<0?-Math.pow(-s,Dh):Math.pow(s,Dh);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+Ih*Math.sin(e)))/(3*a),h=(-o+i*(s-Ih*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,Jh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&tc(),p=Wh(e,s,r,o,Qh[0]),u>1&&(g=Wh(e,s,r,o,Qh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Fh(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,Jh);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=Uh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Jh[0]=-l,Jh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=Jh[0]+t&&a<=Jh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=Jh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function nc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function rc(t,e){let i=nc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-nc(i-n)):e&&i1&&(i||(h+=Pe(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],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;ac[0]=S,ac[1]=A,rc(ac,Boolean(a[6])),S=ac[0],A=ac[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Do.M:u=m,p=v,c=u,d=p;break;case Do.L:if(i){if(Kh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case Do.C:if(i){if($h(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ec(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Do.Q:if(i){if(Yh(c,d,m,v,_,y,e,s,n))return!0}else h+=ic(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Do.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Xh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=sc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Do.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Kh(u,p,o,p,e,s,n)||Kh(o,p,o,l,e,s,n)||Kh(o,l,u,l,e,s,n)||Kh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case Do.Z:if(i){if(Kh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},cc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const dc=Symbol.for("VWindow"),uc=Symbol.for("WindowHandlerContribution");let pc=class extends xo{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(){super(),this.hooks={onChange:new po(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(mo.getNamed(uc,t.env).configure(this,t),this.actived=!0)},this._uid=Pa.GenAutoIncrementId(),this.global=_o.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,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)}};pc=hc([Ga(),cc("design:paramtypes",[])],pc);var gc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mc=function(t,e){return function(i,s){e(i,s,t)}};let vc=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=_o.global,this._textMeasureMap=new Map,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||this.textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=lc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="native"){var s;this.configure(this.global,this.global.env);const 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:Yl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ie(Object.assign({defaultFontParams:{fontFamily:Yl.fontFamily,fontSize:Yl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=mo.get(dc),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 _c;vc=gc([Ga(),mc(0,Ua(oo)),mc(0,Ya(Eh)),fc("design:paramtypes",[Object])],vc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(_c||(_c={}));const yc=new Ne;let bc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=_c.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=_c.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(yc.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(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}scale(t,e,i){return this.mode===_c.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===_c.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return yc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(yc.a,yc.b,yc.c,yc.d,yc.e,yc.f),this}translate(t,e){return this.mode===_c.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===_c.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};bc=gc([Ga(),fc("design:paramtypes",[])],bc);const xc={arc:ql,area:Zl,circle:Jl,line:eh,path:ih,symbol:ah,text:oh,rect:rh,polygon:sh,star:nh,richtext:lh,richtextIcon:ch,image:hh,group:Ql,glyph:th},Sc=Object.keys(xc);function Ac(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const kc={arc:Object.assign({},xc.arc),area:Object.assign({},xc.area),circle:Object.assign({},xc.circle),line:Object.assign({},xc.line),path:Object.assign({},xc.path),symbol:Object.assign({},xc.symbol),text:Object.assign({},xc.text),rect:Object.assign({},xc.rect),polygon:Object.assign({},xc.polygon),star:Object.assign({},xc.star),richtext:Object.assign({},xc.richtext),richtextIcon:Object.assign({},xc.richtextIcon),image:Object.assign({},xc.image),group:Object.assign({},xc.group),glyph:Object.assign({},xc.glyph)};class Mc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Sc.forEach((t=>{this._defaultTheme[t]=Object.create(kc[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const 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;Sc.forEach((s=>{const n=Object.create(kc[s]);t&&t[s]&&Ac(n,t[s]),i[s]&&Ac(n,i[s]),e[s]&&Ac(n,e[s]),this.combinedTheme[s]=n})),e.common&&Sc.forEach((t=>{Ac(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 Tc=new Mc;function wc(t,e){return t.glyphHost?wc(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)):Tc.getTheme()}return null}(t)||t.attachedThemeGraphic&&wc(t.attachedThemeGraphic)||Tc.getTheme()}var Cc=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 Ec 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=Pa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t,e=!1){return Cc(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;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,e=!1){let i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t,e=!1){let i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))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=Dc(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 Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ic.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Dc(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(Dc(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,Dc(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 Lc))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"):Dc(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 Rc))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=Ic.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 Fc(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 Lc,this.rootWheelEvent=new Rc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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}}class Vc{static GetImage(t,e){var i;const s=Vc.cache.get(t);s?"fail"===s.loadState?_o.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):Vc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Vc.cache.get(t);s?"fail"===s.loadState?_o.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"},Vc.cache.set(t,s),s.dataPromise=_o.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=Vc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Vc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=_o.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=_o.global.loadBlob(t):"json"===e&&(i.dataPromise=_o.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Vc.isLoading&&Vc.toLoadAueue.length){Vc.isLoading=!0;const t=Vc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Vc.cache.set(i,n),n.dataPromise=_o.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((()=>{Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()})).catch((t=>{console.error(t),Vc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Vc.loading()}))}}),0)}static loadImage(t,e){const i=Nc(t,Vc.toLoadAueue);if(-1!==i)return Vc.toLoadAueue[i].marks.push(e),void Vc.loading();Vc.toLoadAueue.push({url:t,marks:[e]}),Vc.loading()}static improveImageLoading(t){const e=Nc(t,Vc.toLoadAueue);if(-1!==e){const t=Vc.toLoadAueue.splice(e,1);Vc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Nc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Gc[0]=t[0],Gc[2]=t[0],Gc[1]=t[1],Gc[3]=t[1],Gc):t:t:0,$c=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Xc=[1,2,3,0,1,2,3,0];function Kc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;$c[0].x=i,$c[1].y=i,$c[2].x=-i,$c[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Ut(t)*i,Yt(t)*i),s.add(Ut(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Qc.TimeOut=1e3/60;const td=new Qc,ed=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class id{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 sd(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var nd=new class extends id{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 sd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return sd(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 rd=new class extends id{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 ad(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 od=new class extends id{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 ad(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}};function ld(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var hd=new class extends id{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ld(t,this.parseSize(e)/2+n,i,s)}};function cd(t,e,i,s,n=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 dd extends id{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 cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}}var ud=new dd;var pd=new class extends dd{constructor(){super(...arguments),this.type="triangle"}};const gd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),fd=Math.sin(jt/10)*gd,md=-Math.cos(jt/10)*gd;function vd(t,e,i,s){const n=fd*e,r=md*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 _d=new class extends id{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 vd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return vd(t,this.parseSize(e)/2+n,i,s)}};const yd=$t(3);function bd(t,e,i,s){const n=e,r=n/yd,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 xd=new class extends id{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};function Sd(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 Ad=new class extends id{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};function kd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Md=new class extends id{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};const Td=-.5,wd=$t(3)/2,Cd=1/$t(12);function Ed(t,e,i,s){const n=e/2,r=e*Cd,a=n,o=e*Cd+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(Td*n-wd*r+i,wd*n+Td*r+s),t.lineTo(Td*a-wd*o+i,wd*a+Td*o+s),t.lineTo(Td*l-wd*h+i,wd*l+Td*h+s),t.lineTo(Td*n+wd*r+i,Td*r-wd*n+s),t.lineTo(Td*a+wd*o+i,Td*o-wd*a+s),t.lineTo(Td*l+wd*h+i,Td*h-wd*l+s),t.closePath(),!1}var Bd=new class extends id{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 Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};function Pd(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 Ld=new class extends id{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 Pd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Pd(t,this.parseSize(e)/2,i,s,n)}};function Rd(t,e,i,s,n=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 Od=new class extends id{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2,i,s,n)}};function Id(t,e,i,s,n=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 Dd=new class extends id{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 Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};const Fd=$t(3);function zd(t,e,i,s){const n=e*Fd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var jd=new class extends id{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return zd(t,this.parseSize(e)/2/Fd,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2/Fd+n,i,s)}};function Hd(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 Vd=new class extends id{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 Hd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/4+n,i,s)}};function Nd(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 Ud=new class extends id{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 Nd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/4+n,i,s)}};function Wd(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 Gd=new class extends id{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 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 Yd(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 $d=new class extends id{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Kd=new class extends id{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Xd(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 qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Zd=new class extends id{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return qd(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 Jd(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 Qd=new class extends id{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 Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(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 tu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function eu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var iu=new class extends id{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)?eu(t,e,i,s):tu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?eu(t,e+2*n,i,s):tu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const su=new He;class nu{constructor(t,e,i=!1){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(),Jo(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Jo(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])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{su.x1=i.bounds.x1*t,su.y1=i.bounds.y1*t,su.x2=i.bounds.x2*t,su.y2=i.bounds.y2*t,e.union(su)}))}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 ru={};[nd,rd,od,hd,jd,pd,_d,xd,Ad,Md,Bd,Ld,Od,ud,Dd,Vd,Ud,Gd,$d,iu,Kd,Zd,Qd].forEach((t=>{ru[t.type]=t}));const au={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"};class ou{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 lu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function hu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=hu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=lu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=hu(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 ou(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 ou(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 uu(t,e){return pu(t)}function pu(t,e){const i={};for(let e=0;eSu.set(t,!0)));const Au=new Map;function ku(t){if(Su.has(t))return!0;if(Au.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Au.set(t,!0)));const Mu=bu(),Tu=bu(),wu=bu(),Cu=bu(),Eu=bu(),Bu=bu(),Pu=bu(),Lu=bu(),Ru=bu(),Ou=bu();bu();const Iu=bu();bu();const Du=bu();bu();const Fu=bu(),zu=bu(),ju=Symbol.for("GraphicService"),Hu=Symbol.for("GraphicCreator"),Vu={"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"},Nu=Object.keys(Vu),Uu={duration:200,easing:"cubicOut"};function Wu(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 Gu(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 Yu(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 $u(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],_=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Xu(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 Ku{constructor(){this.pools=[]}static identity(t){return Wu(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 Ku.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},Qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const tp=new Ne(1,0,0,1,0,0),ep={x:0,y:0};let ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new jl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,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},ep),function(t,e,i){return oc(t,0,!1,e,i)}(this.path.commandList,ep.x,ep.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ep);const i=ph(this,this.lineWidth,this.dpr);return function(t,e,i,s){return oc(t,e,!0,i,s)}(this.path.commandList,i,ep.x,ep.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(t=!0,e=this.dpr){this.setTransformFromMatrix(tp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};ip=Ju([Ga(),Qu("design:paramtypes",[Object,Number])],ip);const sp={WIDTH:500,HEIGHT:500,DPR:1};class np{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}set nativeCanvas(t){this._nativeCanvas=t}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=sp.WIDTH,height:n=sp.HEIGHT,dpr:r=sp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var rp;np.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(rp||(rp={}));class ap{static Get(t,e=rp.Color1,i=[0,0,0,1]){if(e===rp.Color1){const e=ap.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];ap.store1[t]=e,ap.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=ap.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(ap.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],ap.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===rp.Color1){if(ap.store1[t])return;ap.store1[t]=i,ap.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(ap.store255[t])return;ap.store255[t]=i,ap.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function op(t,e=!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 lp(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)=>{var a,o;return hp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):hp(t,e,i,s,n)}function hp(t,e,i,s,n){if(!t||!e)return t&&op(t)||e&&op(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=ap.Get(t,rp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=ap.Get(e,rp.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:op(a)})))});return o?lp(r,l,i,s,n):lp(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:pp(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:pp(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:pp(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),op(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)}function cp(t,e,i){return`rgba(${t[0]+(e[0]-t[0])*i},${t[1]+(e[1]-t[1])*i},${t[2]+(e[2]-t[2])*i},${t[3]+(e[3]-t[3])*i})`}ap.store255={},ap.store1={};const dp=[0,0,0,0],up=[0,0,0,0];function pp(t,e,i){return ap.Get(t,rp.Color255,dp),ap.Get(e,rp.Color255,up),`rgba(${Math.round(dp[0]+(up[0]-dp[0])*i)},${Math.round(dp[1]+(up[1]-dp[1])*i)},${Math.round(dp[2]+(up[2]-dp[2])*i)},${dp[3]+(up[3]-dp[3])*i})`}class gp{static GetCanvas(){try{return gp.canvas||(gp.canvas=_o.global.createCanvas({})),gp.canvas}catch(t){return null}}static GetCtx(){if(!gp.ctx){const t=gp.GetCanvas();gp.ctx=t.getContext("2d")}return gp.ctx}}class fp extends Ue{static getInstance(){return fp._instance||(fp._instance=new fp),fp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=gp.GetCanvas(),s=gp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new fp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class mp{static GetSize(t){for(let e=0;e=t)return mp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=mp.GenKey(t,e,i,s,n),l=mp.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=mp.GenKey(t,e,i,s,n);mp.cache[l]?mp.cache[l].push({width:a,height:o,pattern:r}):mp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}mp.cache={},mp.ImageSize=[20,40,80,160,320,640,1280,2560];const vp=new He,_p=new Ne;new He;const yp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],bp=["x","y"],xp=["scaleX","scaleY"],Sp=["angle"],Ap=new se,kp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Mp extends Ec{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=ru[t];if(e)return e;if(e=Mp.userSymbolMap[t],e)return e;if(!0===((i=t=au[t]||t).startsWith("{const e=(new jl).fromString(t.d),i={};Nu.forEach((e=>{t[e]&&(i[Vu[e]]=t[e])})),n.push({path:e,attribute:i}),vp.union(e.bounds)}));const r=vp.width(),a=vp.height(),o=1/Wt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new nu(t,n,!0);return Mp.userSymbolMap[t]=l,l}var i;const s=(new jl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Wt(n,r);s.transform(0,0,a,a);const o=new nu(t,s);return Mp.userSymbolMap[t]=o,o}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=Yc(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 Lo(t);return Jo(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Uo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Uo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Uo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Uo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Uo.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&Uo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Uo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Wo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Uu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Go.STATE})}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Go.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Go.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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|=Uo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Uo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Uo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Uo.UPDATE_SHAPE_AND_BOUNDS)===Uo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Uo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Uo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Uo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Uo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Uo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Uo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Uo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Uo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Nl.x,y:e=Nl.y,scaleX:i=Nl.scaleX,scaleY:s=Nl.scaleY,angle:n=Nl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Ut(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=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*_-S*y,t.f=p+h*m+d*v-x*_-A*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,!0),_o.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Nl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=_p.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Go.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:_o.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new jl).fromString(t):this.pathProxy=new jl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),_o.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Oc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||_o.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ip(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Tp;Mp.userSymbolMap={},Mp.mixin(zc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Tp||(Tp={}));let wp=class t extends Mp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Bu,this._childUpdateTag=Uo.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 Mc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Mc)}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===Wo.GLOBAL){const i=new se(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&Uo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Nl.x,y:e=Nl.y,dx:i=Nl.dx,dy:s=Nl.dy,scaleX:n=Nl.scaleX,scaleY:r=Nl.scaleY,angle:a=Nl.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 wc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(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)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return _o.graphicService.updateTempAABBBounds(i),_o.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&=Uo.CLEAR_BOUNDS,this._childUpdateTag&=Uo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Uo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Uo.UPDATE_BOUNDS||(this._childUpdateTag|=Uo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){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 this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&Uo.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=_o.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Cp(t){return new wp(t)}wp.NOWORK_ANIMATE_ATTR=kp;class Ep extends wp{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 Mc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{_o.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=>{_o.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 Bp=Symbol.for("TransformUtil"),Pp=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Rp=Symbol.for("StaticLayerHandlerContribution"),Op=Symbol.for("DynamicLayerHandlerContribution"),Ip=Symbol.for("VirtualLayerHandlerContribution");var Dp,Fp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 jp=Dp=class{static GenerateLayerId(){return`${Dp.idprefix}_${Dp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=_o.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?mo.get(Rp):"dynamic"===t?mo.get(Op):mo.get(Ip),e}createLayer(t,e={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 Ep(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Dp.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)}};jp.idprefix="visactor_layer",jp.prefix_count=0,jp=Dp=Fp([Ga(),zp("design:paramtypes",[])],jp);var Hp=new La((t=>{t(fo).to(To).inSingletonScope(),t(dc).to(pc),t(Pp).to(vc).inSingletonScope(),t(Bp).to(bc).inSingletonScope(),t(Lp).to(jp).inSingletonScope()}));function Vp(t,e){return!(!t&&!e)}function Np(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Up(t,e,i){return i&&t*e>0}function Wp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Gp(t,e){return t*e>0}function Yp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function $p(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,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Xp(t,e,i,s,n){const r=Vt(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,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Ut(c),k=n*Yt(c),M=s*Ut(u),T=s*Yt(u);let w,C,E,B;if((b>Dt||_>Dt)&&(w=n*Ut(d),C=n*Yt(d),E=s*Ut(p),B=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=$t(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Kp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Ut(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Ut(l),s+r*Yt(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:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Xp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=$p(g,f,u,p,n,t,Number(c)),l=$p(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ut(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Ut(M),s+n*Yt(M));if(!(r>Dt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Dt){const t=Gt(B,T),n=Gt(P,T),o=$p(S,A,b,x,r,-n,Number(c)),l=$p(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,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ut(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(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,C,E,c):e.moveTo(i+r*Ut(E),s+r*Yt(E))}return a?a[3]&&e.lineTo(i+n*Ut(o),s+n*Yt(o)):e.closePath(),d}const qp=Symbol.for("ArcRenderContribution"),Zp=Symbol.for("AreaRenderContribution"),Jp=Symbol.for("CircleRenderContribution"),Qp=Symbol.for("GroupRenderContribution"),tg=Symbol.for("ImageRenderContribution"),eg=Symbol.for("PathRenderContribution"),ig=Symbol.for("PolygonRenderContribution"),sg=Symbol.for("RectRenderContribution"),ng=Symbol.for("SymbolRenderContribution"),rg=Symbol.for("TextRenderContribution"),ag=Symbol.for("InteractiveSubRenderContribution");function og(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function lg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var hg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},dg=function(t,e){return function(i,s){e(i,s,t)}};function ug(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,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Wu(t),Gu(t,t,[n+o,r+l,a+h]),Gu(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),Gu(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]),f){const i=Zu.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]}Gu(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),Gu(i,i,[-s[0],-s[1],0]),$u(t,t,i)}}let pg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new po(["graphic"]),onSetStage:new po(["graphic","stage"]),onRemove:new po(["graphic"]),onRelease:new po(["graphic"]),onAddIncremental:new po(["graphic","group","stage"]),onClearIncremental:new po(["graphic","group","stage"]),beforeUpdateAABBBounds:new po(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new po(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new po(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Lo(t);return Jo(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=lg(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=og(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){_u(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;_u(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};pg=hg([Ga(),dg(0,Ua(Hu)),cg("design:paramtypes",[Object])],pg);const gg=(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},fg=["radius","startAngle","endAngle",...yp];class mg extends Mp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Cu}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 wc(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}=_o.graphicService.updateTempAABBBounds(i);return gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,_o.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>Ht-Dt?i.set(-r,-r,r,r):Kc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,fg)}needUpdateTag(t){return super.needUpdateTag(t,fg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new jl,s.arc(0,0,r,a,o),s}clone(){return new mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mg.NOWORK_ANIMATE_ATTR}}function vg(t){return new mg(t)}mg.NOWORK_ANIMATE_ATTR=kp;class _g{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=wo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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).toString()!==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(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=zu,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 wc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new bg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=ke(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,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}=_o.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){_u(n,o/Math.abs(r+a),!0,l),i.union(n)}return _o.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||_o.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=_o.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new _g(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=_o.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new _g(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const t=og(_,a),e=this.cache.verticalList.length*v,i=lg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===xu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Wt(e,a)}));const x=og(_,a),S=this.cache.verticalList.length*v,A=lg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ed(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=yg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=yg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return bg.baselineMapAlign}getAlignMapBaseline(){return bg.alignMapBaseline}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},kp),bg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Sg=["symbolType","size",...yp];let Ag=class t extends Mp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Fu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return wc(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}=_o.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;_u(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return _o.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,Sg)}needUpdateTag(t){return super.needUpdateTag(t,Sg)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new jl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new jl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function kg(t){return new Ag(t)}Ag.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},kp);const Mg=["segments","points","curveType","curveTension",...yp];let Tg=class t extends Mp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=Zc(i,s,e))}getGraphicTheme(){return wc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),_o.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return _o.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&&"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&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new jl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function wg(t){return new Tg(t)}Tg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Cg=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}},Eg=["width","x1","y1","height","cornerRadius",...yp];class Bg extends Mp{constructor(t){super(t),this.type="rect",this.numberType=Iu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return wc(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}=_o.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,_o.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Cg(e);return t=new jl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Bg.NOWORK_ANIMATE_ATTR}}function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=kp;class Lg extends Mp{constructor(t){super(t),this.type="glyph",this.numberType=Eu,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,e=!1,i){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 wc(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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Rg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=kp;class Og{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=fh[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}}}function Ig(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Dg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ed(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Mh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Mh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Mh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Ig(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Sh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Mh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Ig(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Sh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Mh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Fg=["width","height","image",...yp];class zg extends Mp{constructor(t){super(t),this.type="image",this.numberType=Pu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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 wc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=_o.graphicService.updateTempAABBBounds(i);return gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,_o.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return hh[t]}needUpdateTags(t){return super.needUpdateTags(t,Fg)}needUpdateTag(t){return super.needUpdateTag(t,Fg)}clone(){return new zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return zg.NOWORK_ANIMATE_ATTR}}function jg(t){return new zg(t)}zg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},kp);class Hg extends zg{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=Yc(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=Yc(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=hh.width,height:e=hh.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 Vg{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 Hg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=fh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Dg){const e=bh.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 Hg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Mh(r,i.character,i.ascentDescentMode),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}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Hg)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||vh;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,xh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||mh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?gh(t,s,{AABBBounds:i}):s,xh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Hg)break;const{width:n}=Mh(t,s.character,s.ascentDescentMode),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 Hg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Ng{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=fh[this.direction]}store(t){if(t instanceof Hg){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 Vg(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,e=!1){t instanceof Hg?"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||this.newLine)&&("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=Sh(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 Dg(i,t.newLine,t.character,t.ascentDescentMode),new Dg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Ug=!1;try{Ug=Intl&&"function"==typeof Intl.Segmenter}catch(t){Ug=!1}const Wg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...yp];class Gg extends Mp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Du,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:lh.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:lh.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:lh.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:lh.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:lh.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:lh.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:lh.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:lh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return wc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Gg.splitText(t.text).length>1)))}static splitText(t){if(Ug){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Gg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),_o.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||_o.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,_o.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Wg)}needUpdateTag(t){return super.needUpdateTag(t,Wg)}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;e0&&!Gg.AllSingleCharacter(_)&&(_=Gg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new Og(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Ng(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Gg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((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 Gg.NOWORK_ANIMATE_ATTR}}function Yg(t){return new Gg(t)}Gg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},kp);const $g=["path","customPath",...yp];class Xg extends Mp{constructor(t){super(t),this.type="path",this.numberType=Ru}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 jl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof jl?this.cache:t.path)}getGraphicTheme(){return wc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=_o.graphicService.updateTempAABBBounds(i);gg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return _o.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 jl).fromString(t.path):t.customPath&&(this.cache=new jl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,$g)}needUpdateTag(t){return super.needUpdateTag(t,$g)}toCustomPath(){return(new jl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Xg.NOWORK_ANIMATE_ATTR}}function Kg(t){return new Xg(t)}Xg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},kp);const qg=["segments","points","curveType","curveTension",...yp];class Zg extends Mp{constructor(t){super(t),this.type="area",this.numberType=wu}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 wc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),_o.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return _o.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new jl;const 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 Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},kp);const Qg=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...yp];class tf extends Mp{constructor(t){super(t),this.type="arc",this.numberType=Mu}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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=$t(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(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 wc(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}=_o.graphicService.updateTempAABBBounds(i);gg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return _o.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<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Kc(l,o,s,i),Kc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Ut(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Ut(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Ut(a),e=h*Yt(a),i=l*Ut(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},kp);const sf=["points","cornerRadius",...yp];class nf extends Mp{constructor(t){super(t),this.type="polygon",this.numberType=Ou}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return wc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),_o.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return _o.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=Zc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new jl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=kp;class af extends wp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function of(t){return new af(t)}const lf=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 hf,cf;function df(t){return hf||(hf=lf.CreateGraphic("text",{})),hf.initAttributes(t),hf.AABBBounds}var uf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gf=function(t,e){return function(i,s){e(i,s,t)}};class ff{constructor(){this.time=Xo.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:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=wc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),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){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=lc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),lc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const mf=new ff;let vf=class{constructor(t){this.subRenderContribitions=t,this.time=Xo.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)}))}};vf=uf([Ga(),gf(0,Ua(oo)),gf(0,Ya(ag)),pf("design:paramtypes",[Object])],vf);const _f=new class{constructor(){this.time=Xo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const yf=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class bf{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=lc.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])),lc.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,Ht),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){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=lc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=kg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:ph(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Kp(t,e,i,s,w+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&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Af=xf,kf=mf;const Mf=new class{constructor(){this.time=Xo.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{radius:m=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:A=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:ph(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+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)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Tf=xf,wf=mf;const Cf=new class extends ff{constructor(){super(...arguments),this.time=Xo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Ef=Ft/2;function Bf(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Ef,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Ef,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Ef,Ft,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Ef,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}var Pf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lf{constructor(){this.time=Xo.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,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:ph(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Bf(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),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,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Rf=class{constructor(){this.time=Xo.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)}};Rf=Pf([Ga()],Rf);let Of=class{constructor(){this.time=Xo.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,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.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 Bf(e,i,s,b,x,v,"bevel"!==_,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+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Of=Pf([Ga()],Of);const If=new Lf,Df=xf,Ff=mf;const zf=new class extends Lf{constructor(){super(...arguments),this.time=Xo.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)}},jf=mf;const Hf=new class{constructor(){this.time=Xo.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:_=l.opacity,x:y=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:ph(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()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Vf=new class{constructor(){this.time=Xo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Nf=xf,Uf=mf;const Wf={x:0,y:0,z:0,lastModelMatrix:null};class Gf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(_f),this.builtinContributions.push(yf),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===Xo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Xo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=wc(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,_=Up(d,u,h),y=Gp(d,g),b=Vp(h),x=Np(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return Jo(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Up(o,l,n),p=Gp(o,c),g=Vp(n,r),f=Np(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,s=!1){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;Wf.x=n,Wf.y=r,Wf.z=a,Wf.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=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(s,d||s,n),Wf.x=0,Wf.y=0,Wf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Zu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,Wf.z=a,i.setTransformForCurrent()}else if(p)Wf.x=0,Wf.y=0,Wf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Wf.x+=s.x,Wf.y+=s.y,this.transformWithoutTranslate(i,Wf.x,Wf.y,Wf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Wf.x=0,Wf.y=0,Wf.z=0;return Wf}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,_=(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,_,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&Zu.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Yf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xf=function(t,e){return function(i,s){e(i,s,t)}};let Kf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Mu,this.builtinContributions=[Sf,kf,Af],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(nDt){const t=Gt(b,y),r=Gt(x,y),a=$p(v,_,f,m,n,t,Number(u)),o=$p(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Dt){const t=Gt(B,w),n=Gt(P,w),a=$p(M,T,A,k,r,-n,Number(u)),o=$p(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(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*Ut(E),s+r*Yt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).arc;const{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:_,doStroke:y}=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:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(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(),Kp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Kp(t,e,i,s,k,M,B),C||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(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,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+=Ht;for(;i>Ht;)i-=Ht;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),lp(o.color,l.color,h,!1)}(0,0,h,n);a||Up&&(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,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Kf=Yf([Ga(),Xf(0,Ua(oo)),Xf(0,Ya(qp)),$f("design:paramtypes",[Object])],Kf);var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jf=function(t,e){return function(i,s){e(i,s,t)}};let Qf=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,wf,Tf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(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,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function tm(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]=rl(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 em(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 im(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=em(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),tm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Yo.ROW:"y"===s?u=Yo.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 nm=class extends Gf{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=wc(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;if(!e)return;t.beginPath();im(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=zl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){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,b,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(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function rm(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),tm(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),tm(t,l,1,s),o=!1):o=!0}t.closePath()}nm=sm([Ga()],nm);const am=new class extends bf{constructor(){super(...arguments),this.time=Xo.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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Jc(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Jc(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Jc(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Jc(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},om=mf;var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let dm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=wu,this.builtinContributions=[am,om],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,_=m[0];e.moveTo(_.x+a,_.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(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=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=wc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,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=zl(B(t.points,x),E,{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=zl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=zl(e,E,{curveTension:b}),n=zl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{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===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=wc(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){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Yo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?Yo.ROW:null==_.y1?Yo.COLUMN:Number.isFinite(S+A)?S>A?Yo.ROW:Yo.COLUMN:Yo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Yo.ROW:Yo.COLUMN,Number.isFinite(c)||(o=Yo.COLUMN),Number.isFinite(d)||(o=Yo.ROW);const u=i*(o===Yo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.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(),im(t,i[0]?e.top:e.bottom,l,x===Yo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};dm=lm([Ga(),cm(0,Ua(oo)),cm(0,Ya(Zp)),hm("design:paramtypes",[Object])],dm);const um=xf,pm=mf;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},fm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mm=function(t,e){return function(i,s){e(i,s,t)}};let vm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[pm,um],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:wc(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:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)Jo(t.pathShape.commandList,e,i,s,1,1,f);else{Jo((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,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=wc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};vm=gm([Ga(),mm(0,Ua(oo)),mm(0,Ya(eg)),fm("design:paramtypes",[Object])],vm);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},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Iu,this.builtinContributions=[If,Ff,Df],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:wc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Wp(g,f,T,w,h),E=Yp(g,v,T,w,M),B=Vp(h,c),P=Np(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Bf(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};xm=_m([Ga(),bm(0,Ua(oo)),bm(0,Ya(sg)),ym("design:paramtypes",[Object])],xm);var Sm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Mm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[Hf,Uf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:wc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Mm=Sm([Ga(),km(0,Ua(oo)),km(0,Ya(ng)),Am("design:paramtypes",[Object])],Mm);const Tm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}};const wm=new class extends ff{constructor(){super(...arguments),this.time=Xo.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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){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!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Tm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.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 E=t.AABBBounds,P||(E=df(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Bf(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Tm.free(E),C()}};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},Em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bm=function(t,e){return function(i,s){e(i,s,t)}};let Pm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[wm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=wc(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:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ed(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),qu.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(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,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Wt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=wc(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,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:og(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jm=function(t,e){return function(i,s){e(i,s,t)}};let Hm=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ou,this.builtinContributions=[Dm,Im],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(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:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,_=v/m;const y=Rm(d,u),b=Rm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Om(h,_,y,d,u),A=Om(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Rm(k,M),w=Om(h,Rm(_,v),T,k,M);let C=Math.atan2(S.y-w.y,S.x-w.x);const E=Math.atan2(A.y-w.y,A.x-w.x);let B=E-C;B<0&&(C=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,_,b,m,v,l,n,a,o);const x=()=>{_&&(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,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=wc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Hm=Fm([Ga(),jm(0,Ua(oo)),jm(0,Ya(ig)),zm("design:paramtypes",[Object])],Hm);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},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Bu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:wc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Wp(p,m,g,f,c),C=Yp(p,v,g,f),E=Vp(c,u),B=Np(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Bf(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Cf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Xo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Xo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=_o.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=wc(t,null==s?void 0:s.theme).group,i=Zu.allocate(),n=Zu.allocate();ug(n,t,e),$u(i,p||i,n),a.modelMatrix=i,Zu.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Zu.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Wm=Vm([Ga(),Um(0,Ua(oo)),Um(0,Ya(Qp)),Nm("design:paramtypes",[Object])],Wm);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)},$m=function(t,e){return function(i,s){e(i,s,t)}};const Xm=["","repeat-x","repeat-y","repeat"];let Km=class extends Gf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[zf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=wc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Bf(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Xm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,_,!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 Vc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=wc(t).image;this._draw(t,a,!1,i)}};Km=Gm([Ga(),$m(0,Ua(oo)),$m(0,Ya(tg)),Ym("design:paramtypes",[Object])],Km);const qm=Symbol.for("IncrementalDrawContribution"),Zm=Symbol.for("ArcRender"),Jm=Symbol.for("AreaRender"),Qm=Symbol.for("CircleRender"),tv=Symbol.for("GraphicRender"),ev=Symbol.for("GroupRender"),iv=Symbol.for("LineRender"),sv=Symbol.for("PathRender"),nv=Symbol.for("PolygonRender"),rv=Symbol.for("RectRender"),av=Symbol.for("SymbolRender"),ov=Symbol.for("TextRender"),lv=Symbol.for("RichTextRender"),hv=Symbol.for("GlyphRender"),cv=Symbol.for("ImageRender"),dv=Symbol.for("DrawContribution"),uv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Tu,!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+=Ht;for(;o<0;)o+=Ht;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 pv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fv=Symbol.for("DrawItemInterceptor"),mv=new He,vv=new He;class _v{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){mv.copy(s.dirtyBounds),vv.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,qu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(mv),s.backupDirtyBounds.copy(vv)),!0}}class yv{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 bv=class{constructor(){this.order=1,this.interceptors=[new _v,new Sv,new xv,new yv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;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&&Zu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mv=function(t,e){return function(i,s){e(i,s,t)}};let Tv=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))}reInit(){this.drawContribution.reInit()}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Tv=Av([Ga(),Mv(0,Ua(dv)),kv("design:paramtypes",[Object])],Tv);var wv=new La((t=>{t(vo).to(Tv)}));const Cv=Symbol.for("PickerService"),Ev=Symbol.for("GlobalPickerService"),Bv=Symbol.for("PickItemInterceptor"),Pv=Symbol.for("PickServiceInterceptor");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};let Rv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Rv=Lv([Ga()],Rv);let Ov=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=wc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=qu.allocateByObj(a),u=new se(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}};Ov=Lv([Ga()],Ov);let Iv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};Iv=Lv([Ga()],Iv);let Dv=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=uv(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()}};Dv=Lv([Ga()],Dv);var Fv=new La(((t,e,i)=>{i(Cv)||(t(Ev).toSelf(),t(Cv).toService(Ev)),t(Dv).toSelf().inSingletonScope(),t(Bv).toService(Dv),t(Ov).toSelf().inSingletonScope(),t(Bv).toService(Ov),t(Iv).toSelf().inSingletonScope(),t(Bv).toService(Iv),ho(t,Bv),t(Rv).toSelf().inSingletonScope(),t(Pv).toService(Rv),ho(t,Pv)})),zv=new La((t=>{t(ju).to(pg),t(Hu).toConstantValue(lf)}));const jv=Symbol.for("AutoEnablePlugins"),Hv=Symbol.for("PluginService");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},Nv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uv=function(t,e){return function(i,s){e(i,s,t)}};let Wv=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&&mo.isBound(jv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Wv=Vv([Ga(),Uv(0,Ua(oo)),Uv(0,Ya(jv)),Nv("design:paramtypes",[Object])],Wv);var Gv=new La((t=>{t(Hv).to(Wv),function(t,e){t(oo).toDynamicValue((({container:t})=>new lo(e,t))).whenTargetNamed(e)}(t,jv)})),Yv=new La((t=>{ho(t,go)})),$v=new La((t=>{t(Eh).to(Bh).inSingletonScope(),ho(t,Eh)})),Xv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=_o.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=Rh({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()}};qv=Xv([Ga(),Kv("design:paramtypes",[])],qv);var Zv=new La((t=>{t(qv).toSelf(),t(Rp).toService(qv)}));var Jv=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 Qv(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 t_(t,e,i,s=!1,n=!1){let 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}=Qv(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;t{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}=Qv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}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},n_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r_=function(t,e){return function(i,s){e(i,s,t)}};let a_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):t_(e,Kl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=_o.global,this.layerService=_o.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.clip(),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Kl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=i_(e,i,Kl.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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Tm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Tm.free(n),qu.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||mo.get(qm);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 l_=class extends nm{constructor(){super(...arguments),this.numberType=Lu}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=wc(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=Up(u,p,c),_=Gp(u,g),y=Vp(c),b=Np(d,f);if(!t.valid||!m)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())}};l_=o_([Ga()],l_);var h_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 c_=class extends dm{constructor(){super(...arguments),this.numberType=wu}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=wc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Up(u,d,c),f=Vp(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())}};c_=h_([Ga()],c_);var d_,u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},g_=function(t,e){return function(i,s){e(i,s,t)}},f_=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"}(d_||(d_={}));let m_=class extends a_{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=d_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new po([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return f_(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:Kl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Kl.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 f_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return f_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>f_(this,void 0,void 0,(function*(){if(2!==t.count)yield e_(t,Kl.zIndex,((i,s)=>{if(this.status===d_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return f_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return f_(this,void 0,void 0,(function*(){this.rendering&&(this.status=d_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=d_.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 f_(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:()=>f_(this,void 0,void 0,(function*(){yield e_(t,Kl.zIndex,(t=>f_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};m_=u_([Ga(),g_(0,Wa(tv)),g_(1,Ua(l_)),g_(2,Ua(c_)),g_(3,Ua(oo)),g_(3,Ya(fv)),p_("design:paramtypes",[Array,Object,Object,Object])],m_);var v_=new La((t=>{t(ff).toSelf().inSingletonScope(),t(bf).toSelf().inSingletonScope(),t(dv).to(a_),t(qm).to(m_),t(ev).to(Wm).inSingletonScope(),t(tv).toService(ev),ho(t,Qp),t(vf).toSelf().inSingletonScope(),ho(t,ag),ho(t,tv),t(bv).toSelf().inSingletonScope(),t(fv).toService(bv),ho(t,fv)}));function __(){__.__loaded||(__.__loaded=!0,mo.load(Hp),mo.load(zv),mo.load(wv),mo.load(Fv),mo.load(Gv),function(t){t.load(Yv),t.load($v),t.load(Zv)}(mo),function(t){t.load(v_)}(mo))}__.__loaded=!1,__();const y_=mo.get(fo);_o.global=y_;const b_=mo.get(Pp);_o.graphicUtil=b_;const x_=mo.get(Bp);_o.transformUtil=x_;const S_=mo.get(ju);_o.graphicService=S_;const A_=mo.get(Lp);_o.layerService=A_;class k_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Pa.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;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class M_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Pa.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=_o.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=_o.global.getRequestAnimationFrame();this.rafId=t((()=>{_o.global.devicePixelRatio!==this.dpr&&(this.dpr=_o.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))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=_o.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class T_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,_o.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 w_=new He;class C_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Pa.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()}));const e=this.pluginService.stage;e&&(e.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&&(w_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(w_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let E_;function B_(){!function(){if(null==E_)try{const t=document.createElement("canvas"),e=t.getContext("2d");E_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),E_&&(E_=!!document.createElement)}catch(t){E_=!1}}();const t=_o.global&&_o.global.env;return t?"browser"===t:E_}let P_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};P_._pluginClasses={};const L_="white";class R_ extends wp{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:L_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Mc,this.hooks={beforeRender:new po(["stage"]),afterRender:new po(["stage"]),afterClearScreen:new po(["stage"]),afterClearRect:new po(["stage"])},this.global=_o.global,!this.global.env&&B_()&&this.global.setEnv("browser"),this.window=mo.get(dc),this.renderService=mo.get(vo),this.pluginService=mo.get(Hv),this.layerService=mo.get(Lp),this.graphicService=mo.get(ju),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:L_,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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Hc(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(t=!1){t&&(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,_=(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,A=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,A=Math.cos(d)*Math.cos(u)*1);const k=P_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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=M;else{const t=P_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=P_.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 k_))}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 M_))}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 T_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new C_,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=P_.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=P_.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=P_.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.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"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,i=!0){"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,e=!0){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 se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e;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(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),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(t=!0,e){if("released"===this.releaseStatus)return;const i=mo.get(dc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){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);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=mo.get(Cv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var O_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},I_=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 D_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return I_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};D_=O_([Ga()],D_);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},z_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let j_=class{constructor(){this._uid=Pa.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};j_=F_([Ga(),z_("design:paramtypes",[])],j_);var H_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},N_=function(t,e){return function(i,s){e(i,s,t)}};let U_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=_o.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=wc(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 se(e.x,e.y);l.transformPoint(a,a);const o=wc(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&&Zu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function W_(t,e,i,s,n,r){const a=(e-t)*n+t,o=(i-e)*n+e,l=(s-i)*n+i,h=(o-a)*n+a,c=(l-o)*n+o,d=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=s}function G_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function Z_(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*s)),n=Math.floor(i/r),0===n&&(n=1,r=i)):(n=Math.ceil(Math.sqrt(i/s)),r=Math.floor(i/n),0===r&&(r=1,n=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const s=[];if(e<=i.length){const t=i.length/e;let n=0,r=0;for(;nt.map((t=>({x:t.x,y:t.y}))),iy=(t,e,i)=>{const s=t.length,n=[];for(let o=0;ot.dot-e.dot));let o=n[0],l=n[n.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},sy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),s=e.height();if(i>=s){const s=e.x1+i/2;return iy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return iy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);sy(n[0],s,i),sy(n[1],e-s,i)}};let ny=!1;const ry=new La((t=>{ny||(ny=!0,t(Kf).toSelf().inSingletonScope(),t(Zm).to(Kf).inSingletonScope(),t(tv).toService(Zm),t(qp).toService(vf),ho(t,qp))}));let ay=!1;const oy=new La((t=>{ay||(ay=!0,t(xm).toSelf().inSingletonScope(),t(rv).to(xm).inSingletonScope(),t(tv).toService(rv),t(Of).toSelf(),t(Rf).toSelf(),t(sg).toService(Of),t(sg).toService(Rf),t(sg).toService(vf),ho(t,sg))}));let ly=!1;const hy=new La((t=>{ly||(ly=!0,t(nm).toSelf().inSingletonScope(),t(l_).toSelf().inSingletonScope(),t(iv).to(nm).inSingletonScope(),t(tv).toService(iv))}));let cy=!1;const dy=new La((t=>{cy||(cy=!0,t(dm).toSelf().inSingletonScope(),t(Jm).to(dm).inSingletonScope(),t(tv).toService(Jm),t(Zp).toService(vf),ho(t,Zp),t(c_).toSelf().inSingletonScope())}));let uy=!1;const py=new La((t=>{uy||(uy=!0,t(Mm).toSelf().inSingletonScope(),t(av).to(Mm).inSingletonScope(),t(tv).toService(av),t(ng).toService(vf),ho(t,ng))}));let gy=!1;const fy=new La((t=>{gy||(gy=!0,t(Qf).toSelf().inSingletonScope(),t(Qm).to(Qf).inSingletonScope(),t(tv).toService(Qm),t(Jp).toService(vf),ho(t,Jp))}));let my=!1;const vy=new La((t=>{my||(my=!0,t(ov).to(Pm).inSingletonScope(),t(tv).toService(ov),t(rg).toService(vf),ho(t,rg))}));let _y=!1;const yy=new La((t=>{_y||(_y=!0,t(vm).toSelf().inSingletonScope(),t(sv).to(vm).inSingletonScope(),t(tv).toService(sv),t(eg).toService(vf),ho(t,eg))}));let by=!1;const xy=new La((t=>{by||(by=!0,t(nv).to(Hm).inSingletonScope(),t(tv).toService(nv),t(ig).toService(vf),ho(t,ig))}));var Sy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ay=class{constructor(){this.numberType=Eu}reInit(){}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=wc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Ay=Sy([Ga()],Ay);let ky=!1;const My=new La((t=>{ky||(ky=!0,t(hv).to(Ay).inSingletonScope(),t(tv).toService(hv))}));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},wy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cy=class extends Gf{constructor(){super(),this.numberType=Du,this.builtinContributions=[wm],this.init()}drawShape(t,e,i,s,n){const r=wc(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=Up(o,l,!0),d=Up(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=wc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Bf(e,i-t,s-n,v,_,f,!0)),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=wc(t).richtext;this._draw(t,s,!1,i)}};Cy=Ty([Ga(),wy("design:paramtypes",[])],Cy);let Ey=!1;const By=new La((t=>{Ey||(Ey=!0,t(lv).to(Cy).inSingletonScope(),t(tv).toService(lv))}));let Py=!1;const Ly=new La((t=>{Py||(Py=!0,t(cv).to(Km).inSingletonScope(),t(tv).toService(cv),t(tg).toService(vf),ho(t,tg))}));function Ry(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),Dy=(t,e)=>(d(zy.warnHandler)&&zy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Fy=(t,e,i)=>{if(!d(zy.errorHandler))throw new Error(t);zy.errorHandler.call(null,t,e)},zy={silent:!1,warnHandler:!1,errorHandler:!1},jy=B_(),Hy=jy&&globalThis?globalThis.document:void 0;function Vy(t){return("desktop-browser"===t||"mobile-browser"===t)&&jy}function Ny(t){return Uy(t)||"mobile-browser"===t}function Uy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Wy=0;function Gy(){return Wy>=9999999&&(Wy=0),Wy++}function Yy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function $y(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Xy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Ky extends wp{constructor(t,e){super(t),this._skipRenderAttributes=Xy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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"},Ab=(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 kb extends l{constructor(t,e={}){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.startTime=Ic.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=Ic.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||Sb(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=Ab(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=Ic.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=Ab(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Sb(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("pointerleave",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("pointerleave",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=Ic.now()-i>this.config.press.time&&Ab(s[0],t){_o.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){if(!this.element)return;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},Tb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const wb=[0,0,0];let Cb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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({},Yl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 qu.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&&(qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=this.dpr){this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.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-=Ht;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(f,-2*y),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&&mp.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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[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&&(Xu(wb,[t,e,i],this.modelMatrix),t=wb[0],e=wb[1],i=wb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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,e=_o.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=_o.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Yl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Yl.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&&(Xu(wb,[e,i,s],this.modelMatrix),e=wb[0],i=wb[1],s=wb[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=gh(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,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,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,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:ph(this,a,this.dpr),r.strokeStyle=gh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Oe(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?this.font=t.font:this.font=Oe(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>qu.free(t))),this.stack.length=0}};Cb.env="browser",Cb=Mb([Ga(),Tb("design:paramtypes",[Object,Number])],Cb);var Eb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Pb=class extends np{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=_o.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Cb(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 Lb(t,e){return new La((i=>{i(Ph).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Pb.env="browser",Pb=Eb([Ga(),Bb("design:paramtypes",[Object])],Pb);const Rb=Lb(Pb,Cb);var 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},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Db=function(t,e){return function(i,s){e(i,s,t)}};let Fb=class extends U_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=lc.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 jb=class{constructor(){this.type="group",this.numberType=Bu}contains(t,e,i){return!1}};jb=zb([Ga()],jb);const Hb=new La(((t,e,i,s)=>{Hb.__vloaded||(Hb.__vloaded=!0,t(bb).to(jb).inSingletonScope(),t(xb).toService(bb),ho(t,xb))}));Hb.__vloaded=!1;var Vb=Hb;const Nb=new La(((t,e,i,s)=>{i(Fb)||t(Fb).toSelf().inSingletonScope(),i(Cv)?s(Cv).toService(Fb):t(Cv).toService(Fb)}));var Ub,Wb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Yb=Ub=class extends j_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ub.idprefix}_${Ub.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=_o.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Ub.GenerateCanvasId(),canvasControled:!0};this.canvas=new Pb(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 Pb({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)}};Yb.env="browser",Yb.idprefix="visactor_window",Yb.prefix_count=0,Yb=Ub=Wb([Ga(),Gb("design:paramtypes",[])],Yb);const $b=new La((t=>{t(Yb).toSelf(),t(uc).toDynamicValue((t=>t.container.get(Yb))).whenTargetNamed(Yb.env)}));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)},qb=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 Zb{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 Jb(t,e=!1){const i=document.createElement("img");if(_o.global.isImageAnonymous&&(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 Qb=class extends D_{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)/(k(l)?l:1),y:(i-a.top)/(k(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 Zb(t)}return new He}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 Jb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Jb(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:Pa.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(...t){}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}}loadFont(t,e,i){return qb(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Qb=Xb([Ga(),Kb("design:paramtypes",[])],Qb);const tx=new La((t=>{tx.isBrowserBound||(tx.isBrowserBound=!0,t(Qb).toSelf().inSingletonScope(),t(go).toService(Qb))}));function ex(t,e=!0){ex.__loaded||(ex.__loaded=!0,t.load(tx),t.load(Rb),t.load($b),e&&function(t){t.load(Vb),t.load(Nb)}(t))}tx.isBrowserBound=!1,ex.__loaded=!1;var ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nx=function(t,e){return function(i,s){e(i,s,t)}};let rx=class extends U_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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}};rx=ix([Ga(),nx(0,Ua(oo)),nx(0,Ya(qy)),nx(1,Ua(oo)),nx(1,Ya(Bv)),nx(2,Ua(oo)),nx(2,Ya(Pv)),sx("design:paramtypes",[Object,Object,Object])],rx);const ax=new La((t=>{ax.__vloaded||(ax.__vloaded=!0,ho(t,qy))}));ax.__vloaded=!1;var ox=ax;class lx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:ph(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}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},cx=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 ux=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};ux=hx([Ga(),dx(0,Ua(Zm)),cx("design:paramtypes",[Object])],ux);let px=!1;const gx=new La(((t,e,i,s)=>{px||(px=!0,t(Zy).to(ux).inSingletonScope(),t(qy).toService(Zy))}));var fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mx=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 _x=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};_x=fx([Ga(),vx(0,Ua(Jm)),mx("design:paramtypes",[Object])],_x);let yx=!1;const bx=new La(((t,e,i,s)=>{yx||(yx=!0,t(Jy).to(_x).inSingletonScope(),t(qy).toService(Jy))}));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},Sx=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 kx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};kx=xx([Ga(),Ax(0,Ua(Qm)),Sx("design:paramtypes",[Object])],kx);let Mx=!1;const Tx=new La(((t,e,i,s)=>{Mx||(Mx=!0,t(Qy).to(kx).inSingletonScope(),t(qy).toService(Qy))}));class Cx{constructor(){this.type="glyph",this.numberType=Eu}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 Ex=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Lx=class extends Cx{constructor(t){super(),this.canvasRenderer=t}};Lx=Ex([Ga(),Px(0,Ua(hv)),Bx("design:paramtypes",[Object])],Lx);let Rx=!1;const Ox=new La(((t,e,i,s)=>{Rx||(Rx=!0,t(ob).to(Lx).inSingletonScope(),t(Lx).toService(ob))}));var Ix=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Dx=class{constructor(){this.type="image",this.numberType=Pu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Dx=Ix([Ga()],Dx);let Fx=!1;const zx=new La(((t,e,i,s)=>{Fx||(Fx=!0,t(tb).to(Dx).inSingletonScope(),t(Dx).toService(tb))}));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},Hx=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 Nx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Nx=jx([Ga(),Vx(0,Ua(iv)),Hx("design:paramtypes",[Object])],Nx);let Ux=!1;const Wx=new La(((t,e,i,s)=>{Ux||(Ux=!0,t(eb).to(Nx).inSingletonScope(),t(qy).toService(eb))}));var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};Xx=Gx([Ga(),$x(0,Ua(nv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new La(((t,e,i,s)=>{Kx||(Kx=!0,t(ab).to(Xx).inSingletonScope(),t(qy).toService(ab))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jx=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 tS=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};tS=Zx([Ga(),Qx(0,Ua(sv)),Jx("design:paramtypes",[Object])],tS);let eS=!1;const iS=new La(((t,e,i,s)=>{eS||(eS=!0,t(ib).to(tS).inSingletonScope(),t(qy).toService(ib))})),sS=new He;class nS{constructor(){this.type="rect",this.numberType=Iu}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:ph(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;sS.setValue(i.x1,i.y1,i.x2,i.y2),sS.expand(-r/2),h=!sS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var rS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oS=function(t,e){return function(i,s){e(i,s,t)}};let lS=class extends nS{constructor(t){super(),this.canvasRenderer=t}};lS=rS([Ga(),oS(0,Ua(rv)),aS("design:paramtypes",[Object])],lS);let hS=!1;const cS=new La(((t,e,i,s)=>{hS||(hS=!0,t(sb).to(lS).inSingletonScope(),t(qy).toService(sb))}));let dS=!1;const uS=new La(((t,e,i,s)=>{dS||(dS=!0,t(tb).to(Dx).inSingletonScope(),t(Dx).toService(tb))}));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)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}};mS=pS([Ga(),fS(0,Ua(av)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new La(((t,e,i,s)=>{vS||(vS=!0,t(nb).to(mS).inSingletonScope(),t(qy).toService(nb))}));var yS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 bS=class{constructor(){this.type="text",this.numberType=zu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};bS=yS([Ga()],bS);let xS=!1;const SS=new La(((t,e,i,s)=>{xS||(xS=!0,t(rb).to(bS).inSingletonScope(),t(qy).toService(rb))})),AS=new La(((t,e,i,s)=>{i(rx)||t(rx).toSelf().inSingletonScope(),i(Cv)?s(Cv).toService(rx):t(Cv).toService(rx)}));var kS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let TS=class extends Cb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};TS.env="node",TS=kS([Ga(),MS("design:paramtypes",[Object,Number])],TS);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},CS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ES=class extends np{constructor(t){super(t)}init(){this._context=new TS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ES.env="node",ES=wS([Ga(),CS("design:paramtypes",[Object])],ES);const BS=Lb(ES,TS);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},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},RS=function(t,e){return function(i,s){e(i,s,t)}};let OS=class extends j_{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:Pa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ES(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ES({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};OS.env="node",OS=PS([Ga(),RS(0,Ua(fo)),LS("design:paramtypes",[Object])],OS);const IS=new La((t=>{t(OS).toSelf(),t(uc).toDynamicValue((t=>t.container.get(OS))).whenTargetNamed(OS.env)}));var DS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 FS=class extends D_{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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};FS=DS([Ga()],FS);const zS=new La((t=>{zS.isNodeBound||(zS.isNodeBound=!0,t(FS).toSelf().inSingletonScope(),t(go).toService(FS))}));function jS(t,e=!0){jS.__loaded||(jS.__loaded=!0,t.load(zS),t.load(BS),t.load(IS))}zS.isNodeBound=!1,jS.__loaded=!1;var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 VS=class extends Cb{draw(){}createPattern(t,e){return null}};VS.env="wx",VS=HS([Ga()],VS);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},US=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let WS=class extends np{constructor(t){super(t)}init(){this._context=new VS(this,this._dpr)}release(...t){}};WS.env="wx",WS=NS([Ga(),US("design:paramtypes",[Object])],WS);const GS=Lb(WS,VS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XS=function(t,e){return function(i,s){e(i,s,t)}};class KS{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 qS=class extends j_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new KS}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:Pa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new WS(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 WS({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()}};qS.env="wx",qS=YS([Ga(),XS(0,Ua(fo)),$S("design:paramtypes",[Object])],qS);const ZS=new La((t=>{t(qS).toSelf(),t(uc).toDynamicValue((t=>t.container.get(qS))).whenTargetNamed(qS.env)}));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},QS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tA=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 eA=class extends D_{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,a){return tA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 td.call(t)}}getCancelAnimationFrame(){return t=>{td.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};eA=JS([Ga(),QS("design:paramtypes",[])],eA);const iA=new La((t=>{iA._isWxBound||(iA._isWxBound=!0,t(eA).toSelf().inSingletonScope(),t(go).toService(eA))}));function sA(t,e=!0){sA.__loaded||(sA.__loaded=!0,t.load(iA),t.load(GS),t.load(ZS),e&&function(t){t.load(ox),t.load(AS),t.load(gx),t.load(bx),t.load(Tx),t.load(Ox),t.load(zx),t.load(Wx),t.load(qx),t.load(iS),t.load(cS),t.load(uS),t.load(_S),t.load(SS)}(t))}iA._isWxBound=!1,sA.__loaded=!1;var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aA=function(t,e){return function(i,s){e(i,s,t)}};let oA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Mu}};oA=nA([Ga(),aA(0,Ua(Zm)),rA("design:paramtypes",[Object])],oA);let lA=!1;const hA=new La(((t,e,i,s)=>{lA||(lA=!0,t(lb).to(oA).inSingletonScope(),t(xb).toService(lb))}));var cA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uA=function(t,e){return function(i,s){e(i,s,t)}};let pA=class extends nS{constructor(t){super(),this.canvasRenderer=t}};pA=cA([Ga(),uA(0,Ua(rv)),dA("design:paramtypes",[Object])],pA);let gA=!1;const fA=new La(((t,e,i,s)=>{gA||(gA=!0,t(gb).to(pA).inSingletonScope(),t(xb).toService(gb))}));class mA extends Gf{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:ph(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var vA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yA=function(t,e){return function(i,s){e(i,s,t)}};let bA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};bA=vA([Ga(),yA(0,Ua(iv)),_A("design:paramtypes",[Object])],bA);let xA=!1;const SA=new La(((t,e,i,s)=>{xA||(xA=!0,t(ub).to(bA).inSingletonScope(),t(xb).toService(ub))}));var AA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},MA=function(t,e){return function(i,s){e(i,s,t)}};let TA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=wu}};TA=AA([Ga(),MA(0,Ua(Jm)),kA("design:paramtypes",[Object])],TA);let wA=!1;const CA=new La(((t,e,i,s)=>{wA||(wA=!0,t(hb).to(TA).inSingletonScope(),t(xb).toService(hb))}));class EA extends Gf{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&&Zu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var BA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LA=function(t,e){return function(i,s){e(i,s,t)}};let RA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Fu}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:ph(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Zu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};RA=BA([Ga(),LA(0,Ua(av)),PA("design:paramtypes",[Object])],RA);let OA=!1;const IA=new La(((t,e,i,s)=>{OA||(OA=!0,t(fb).to(RA).inSingletonScope(),t(xb).toService(fb))}));var DA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zA=function(t,e){return function(i,s){e(i,s,t)}};let jA=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Cu}};jA=DA([Ga(),zA(0,Ua(Qm)),FA("design:paramtypes",[Object])],jA);let HA=!1;const VA=new La(((t,e,i,s)=>{HA||(HA=!0,t(cb).to(jA).inSingletonScope(),t(xb).toService(cb))}));var NA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WA=function(t,e){return function(i,s){e(i,s,t)}};let GA=class extends EA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=zu}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=lg(a,u,n),v=og(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&&Zu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};GA=NA([Ga(),WA(0,Ua(ov)),UA("design:paramtypes",[Object])],GA);let YA=!1;const $A=new La(((t,e,i,s)=>{YA||(YA=!0,t(mb).to(GA).inSingletonScope(),t(xb).toService(mb))}));var XA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qA=function(t,e){return function(i,s){e(i,s,t)}};let ZA=class extends mA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Ru}};ZA=XA([Ga(),qA(0,Ua(sv)),KA("design:paramtypes",[Object])],ZA);let JA=!1;const QA=new La(((t,e,i,s)=>{JA||(JA=!0,t(pb).to(ZA).inSingletonScope(),t(xb).toService(pb))}));var tk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ek=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 sk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Ou}};sk=tk([Ga(),ik(0,Ua(nv)),ek("design:paramtypes",[Object])],sk);let nk=!1;const rk=new La(((t,e,i,s)=>{nk||(nk=!0,t(vb).to(sk).inSingletonScope(),t(xb).toService(vb))}));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 Cx{constructor(t){super(),this.canvasRenderer=t}};hk=ak([Ga(),lk(0,Ua(hv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new La(((t,e,i,s)=>{ck||(ck=!0,t(yb).to(hk).inSingletonScope(),t(xb).toService(yb))}));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 fk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Du}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};fk=uk([Ga(),gk(0,Ua(lv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new La(((t,e,i,s)=>{mk||(mk=!0,t(_b).to(fk).inSingletonScope(),t(xb).toService(_b))}));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},yk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bk=function(t,e){return function(i,s){e(i,s,t)}};let xk=class extends lx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Pu}};xk=_k([Ga(),bk(0,Ua(cv)),yk("design:paramtypes",[Object])],xk);let Sk=!1;const Ak=new La(((t,e,i,s)=>{Sk||(Sk=!0,t(db).to(xk).inSingletonScope(),t(xb).toService(db))})),kk=B_();function Mk(){Mk.__loaded||(Mk.__loaded=!0,lf.RegisterGraphicCreator("arc",ef),mo.load(ry),mo.load(kk?hA:gx))}Mk.__loaded=!1;const Tk=Mk;function wk(){wk.__loaded||(wk.__loaded=!0,lf.RegisterGraphicCreator("area",Jg),mo.load(dy),mo.load(kk?CA:bx))}wk.__loaded=!1;const Ck=wk;function Ek(){Ek.__loaded||(Ek.__loaded=!0,lf.RegisterGraphicCreator("circle",vg),mo.load(fy),mo.load(kk?VA:Tx))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,lf.RegisterGraphicCreator("glyph",Rg),mo.load(My),mo.load(kk?dk:Ox))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,lf.RegisterGraphicCreator("group",Cp))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,lf.RegisterGraphicCreator("image",jg),mo.load(Ly),mo.load(kk?Ak:zx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,lf.RegisterGraphicCreator("line",wg),mo.load(hy),mo.load(kk?SA:Wx))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,lf.RegisterGraphicCreator("path",Kg),mo.load(yy),mo.load(kk?QA:iS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,lf.RegisterGraphicCreator("polygon",rf),mo.load(xy),mo.load(kk?rk:qx))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,lf.RegisterGraphicCreator("rect",Pg),mo.load(oy),mo.load(kk?fA:cS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,lf.RegisterGraphicCreator("richtext",Yg),mo.load(By),mo.load(kk?vk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,lf.RegisterGraphicCreator("shadowRoot",of))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,lf.RegisterGraphicCreator("symbol",kg),mo.load(py),mo.load(kk?IA:_S))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,lf.RegisterGraphicCreator("text",xg),mo.load(vy),mo.load(kk?$A:SS))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Ok(),Wk()}const tM=-.5*Math.PI,eM=1.5*Math.PI,iM="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 sM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sM||(sM={}));const nM={[sM.selectedReverse]:{},[sM.selected]:{},[sM.hover]:{},[sM.hoverReverse]:{}},rM={container:"",width:30,height:30,style:{}},aM="scrollDrag";function oM(){return"browser"===y_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const lM={debounce:bt,throttle:xt};Qk();let hM=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=oM(),a="browser"===y_.env?y_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,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:lM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(aM,{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",lM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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]=ni(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)}_clearDragEvents(){const t=oM(),e="browser"===y_.env?y_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};hM.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};var cM,dM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 uM=cM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Pa.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=cM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(aM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new hM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(uM)||(t(uM).toSelf(),t(jv).toService(uM))}));function gM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&gM(t,e)}))}const fM=t=>!u(t)&&!1!==t.visible;function mM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function vM(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 yM=["#ffffff","#000000"];function bM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return xM(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(...yM);for(const n of a)if(t!==n&&xM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function xM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(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=AM(t),s=AM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function AM(t){const e=ii(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 kM(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 MM(t,e){return[t[0]*e,t[1]*e]}function TM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function wM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const CM=(t,e,i,s)=>new Ie(Object.assign({defaultFontParams:Object.assign({fontFamily:iM,fontSize:14},s),getTextBounds:i?void 0:df,specialCharSet:"-/: .,@%'\"~"+Ie.ALPHABET_CHAR_SET+Ie.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function EM(t,e,i={}){if(!t)return{width:0,height:0};const s=df({text:t,fontFamily:e.fontFamily||i.fontFamily||iM,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 BM(t,e="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 PM(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 LM(t,e="type"){const i=BM(t,e);return"rich"===i?lf.richtext(PM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),lf.text(t))}function RM(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 OM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function IM(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 DM(t,e){const{dx:i,dy:s}=IM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function FM(){Ok(),Wk(),qk(),Yk(),Jk()}var zM=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);nh&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=zM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new jl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},jM.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))}}jM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const HM={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}},VM={poptip:j({},HM)};var NM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Gt(Wt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Gt(Wt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}KM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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 ZM=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={};j(s,KM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new KM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,VM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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))}};ZM=qM([Ga()],ZM);var JM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 QM{constructor(){this.activeEvent="onRegister",this._uid=Pa.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 tT=class extends QM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};tT=JM([Ga()],tT);let eT=class extends QM{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)}};eT=JM([Ga()],eT);const iT=new La(((t,e,i,s)=>{i(ZM)||(t(ZM).toSelf().inSingletonScope(),t(ag).toService(ZM)),i(tT)||(t(tT).toSelf(),t(jv).toService(tT)),i(eT)||(t(eT).toSelf(),t(jv).toService(eT))}));class sT extends Ky{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Ok(),zk();class nT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},nT.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})}}nT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Ok(),Wk();class rT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},rT.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})}}rT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Tk();class aT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},aT.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}aT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},Ok(),Tk();class oT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},oT.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=tM,endAngle:s=eM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}oT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},Ok(),Hk();class lT extends sT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function hT(){Ok(),zk(),Nk(),qk()}function cT(){Ok(),zk(),Tk(),qk()}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},hT();class dT extends Ky{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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(k(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=lf.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),P(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=lf.line;Y(i)[0].cornerRadius&&(t=lf.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"),P(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+(k(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(k(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(k(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(k(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=lf.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`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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?k(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}}dT.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}}},cT();class uT extends dT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=lf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var pT,gT;!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"}(pT||(pT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(gT||(gT={}));const fT={[gT.selectedReverse]:{},[gT.selected]:{},[gT.hover]:{},[gT.hoverReverse]:{}},mT={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}}},vT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const _T=Math.sin(Math.PI/10);function yT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function bT(t,e=_T){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function xT(t){const e={};return gM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ST(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function AT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return MM(r,(s?-1:1)*(n?-1:1)*t/TM(r))}function kT(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 TT(t,e,i){var s;if(bT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function wT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(sM.hover,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.hoverReverse,!0)})),s):i},ET=(t,e,i)=>i?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),null):i,BT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(sM.selected)?(gM(e,(t=>{t.name&&!P(t.states)&&(t.removeState(sM.selectedReverse),t.removeState(sM.selected))})),null):s.name&&!P(s.states)?(s.addState(sM.selected,!0),gM(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(sM.selectedReverse,!0)})),s):i};class PT extends Ky{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const LT={type:"default",duration:300,easing:"linear"};class RT extends PT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=CT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=lf.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._prepare(),this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=lf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(LT)}_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=lf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=pT.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=lf.group({x:0,y:0,pickable:!1});t.name=pT.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=lf.group({x:0,y:0,pickable:!1});i.name=pT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=lf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=pT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=nM;else{const t=this.data[s],e=j({},nM,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=lf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=pT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=nM;else{const i=j({},nM,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=lf.group({x:0,y:0,pickable:!1});return r.name=`${pT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=LM(this._getLabelAttribute(t,e,n,i));if(a.name=pT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=nM;else{const s=j({},nM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new jM(Object.assign({},e));i.name=pT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ST(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(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:_}=this.attribute.label;_=d(_)?j({},mT.label.style,_(t,e,i,s)):_;return _=j(this.getLabelAlign(m,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(f,m,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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},gM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const OT={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&&TT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function IT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function DT(t,e,i,s,n=!1){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:OT[n]||OT.parity;if(s.length>=3&&wT(s,r)){do{s=a(s,r)}while(s.length>=3&&wT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);TT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),DT(l,s,n,(t=>TT(t,l,r))),DT(h,s,o,(t=>TT(t,h,r)||!(!n||t===l)&&TT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function zT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},VT(t,e.attribute.angle)),{angle:HT(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({},NT(t,e.attribute.angle)),{angle:HT(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=ke({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 HT(t=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 VT(t,e=0){let 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=HT(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 NT(t,e=0){let 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=HT(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 UT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(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=bT(h),m=yT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!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"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){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"===_||m?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);k(t.attribute.maxLineWidth)&&(r=k(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 WT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class GT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=TM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return MM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class YT{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-YT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*YT.bounceIn(2*t):.5*YT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){YT[t]=e}}function $T(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}YT.quadIn=YT.getPowIn(2),YT.quadOut=YT.getPowOut(2),YT.quadInOut=YT.getPowInOut(2),YT.cubicIn=YT.getPowIn(3),YT.cubicOut=YT.getPowOut(3),YT.cubicInOut=YT.getPowInOut(3),YT.quartIn=YT.getPowIn(4),YT.quartOut=YT.getPowOut(4),YT.quartInOut=YT.getPowInOut(4),YT.quintIn=YT.getPowIn(5),YT.quintOut=YT.getPowOut(5),YT.quintInOut=YT.getPowInOut(5),YT.backIn=YT.getBackIn(1.7),YT.backOut=YT.getBackOut(1.7),YT.backInOut=YT.getBackInOut(1.7),YT.elasticIn=YT.getElasticIn(1,.3),YT.elasticOut=YT.getElasticOut(1,.3),YT.elasticInOut=YT.getElasticInOut(1,.3*1.5),YT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),YT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},YT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)YT[`flicker${t}`]=e=>$T(e,t);for(let t=2;t<10;t++)YT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function XT(t,e,i){return t+(e-t)*i}const KT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=XT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=XT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=XT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=XT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=XT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=XT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=XT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=XT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=XT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=lp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?cp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=lp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?cp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=XT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=XT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=XT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=XT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=XT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=XT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=XT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=XT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=XT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Zc(e,i,s),r.addUpdateBoundTag()}}};function qT(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=YT[s])&&void 0!==n?n:YT.linear:YT.linear,"wait"===t&&(this.onUpdate=ZT),this.id=Pa.GenAutoIncrementId(),this.syncAttributeUpdate=ZT}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=ap.Get(i,rp.Color255),r=ap.Get(s,rp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(KT["fill"===e?"fillPure":"strokePure"])}else KT[e]?t.push(KT[e]):t.push(qT)}else KT[e]?t.push(KT[e]):t.push(qT)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class QT extends JT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class tw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Pa.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Bo.END?this.removeAnimate(t,!0):t.status!==Bo.RUNNING&&t.status!==Bo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const ew=new tw;ew.isGlobal=!0;class iw{constructor(t=Pa.GenAutoIncrementId(),e=ew,i){this.id=t,this.status=Bo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new JT(Eo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new QT(Eo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new JT(Eo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Bo.RUNNING&&(this.status=Bo.PAUSED)}resume(){this.status===Bo.PAUSED&&(this.status=Bo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Bo.END&&this.onEnd(),this.status=Bo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Bo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Bo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Bo.END);this.status=Bo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const sw=new bo;class nw{constructor(){this.released=!1}tick(t,e){sw.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class rw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Co.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Co.INITIAL,_o.global.hooks.onSetEnv.tap("graph-ticker",(()=>{this.initHandler(!1)})),_o.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new nw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Co.INITIAL&&(this.status=Co.PAUSE,!0)}resume(){return this.status!==Co.INITIAL&&(this.status=Co.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Co.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Co.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Co.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Co.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Co.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Co.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}ow.getInstance();class lw{static registerBuiltInAnimate(t,e){lw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,void 0,void 0),a=this.resolveValue(t.startTime,void 0,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:lw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=s&&d(s)?/^class\s/.test(Function.prototype.toString.call(s))?1:2:0;return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:lw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const p=o.custom&&d(o.custom)?/^class\s/.test(Function.prototype.toString.call(o.custom))?1:2:0;if(o.customType=p,r){const t=e+h+c+u*(this._target.count-2),i=r?r/t:1;o.delay=e*i,o.delayAfter=h*i,o.duration=c*i,o.oneByOneDelay=u*i,o.startTime=a}}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_;if(e&&i){const c=Object.assign({width:(null===(p=u.stage)||void 0===p?void 0:p.width)||0,height:(null===(g=u.stage)||void 0===g?void 0:g.height)||0,group:this._target.parent},this.resolveValue(o,u)),y=d(h)?h.call(null,null!==(m=c&&(null===(f=c.data)||void 0===f?void 0:f[0]))&&void 0!==m?m:null===(_=null===(v=u.context)||void 0===v?void 0:v.data)||void 0===_?void 0:_[0],u,c):h;c.options=y,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from);const g=null!==(n=t.custom)&&void 0!==n?n:lw.builtInAnimateMap[r],f=t.customType;this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){const i={};let s=null;return t?(Array.isArray(t)?t.forEach((t=>{var s,n;const r=null===(n=null===(s=e.context)||void 0===s?void 0:s.diffAttrs)||void 0===n?void 0:n[t];void 0!==r&&(i[t]=r)})):Object.keys(t).forEach((n=>{var r,a,o,l;const h=t[n];void 0!==h.to&&("function"==typeof h.to?i[n]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):i[n]=h.to),void 0!==h.from&&(s||(s={}),"function"==typeof h.from?s[n]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):s[n]=h.from)})),{from:s,props:i}):{from:s,props:i}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Bo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}lw.builtInAnimateMap={};const hw="appear",cw="disappear",dw="update",uw="highlight",pw="unhighlight";class gw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class fw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=ow.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new lw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([hw],[{name:hw,animation:t}],e)}applyDisappearState(t,e){this.applyState([cw],[{name:cw,animation:t}],e)}applyUpdateState(t,e){this.applyState([dw],[{name:dw,animation:t}],e)}applyHighlightState(t,e){this.applyState([uw],[{name:uw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([pw],[{name:pw,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class mw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new fw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new gw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new mw)._getAnimationStateManager(t),t}}class vw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new iw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:ew,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new tw}createTicker(t){return new rw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new lw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function _w(){G(Mp,mw),G(Mp,vw)}class yw extends JT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class bw extends yw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class xw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new lw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Sw(t){return new xw(t)}class Aw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const kw=1e3,Mw="quadInOut",Tw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],ww=(t,e,i)=>{t.forEach((t=>{if(Number.isFinite(t.to))e[t.key]=t.from+(t.to-t.from)*i;else if("fill"===t.key||"stroke"===t.key){const s=lp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Cw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?q_(t):[],n=q_(e);i&&s&&(i.fromTransform&&Z_(s,i.fromTransform.clone().getInverse()),Z_(s,i.toTransfrom));const[r,a]=function(t,e){let i,s;const n=[],r=[];for(let a=0;a0){const t=s/i;for(let e=-s/2;e<=s/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let s=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},Bw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Pw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Bw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?ap.Get(t,rp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Lw extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const s=this.target,n="function"==typeof s.pathProxy?s.pathProxy(s.attribute):s.pathProxy;Cw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&ww(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const Rw=(t,e,i,s)=>{var n,r,a;if(t&&(!t.valid||!t.toCustomPath))return console.error(t," is not validate"),null;if(!e.valid||!e.toCustomPath)return console.error(e," is not validate"),null;let o=null==t?void 0:t.globalTransMatrix;s&&o&&(o=s.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=Ew(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Pw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Lw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:kw,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Mw);return c.play(d),c};class Ow extends yw{constructor(t,e,i){super({},{},e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var s;Cw(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(s=this.otherAttrs)||void 0===s?void 0:s[i])&&this.otherAttrs[i].length&&ww(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Iw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Tw.includes(t))(i)||(e[i]=t[i])})),e},Dw=(t,e,i)=>{const s=Iw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),n.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();n.setTheme({rect:s}),new Array(i).fill(0).forEach((t=>{const i=_o.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Fw=(t,e,i)=>{const s=[],n=i?null:Iw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Iw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Cg(t.attribute),n=Q_(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(_o.graphicService.creator.rect(i?t:Object.assign({},n,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),s=i.startAngle,n=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(s-n),l=Math.abs(a-r),h=Q_(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(_o.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),s=t.getComputedAttribute("endAngle"),n=t.getComputedAttribute("radius"),r=Math.abs(i-s),a=Q_(r*n,n,e),o=[],l=r/a[0],h=n/a.length,c=s>=i?1:-1;for(let t=0,e=a.length;t{s.push(_o.graphicService.creator.arc(i?t:Object.assign({},n,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,s=i.points;if(s)return ty(s,e);if(i.segments){const t=i.segments.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]);return ty(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(_o.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},n,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ey(i)}];const s=[];return sy(i,e,s),s})(t,e).forEach((t=>{s.push(_o.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"area"===t.type?((t,e)=>{var i,s;const n=t.attribute;let r=n.points;const a=n.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&S(t.x)&&S(t.y)));if(!o.length)return[];const l=[];o.forEach((t=>{l.push({x:t.x,y:t.y})}));for(let t=o.length-1;t>=0;t--){const e=o[t];l.push({x:null!==(i=e.x1)&&void 0!==i?i:e.x,y:null!==(s=e.y1)&&void 0!==s?s:e.y})}const h=[];return sy(l,e,h),h})(t,e).forEach((t=>{s.push(_o.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=q_(t.getParsedPathShape());if(!i.length||e<0)return[];const s=i.length;if(i.length>=e){const t=[],n=Math.floor(i.length/e);for(let r=0;r{"path"in t?s.push(_o.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(_o.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Dw(t,s,e),s};class jw extends yw{constructor(t,e,i,s,n){super(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(){super.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:Go.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Go.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:Go.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Hw extends jw{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 A=0,k=0;"anticlockwise"===S?(k="in"===b?x+2*Math.PI:x,k=x+2*Math.PI):(A=x,k="out"===b?x+2*Math.PI:x);const M=_o.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:A,endAngle:k,fill:!0});let T,w;"anticlockwise"===S?(T={startAngle:x+2*Math.PI},w={startAngle:x}):(T={endAngle:x},w={endAngle:x+2*Math.PI}),super("in"===b?T:w,"in"===b?w:T,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vw extends jw{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=_o.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class Nw extends yw{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,e=!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(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=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})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Uw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ww extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Gw extends Uw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Yw extends Ww{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const $w=(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.getFinalAttribute();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.getFinalAttribute();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)};class Xw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class Kw extends Xw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=$w(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class qw extends Xw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class Zw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Jw extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Qw=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class tC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Qw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class eC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const iC=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(k(e.center.x)&&(n.x=e.center.x),k(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class sC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class nC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:iC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class rC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:iC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const aC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class oC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:aC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class lC extends sC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:aC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const hC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class cC extends sC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class dC extends sC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const uC=(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.getFinalAttribute(),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.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)};class pC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class gC extends pC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=uC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class fC extends pC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const mC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class vC extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=mC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class _C extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.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)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends bw{onBind(){var t;const e=Sw(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class bC extends bw{onBind(){const t=Sw(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function xC(){Ok(),zk(),Yk(),Jk(),lw.registerBuiltInAnimate("axisEnter",yC),lw.registerBuiltInAnimate("axisUpdate",bC)}var SC=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=lf.group({zIndex:999});e.name=pT.axisBreak,e.id=this._getNodeId(`${pT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},vT,s),a=null!==(e=r.size)&&void 0!==e?e:vT.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=lf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=pT.axisBreakSymbol;const h=lf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=pT.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=lf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=pT.background,n.id=this._getNodeId("background"),n.states=j({},fT,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=SC(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];P(l)||(c.state={line:j({},fT,l),symbol:j({},fT,l)});const d=new dT(c);d.name=pT.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=SC(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),_=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=+L(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===m?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),A=this.getVerticalVector(x,!1,{x:0,y:0});let M,T,{angle:w}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(w)&&o){w=wM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else M=this.getTextAlign(A),T=this.getTextBaseline(A,!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(k(s))if("bottom"===i||"top"===i)if(w!==Math.PI/2){const t=Math.abs(Math.cos(null!=w?w:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(w&&0!==w){const t=Math.abs(Math.sin(w));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:T},a),state:{text:j({},fT,c.text),shape:j({},fT,c.shape),panel:j({},fT,c.background)}});return E.angle=w,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 VT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return NT(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(P(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:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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=re(e)})),jT(i,t),!zT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=bT(a),l=yT(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=WT(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);k(i)&&(c=Gt(c,i))}}else{if(l){const i=WT(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);k(i)&&(c=Gt(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&&k(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);UT(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&FT(t,{orient:o,method:m,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(k(c)&&(!k(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=lf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=pT.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=EM(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=ni(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}}AC.defaultAttributes=mT,G(AC,GT);class kC{isInValidValue(t){const{startAngle:e=tM,endAngle:i=eM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=tM,endAngle:i=eM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return AT(t,i,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 MC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=MC(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 CC=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),k(l)&&l>=3){const t=kT(n,l,c,e,i);h=lf.path(Object.assign(Object.assign({},a.style),{path:MT(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=lf.circle(t)}h.name=pT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},fT,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=CC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(this.attribute.label,"space",4));let m=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(m=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(m=Math.max(m,this.attribute.subTick.length||2));const v=n+m+f+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:j({},fT,d.text),shape:j({},fT,d.shape),panel:j({},fT,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}=MC(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&&TC(e,c,i)}else e.AABBBounds.width()>r&&TC(e,r,i)}else o>a.x&&h.x2>n.x2?(TC(e,n.x2-o,i),r&&wC(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}}EC.defaultAttributes=mT,G(EC,kC);const BC=t=>t.map(((t,e)=>({index:e,value:t}))),PC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},LC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=CM(a),_=t.range();let y=[];for(let i=0;i{IC[t]=!0}));const HC=t=>-Math.log(-t),VC=t=>-Math.exp(-t),NC=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,UC=t=>10===t?NC:t===Math.E?Math.exp:e=>Math.pow(t,e),WC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),GC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),YC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function $C(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 XC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function KC(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function qC(t,e,i,s){return 1===i&&(i=0),KC(t,i,s)*(e/(1-i))}function ZC(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function JC(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]{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 tE{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=ZC(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=mt(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 eE=Symbol("implicit");class iE extends tE{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=OC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=eE}clone(){const t=(new iE).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!==eE)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 sE(t,e,r,n)}class rE extends iE{constructor(t){super(),this.type=OC.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=qC(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:nE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=10){return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return nE(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 rE(!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:aE}=si;function oE(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=ti.parseColorString(e)){const e=aE(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?aE(t,e):e instanceof ti?aE(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 lE extends tE{constructor(t=jC,e=jC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=jC,this._piecewise=XC,this._interpolate=oE}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=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=_t(i[0],i[r-1])),this._piecewise=r>2?JC:XC,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:jC),this.rescale(i)):this._clamp!==jC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=10){const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return 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 hE=Math.sqrt(50),cE=Math.sqrt(10),dE=Math.sqrt(2),uE=[1,2,5,10],pE=(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=vE(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?fE(0,-(e-1)/s,s):fE((e-1)/s,0,s)},gE=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 pE(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return pE(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=fE(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=fE(t,e,l);return n&&r.reverse(),r})),vE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=uE[0];return i>=hE?s=uE[3]:i>=cE?s=uE[2]:i>=dE&&(s=uE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function _E(t,e,i){const s=(e-t)/Math.max(0,i);return vE(s)}function yE(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;e0;){if(s=_E(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function xE(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 SE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),AE=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})),kE=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=mE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?SE(t,e,n):SE(t,e,QC(n)),h=SE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),ME=ft(((t,e,i,s,n)=>yE(s(t),s(e),i).map((t=>QC(n(t))))));class TE extends lE{constructor(){super(...arguments),this.type=OC.Linear}clone(){var t;const e=new TE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return gE(i[0],i[i.length-1],t,e)}ticks(t=10,e){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=mE(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(t=10){const e=this.calculateVisibleDomain(this._range);return yE(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(;++r{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"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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 CE(t){return e=>-t(-e)}function EE(t=Number.EPSILON){return e=>Math.max(e,t)}class BE extends lE{constructor(){super(WC(10),UC(10)),this.type=OC.Log,this._limit=EE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new BE).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=WC(this._base),s=UC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=CE(i),this._pows=CE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=HC,this.untransformer=VC):(this._logs=i,this._pows=s,this._limit=EE(),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 jC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return AE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(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))))}}}G(BE,wE);class PE extends TE{constructor(){super(GC(1),YC(1)),this.type=OC.Symlog,this._const=1}clone(){return(new PE).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=GC(t),this.untransformer=YC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return AE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return kE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ME(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(PE,wE);class LE{constructor(){this.type=OC.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)&&k(+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 LE).domain(this._domain).range(this._range).unknown(this._unknown)}}function RE(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 OE(t,e,i,s,n=!1){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,n,r;if(!DC(t.type))return BC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return BC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=RE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=RE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=RE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=RC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=RC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?DE.greedy:DE.parity;for(;l.length>=3&&wT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;TT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),OE(t,l,a,(e=>TT(e,t,i))),OE(n,l,o,(e=>TT(e,n,i)||!(!a||e===t)&&TT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return BC(m)},DE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&TT(i,t,e)||(i=t,0))))}},FE=(t,e,i,s)=>{const n=RC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},zE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,jE=(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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?BC([s[s.length-1]]):BC([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:f,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(g),a=X(g);if(s.length<=f/n){const i=FE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=VE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=FE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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&&!zE(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?jE(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=CM(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),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=ST(r,AT(s,r,e,n));return o=a,l=AT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.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 BC(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=NE(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=WE(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 BC(c)},WE=(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&&PC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},GE=new Uint32Array(33),YE=new Uint32Array(33);YE[0]=0,GE[0]=~YE[0];for(let t=1;t<=32;++t)YE[t]=YE[t-1]<<1|1,GE[t]=~YE[t];function $E(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&GE[31&o]&YE[1+(31&l)])return!0}else{if(i[h]&GE[31&o])return!0;if(i[c]&YE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,GE[31&o]&YE[1+(31&l)]);else for(s(h,GE[31&o]),s(c,YE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,YE[31&a]|GE[1+(31&o)]);else for(n(l,YE[31&a]),n(h,GE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 XE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function KE(t,e,i=!1){return i?XE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function qE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=KE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=XE(t,r)),e.getRange(r)))}function ZE(t,e,i,s=[],n=!0,r=0,a=!1){const o=s.filter((t=>p(t)));for(let s=0;sa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return ZE(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 ZE(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 ZE(t,e,n,s,h,c)}return!1}const QE=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],tB=["top","inside-top","inside"];function eB(t,e,i,s={}){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=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const iB={mode:"same-time",duration:300,easing:"linear"};function sB(t){return 3===t||4===t}function nB(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 rB=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 aB(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)}}var oB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const cB=(t,e)=>Math.ceil(t)>Math.floor(e),dB=([t,e],[i,s])=>s>t&&e>i;function uB(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 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);n{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(sM.hover,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(gM(this,(t=>{P(t.states)||(t.removeState(sM.hoverReverse),t.removeState(sM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void gM(this,(t=>{P(t.states)||(t.removeState(sM.selectedReverse),t.removeState(sM.selected))}));P(e.states)||(e.addState(sM.selected,!0),gM(this,(t=>{t===e||P(t.states)||t.addState(sM.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)===Go.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Go.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(xe(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[aB(g,f,c,d,a,o),aB(-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=lf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new jl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(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 t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o),d(r)?o=r(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):!1!==e&&(o=this._overlapping(o)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return LM(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;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}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&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)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&&cB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&cB(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(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(uB([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])&&!dB([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 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},h),{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(KE(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(KE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(KE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_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;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_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",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{fB[t]=e};var vB=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{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,i,s)}}_B.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const yB=()=>{mB("symbol",_B),mB("line-data",_B)};var bB=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{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}}}xB.tag="rect-label",xB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var SB=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{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,i="end",s=0){return function(t,e,i="end",s=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,i,s)}};AB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const kB=()=>{mB("line",AB),mB("area",AB)};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);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,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=pe(h.endAngle-u/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new TB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):sB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));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,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(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=sB(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=sB(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;k(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=sB(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 _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?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?sB(t.quadrant)?"left":"right":sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;k(c)?t.pointB={x:s.x+c*(sB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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 BB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 PB(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=MT(t,!!n),o=MT(r,!!n);const h=ne.distancePP(s,l),c=ne.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=BB(e,t,!1,!!n),o=BB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=MT(t,!!n),o=MT(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}EB.defaultAttributes={pickable:!1};class LB extends Ky{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&xT(this._innerView),this.removeAllChild(!0),this._innerView=lf.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 ST(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?`${pT.grid}-sub`:`${pT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=MT(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BB(t,o,!1,!!a)}const u=lf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:LB.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=MT(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=lf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:LB.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}}LB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Ok(),Hk();class RB extends LB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},LB.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=tM,endAngle:r=eM}=this.attribute;i=kT(t,s,ne.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=j({},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})}}G(RB,GT);var OB=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"})}}G(IB,kC);const DB="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",FB={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:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:DB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zB={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 jB;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={}));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);nt,this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this._clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t);const i="browser"===y_.env?y_:this.stage,s=oM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{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===jB.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===jB.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=jB.endHandler):h+=l:this._activeTag===jB.endHandler&&(c+l{const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===jB.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),this._dispatchEvent("change",{start:this.state.start,end:this.state.end,tag:this._activeTag}),this._clearDragEvents()};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))),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave)),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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}))}_clearDragEvents(){const t="browser"===y_.env?y_:this.stage,e=oM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){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:mt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===jB.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:mt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===jB.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=HB(c,["formatMethod"]),{formatMethod:g}=d,f=HB(d,["formatMethod"]),{start:m,end:v}=this.state;this._startValue=this._statePointToData(m),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,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:this.isTextOverflow(A,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"},w={textAlign:this.isTextOverflow(A,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={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(A,t,"start")?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(A,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`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 je).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;if(this._isHorizontal){const i=Math.abs(e.y1-e.y2);this._startText.setAttribute("dy",o+t*(Number.isFinite(i)?i:0))}else{const i=Math.abs(e.x1-e.x2);this._startText.setAttribute("dx",a+t*(Number.isFinite(i)?i:0))}}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,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(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,m+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:m,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:I,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:z={},middleHandlerStyle:j={},startHandlerStyle:H={},endHandlerStyle:V={},brushSelect:N,zoomLock:U}=this.attribute,{start:W,end:G}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=V.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:N?"crosshair":"auto"},I),{pickable:!U&&(null===(i=I.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),N&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(G-W)*$,height:X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(r=z.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:(G-W)*X,cursor:N?"crosshair":"move"},F),{pickable:!U&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=z.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=z.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(j.visible){const t=(null===(h=j.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:(G-W)*$,height:t},null===(c=j.background)||void 0===c?void 0:c.style),{pickable:!U&&(null===(p=null===(u=null===(d=j.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+G)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(f=null===(g=j.icon)||void 0===g?void 0:g.symbolType)&&void 0!==f?f:"square"},j.icon),{pickable:!U&&(null===(m=j.icon.pickable)||void 0===m||m)}),"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"},zB.horizontal),H),{pickable:!U&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+G*$,y:Y.y+X/2,size:X,symbolType:null!==(y=V.symbolType)&&void 0!==y?y:"square"},zB.horizontal),V),{pickable:!U&&(null===(b=V.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},zB.horizontal),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+G*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zB.horizontal),{pickable:!U}),"rect")}else{if(j.visible){const t=(null===(x=j.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:(G-W)*X},null===(S=j.background)||void 0===S?void 0:S.style),{pickable:!U&&(null===(M=null===(k=null===(A=j.background)||void 0===A?void 0:A.style)||void 0===k?void 0:k.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+G)/2*X,angle:Math.PI/180*90,symbolType:null!==(w=null===(T=j.icon)||void 0===T?void 0:T.symbolType)&&void 0!==w?w:"square",strokeBoundsBuffer:0},j.icon),{pickable:!U&&(null===(E=null===(C=j.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!==(B=H.symbolType)&&void 0!==B?B:"square"},zB.vertical),H),{pickable:!U&&(null===(P=H.pickable)||void 0===P||P)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+G*X,size:$,symbolType:null!==(L=V.symbolType)&&void 0!==L?L:"square"},zB.vertical),V),{pickable:!U&&(null===(R=V.pickable)||void 0===R||R)}),"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},zB.vertical),{pickable:!U}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+G*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zB.vertical),{pickable:!U}),"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 jM(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)}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};var UB,WB,GB,YB;function $B(){Ok(),FM(),_w()}NB.defaultAttributes=FB,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"}(UB||(UB={})),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"}(WB||(WB={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(GB||(GB={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(YB||(YB={}));class XB extends Ky{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=CT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=ET(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=BT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=lf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=lf.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=lf.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 KB(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 qB(t,e,i,s){t&&(KB(t.startSymbol,e,i,s),t.lines.forEach((t=>KB(t,e,i,s))),KB(t.line,e,i,s),KB(t.endSymbol,e,i,s))}function ZB(t,e,i,s){t&&(KB(t.getTextShape(),e,i,s),KB(t.getBgRect(),e,i,s))}function JB(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 QB(t,e,i,s){t&&(JB(t.startSymbol,e,i,s),t.lines.forEach((t=>JB(t,e,i,s))),JB(t.line,e,i,s),JB(t.endSymbol,e,i,s))}function tP(t,e,i,s){t&&(JB(t.getTextShape(),e,i,s),JB(t.getBgRect(),e,i,s))}function eP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;KB(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)})),KB(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;KB(t.getTextShape(),e,l,n),KB(t.getBgRect(),e,l,n)}))}function iP(t,e,i,s,n){qB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function sP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function nP(t,e,i,s,n){KB(t,s,i,n),Y(e).forEach((t=>{ZB(t,s,i,n)}))}function rP(t,e,i,s,n,r){var a;qB(t,n,s,r),KB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?ZB(i,n,s,r):KB(i,n,s,r)}function aP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;KB(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)})),KB(e,n+o+l,h,r),KB(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(KB(i.getTextShape(),n+o+l+h+c,d,r),KB(i.getBgRect(),n+o+l+c,d,r)):KB(i,n+o+l+c,d,r)}function oP(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?eP(t,e,s,r,a):"fadeIn"===i&&iP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?eP(t,e,s,n,a):"fadeIn"===i&&iP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function lP(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&&sP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&sP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function hP(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&&nP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){JB(t,s,i,n),Y(e).forEach((t=>{tP(t,s,i,n)}))}(t,e,i,s,n)}}function cP(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?rP(n,r,e,i,s,o):"callIn"===t&&aP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?rP(n,r,e,i,s,a):"callIn"===t&&aP(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;QB(t,n,s,r),JB(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?tP(i,n,s,r):JB(i,n,s,r)}(n,r,e,t,i,s)}}const dP={type:"clipIn",duration:500,easing:"linear",delay:0},uP={type:"fadeIn",duration:500,easing:"linear",delay:0},pP={type:"callIn",duration:500,easing:"linear",delay:0},gP={type:"fadeOut",duration:500,easing:"linear",delay:0};class fP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new jM(Object.assign(Object.assign({},h),{state:{panel:j({},nM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},nM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},nM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},nM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class mP extends XB{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=dP,this.defaultExitAnimation=gP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;DM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(mP,fP);const vP=.001,_P={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:UB.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]}},yP={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"}}},bP={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:{autoRotate:!0,position:GB.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]}},xP={interactive:!0,label:{position:WB.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}},SP={interactive:!0,label:{autoRotate:!0,position:GB.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}},AP={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"}},kP={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"}},MP={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 TP(){wP._animate=oP}$B(),hT(),_w();class wP extends mP{markerAnimate(t){wP._animate&&this._animationConfig&&wP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},wP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(mM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return vM(Math.abs(e),Math.PI/2,vP)||vM(Math.abs(e),3*Math.PI/2,vP)?_M(i,e,t):mM(e)?yP.postiveXAxis[t]:yP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new dT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==a?void 0:a.line),startSymbol:j({},nM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},nM,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=>{k(t.x)&&k(t.y)||(e=!1)}));else if(!k(t.x)||!k(t.y))return void(e=!1)})),e}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",wP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(wP.defaultAttributes.label)}}function CP(){EP._animate=lP}wP.defaultAttributes=_P,$B(),Nk(),_w();class EP extends XB{markerAnimate(t){EP._animate&&this._animationConfig&&EP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},EP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},kP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=lf.polygon(Object.assign({points:e},i));n.states=j({},nM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",EP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},nM,null==i?void 0:i.area)),this._updateMarkLabels(EP.defaultAttributes.label)}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{k(t.x)&&k(t.y)||(e=!1)})),e}}EP.defaultAttributes=xP,G(EP,fP),$B(),cT(),_w();class BP extends mP{markerAnimate(t){BP._animate&&this._animationConfig&&BP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},BP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case GB.arcInnerStart:l=n;case GB.arcOuterStart:l=n;break;case GB.arcInnerEnd:l=r;case GB.arcOuterEnd:l=r;break;case GB.center:case GB.arcInnerMiddle:case GB.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return AP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new uT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,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:j({},nM,null==o?void 0:o.line),startSymbol:j({},nM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},nM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",BP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(BP.defaultAttributes.label)}}BP.defaultAttributes=bP,$B(),Tk(),_w();class PP extends XB{markerAnimate(t){PP._animate&&this._animationConfig&&PP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},PP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=uP,this.defaultExitAnimation=gP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case GB.center:h=(s+n)/2,c=(r+a)/2;break;case GB.arcInnerStart:h=s,c=r;break;case GB.arcOuterStart:h=n,c=r;break;case GB.arcInnerEnd:h=s,c=a;break;case GB.arcOuterEnd:h=n,c=a;break;case GB.arcInnerMiddle:h=s,c=(r+a)/2;break;case GB.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},AP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;DM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=lf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},nM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",PP.defaultAttributes.label)}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=j({},nM,null==o?void 0:o.area)),this._updateMarkLabels(PP.defaultAttributes.label)}isValidPoints(){return!0}}function LP(){RP._animate=cP}PP.defaultAttributes=SP,G(PP,fP),$B(),hT(),cT(),qk(),Dk(),zk(),_w();class RP extends XB{markerAnimate(t){RP._animate&&this._animationConfig&&RP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},RP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=pP,this.defaultExitAnimation=gP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return vM(Math.abs(s),Math.PI/2,vP)||vM(Math.abs(s),3*Math.PI/2,vP)?_M(t,s,n):mM(s)?MP.postiveXAxis[n]:MP.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,style:d,position:u=YB.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},nM,null==p?void 0:p.textBackground),text:j({},nM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},nM,null==p?void 0:p.itemContent));const v=mM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=lf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"text"===n?o=new jM(Object.assign(Object.assign({},i),{state:{panel:j({},nM,null==s?void 0:s.textBackground),text:j({},nM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=lf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"image"===n?(o=lf.image(Object.assign(Object.assign({},i),r)),o.states=j({},nM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},nM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=vM(c,0,vP)||vM(d,0,vP),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=OM(e-u,t-d),o=OM(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(NP.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(NP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===NP.focus||"focus"===o){const s=a.hasState(HP.focus);a.toggleState(HP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover,HP.focus],t),this._setLegendItemState(e,HP.selected,t)})):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover,HP.focus],t),this._setLegendItemState(e,HP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(VP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HP.selected,HP.selectedHover],t),this._setLegendItemState(a,HP.unSelected,t)):(this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t))}else this._setLegendItemState(a,HP.selected,t),this._removeLegendItemState(a,[HP.unSelected,HP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HP.selected,HP.selectedHover],t),this._setLegendItemState(e,HP.unSelected,t))}))}this._dispatchLegendEvent(VP.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,HP.selected),this._removeLegendItemState(e,[HP.unSelected,HP.unSelectedHover])):(this._removeLegendItemState(e,[HP.selected,HP.selectedHover]),this._setLegendItemState(e,HP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FP,spaceRow:l=zP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=lf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(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:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(_,t,e,i,s),k=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),T=ni(c);let w;!1===x.visible?(w=lf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,NP.item,t,w)):(w=lf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,NP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?HP.selected:HP.unSelected);const C=lf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=lf.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,NP.itemShape,t,w,S.state),s.addState(e?HP.selected:HP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=lf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,NP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=LM(Object.assign(Object.assign({x:P/2+R,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:I,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,NP.itemLabel,t,w,A.state),D.addState(e?HP.selected:HP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=LM(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,NP.itemValue,t,w,k.state),r.addState(e?HP.selected:HP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[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));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],N=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=V,w.attribute.height=N,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_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 DP(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 DP(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 hM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new hM(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()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FP,spaceRow:o=zP}=n,l=this._itemsContainer,{space:h=jP,defaultCurrent:c=1}=r,d=YP(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=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;v0&&(y=0,b+=s+o,x+=1),e>0&&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,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),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));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=lf.group({x:0,y:t,width:u?v:f,height:u?m:_,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()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FP,spaceRow:a=zP}=s,o=this._itemsContainer,{space:l=jP,defaultCurrent:h=1}=n,c=YP(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 _=lf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),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=lf.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(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(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(HP.selected)?this._setLegendItemState(t,HP.selectedHover,e):this._setLegendItemState(t,HP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===NP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(VP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HP.unSelectedHover)||t.hasState(HP.selectedHover))&&(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HP.unSelectedHover)&&!t.hasState(HP.selectedHover)||(i=!0),t.removeState(HP.unSelectedHover),t.removeState(HP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===NP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(VP.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!==NP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(VP.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!==NP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(VP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},$P,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(HP.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 KP;function qP(t){return y(t)?t:[t,t]}function ZP(t){return t?"ew-resize":"ns-resize"}XP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FP,spaceRow:zP,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:jP,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"}(KP||(KP={})),WP();class JP extends Ky{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:j({},JP.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===y_.env?y_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=oM(),n="browser"===y_.env?y_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:qP(d)[0],endValue:qP(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=lf.group({x:0,y:0});f.name=KP.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=lf.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)),m.name=KP.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=lf.group({x:g?v:0,y:g?0:v});f.add(_);const y=lf.group({x:0,y:0});let b;if(y.name=KP.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=lf.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=KP.endText,f.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=lf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KP.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,f]=qP(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(v.name=KP.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KP.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZP(p)},r));if(i.name=KP.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=KP.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=mt(h,i,s);const p=this._isHorizontal;e||(c=i);const f=lf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=KP.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":ZP(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=lf.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=KP.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return lf.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":ZP(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),lf.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=lf.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=lf.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),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=oM(),e="browser"===y_.env?y_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===KP.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===KP.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===KP.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KP.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}}release(t){super.release(t),("browser"===y_.env?y_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}JP.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}}},GP(),WP();class QP extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},QP.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tL(t="bottom"){let 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`}QP.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"}}},GP(),WP(),Hk();class eL extends UP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=lf.group({x:0,y:0});this._innerView.add(x);const S=new JP({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:tL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let A,k=0;"horizontal"===e?"top"===i?(A=`M0,0L${a},0L${b?0:a},12Z`,k=o):(A=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?A=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(A=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=lf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,T-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eL.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)"}},Ok(),Jk(),Yk();let iL=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},rM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},rM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};iL.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 sL={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"}}};Ok(),Jk(),Yk();let nL=class extends Ky{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(sL,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=LM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(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=EM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),b=(y-c)/h.length;k(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 rL extends Ag{constructor(t){super(t)}}var aL,oL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aL||(aL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oL||(oL={}));class lL extends Ky{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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"},lL.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"},lL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lL.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 rL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rL(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(aL.OnPlay)},this.pause=()=>{this._dispatchEvent(aL.OnPause)},this.forward=()=>{this._dispatchEvent(aL.OnForward)},this.backward=()=>{this._dispatchEvent(aL.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()}}lL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lL.defaultAttributes={[oL.Start]:{},[oL.Pause]:{},[oL.Backward]:{},[oL.Forward]:{}};const hL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cL=[200,10];var dL,uL;!function(t){t.Default="default",t.Reverse="reverse"}(dL||(dL={})),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"}(uL||(uL={}));const pL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),gL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===dL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===dL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),fL=t=>"top"===t||"bottom"===t;class mL extends Ky{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;k(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Wt(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:k(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(fL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cL[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:cL[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 JP(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=fL(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 lL(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=fL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Wt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(fL(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:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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:fL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:fL(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:Wt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:fL(this._orient)?t+s:(this._size.width-r)/2,y:fL(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 vL(){WP(),Ok(),qk()}mL.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({},hL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hL),{key:"backward",position:"start"})}},vL();class _L extends mL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:dL.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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=y_.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(uL.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(uL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=y_.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(),y_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.change),this.dispatchCustomEvent(uL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yL,bL=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())}))};vL();class xL extends mL{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(aL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aL.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(uL.change))},this.play=()=>bL(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(uL.play),this._rafId=y_.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=y_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,y_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uL.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(uL.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(uL.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.brushActive="brushActive",t.brushClear="brushClear"}(yL||(yL={}));const SL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},AL=5;const kL={debounce:bt,throttle:xt};Ok(),Nk();let ML=class t extends Ky{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{const{updateTrigger:e=SL.updateTrigger,endTrigger:i=SL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t)))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:kL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1},this._onBrushClear=t=>{t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=SL.trigger,resetTrigger:e=SL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(yL.drawStart,t),this._activeBrushState=!1}_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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(yL.moveStart,t)}_drawing(t){var e;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=AL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(yL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(yL.brushActive,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._dispatchBrushEvent(yL.moving,t)}_drawEnd(t){const{removeOnClick:e=!0,sizeThreshold:i=AL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(yL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=SL.updateTrigger,endTrigger:e=SL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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}]:I(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=lf.polygon(Object.assign(Object.assign({points:I(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}_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(Be(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};ML.defaultAttributes=SL;const TL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},wL=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}},CL={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:iM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:iM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Ok(),Wk(),qk(),Jk(),Yk();let BL=class t extends Ky{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=ni(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:fM(u)&&fM(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:fM(u)&&fM(u.value)},wL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:fM(u)&&fM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:fM(u)&&fM(u.value)},wL(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},rM),u.value),visible:fM(u)&&fM(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=fM(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 _=fM(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(!fM(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)+(fM(n.key)?r+n.key.spacing:0)+(fM(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&&(RM(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:fM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),RM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(fM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ed(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(fM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},wL(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},wL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},rM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(fM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},wL(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},wL(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=>EL.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)&&fM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=fM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=CM(d),_=CM(u);let y=0;if(fM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(fM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&ru[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 TL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return TL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};BL.defaultAttributes=CL;const PL=ut;function LL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function RL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function OL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function IL(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;k(n)&&(i+=n,s++)}));return i/s}function DL(t,e){const i=IL(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 FL(t,e){const i=zL(t),s=zL(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 zL(t,e={x:0,y:0}){return ne.distancePP(t,e)}function jL(t){return k(t.x)&&k(t.y)}function HL(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 VL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const NL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function WL(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&WL(t[i],e)}}var GL,YL,$L;function XL(t){var e,i;const{type:s}=t;return s===YL.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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(GL||(GL={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic",t.pictogram="pictogram"}(YL||(YL={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.transform="transform",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}($L||($L={}));const KL={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},qL={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function ZL(t,e){var i;if(!t)return[];const s=nR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?iR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>eR(i)?QL(t,i,e):i)).filter(p)}))):i.map((i=>eR(i)?QL(t,i,e):i)).filter(p):[]}return[]}function JL(t,e){var i,s;return iR(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 QL(t,e,i){var s;const n=nR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=KL[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=qL[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 ti(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=We(n,r,e.l),l=new ti(`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 tR=(t,e)=>{if(e&&eR(t)){const i=QL(e,t);if(i)return i}return t};function eR(t){return t&&"palette"===t.type&&!!t.key}function iR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function sR(t){return y(t)?{dataScheme:t}:t}function nR(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=XL(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 rR extends iE{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(!iR(this._range))return void super.range(this._range);const t=JL(this._range,this._domain);super.range(t)}}const aR={linear:TE,band:rE,point:class extends rE{constructor(t){super(!1),this.type=OC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:iE,threshold:LE,colorOrdinal:rR};function oR(t){const e=aR[t];return e?new e:null}function lR(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 hR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function cR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function dR(t){return!!_(t)&&(!!t.endsWith("%")&&Yy(t.substring(0,t.length-1)))}function uR(t){return!!g(t)&&("percent"in t||"offset"in t)}function pR(t,e,i,s=0){var n,r;return S(t)?t:dR(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 gR(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]=pR(t[s],e.size,i)}))})),o}function fR(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}}function mR(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)||dR(t)||d(t)||uR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function vR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const _R=(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},yR=[{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"]}];function bR(t,e){return t&&e.key in t?t[e.key]:e.default}function xR(t){return t&&"token"===t.type&&!!t.key}const SR={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%"},AR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:yR,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"}}},token:SR,component:{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}}},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}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},kR={name:"dark",colorScheme:{default:{dataScheme:yR,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}}}}}},MR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>MR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>MR(t[i],e[i])))),TR=(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]={}),TR(t[s],e.slice(1),i))},wR=t=>t instanceof Ta||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 CR(t,e=["data"]){return I(t,wR,e)}function ER(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=sR(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)})}BR._charts={},BR._series={},BR._components={},BR._graphicComponents={},BR._marks={},BR._regions={},BR._animations={},BR._implements={},BR._chartPlugin={},BR._vChartPlugin={},BR._componentPlugin={},BR.transforms={fields:Gr,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}},BR.dataParser={csv:(t,e={},i)=>(i.type=Wr.DSV,Qr(t)),dsv:(t,e={},i)=>{i.type=Wr.DSV;const s=jr(ea,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return Jr(n).parse(t)},tsv:(t,e={},i)=>(i.type=Wr.DSV,ta(t))},BR._layout={},BR._grammarTransforms={},BR._stageEventPlugins={},BR.registerStageEventPlugin=(t,e)=>{BR._stageEventPlugins[t]=e},BR.getStageEventPlugin=t=>BR._stageEventPlugins[t],BR._interactionTriggers={},BR.registerInteractionTrigger=(t,e)=>{BR._interactionTriggers[t]=e},BR._composedEventMap={},BR.registerComposedEvent=(t,e)=>{BR._composedEventMap[t]=e},BR._tooltipProcessors={},BR.registerTooltipProcessor=(t,e)=>{BR._tooltipProcessors[t]=e},BR.createTooltipProcessor=(t,e)=>{const i=BR._tooltipProcessors[t];return i?new i(e):null};const RR=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},OR=RR(),IR={[AR.name]:AR},DR=AR.name,FR=new Map(Object.keys(IR).map((t=>[t,IR[t]]))),zR=new Map,jR=new Map(Object.keys(IR).map((t=>[t,t===DR]))),HR=(t,e)=>{if(!t)return;const i=WR(e);FR.set(t,i),jR.set(t,!0)},VR=(t=DR)=>(jR.has(t)&&!jR.get(t)&&HR(t,FR.get(t)),FR.get(t)),NR=t=>FR.delete(t)&&zR.delete(t)&&jR.delete(t),UR=t=>!!_(t)&&FR.has(t),WR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:DR;return PR({},VR(i),t)};class GR{static registerInstance(t){GR.instances.set(t.id,t)}static unregisterInstance(t){GR.instances.delete(t.id)}static getInstance(t){return GR.instances.get(t)}static instanceExist(t){return GR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return GR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}GR.instances=new Map;class YR{static registerTheme(t,e){HR(t,e)}static getTheme(t,e=!1){return VR(t)}static removeTheme(t){return NR(t)}static themeExist(t){return UR(t)}static getDefaultTheme(){return YR.themes.get(DR)}static setCurrentTheme(t){YR.themeExist(t)&&(YR._currentThemeName=t,GR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return YR.getTheme(YR._currentThemeName,t)}static getCurrentThemeName(){return YR._currentThemeName}}function $R(t){return _(t)?YR.themeExist(t)?YR.getTheme(t):{}:g(t)?t:{}}YR.themes=FR,YR._currentThemeName=DR;const XR=["animationThreshold","colorScheme","name","padding"];function KR(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];XR.includes(n)?s[n]=r:m(r)?eR(r)?s[n]=tR(r,e):xR(r)?s[n]=bR(i,r):s[n]=KR(r,e,i):s[n]=r})),s}function qR(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]=qR(t[s],e)}return i}return y(t)?t.map((t=>qR(t,e))):t}function ZR(t,e){if(!t)return t;if(m(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]=ZR(t[s],e)}return i}return y(t)?t.map((t=>ZR(t,e))):t}const JR=(t,e,i,s)=>((t,e,i)=>CM(t,e,i,{fontFamily:SR.fontFamily,fontSize:SR.fontSize}))(e,i,s).measure(t),QR="__VCHART",tO=500,eO=500,iO=`${QR}_MEASURE_CANVAS_ID`,sO=`${QR}_DEFAULT_DATA_INDEX`,nO=`${QR}_DEFAULT_DATA_KEY`,rO=`${QR}_DEFAULT_DATA_SERIES_FIELD`,aO=`${QR}_DEFAULT_SERIES_STYLE_NAME`,oO=`${QR}_STACK_KEY`,lO=`${QR}_STACK_START`,hO=`${QR}_STACK_END`,cO=`${QR}_STACK_START_PERCENT`,dO=`${QR}_STACK_END_PERCENT`,uO=`${QR}_STACK_START_OffsetSilhouette`,pO=`${QR}_STACK_END_OffsetSilhouette`,gO=`${QR}_STACK_TOTAL`,fO=`${QR}_STACK_TOTAL_PERCENT`,mO=`${QR}_STACK_TOTAL_TOP`,vO=`${QR}_STACK_TOTAL_BOTTOM`,_O=`${QR}_MOSAIC_VALUE_START_PERCENT`,yO=`${QR}_MOSAIC_VALUE_END_PERCENT`,bO=`${QR}_MOSAIC_CAT_START_PERCENT`,xO=`${QR}_MOSAIC_CAT_END_PERCENT`,SO=`${QR}_SEGMENT_START`,AO=`${QR}_SEGMENT_END`,kO=`${QR}_KEY`;function MO(t,e){for(let i=0;it.key===e))}function wO(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 CO(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:{}},RO(t,a,n[o],l,e,r))})),s?EO(n):n}function EO(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))):EO(t[e].nodes);return t}function BO(t,e){if("values"in t&&t.values.length){const i=OL(t.values,e),s=RL(t.values,dO);t.values.forEach((t=>{t[gO]=i,t[fO]=s}))}else for(const i in t.nodes)BO(t.nodes[i],e)}function PO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][hO]/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)LO(t.nodes[r],e,i,s,n)}function RO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[hO]=function(t){if(k(t))return t;const e=+t;return k(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)),RO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const OO=(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 FO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>HO(t.style(e,i,s,n)):P(t.style)||(e.style=HO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>HO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=HO(t.state[e]))})),e.state=i}return e}function zO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>HO(t[i](e,s,n,r)):P(t[i])||(e[i]=HO(t[i]))})),e}function jO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),HO(i)}function HO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const VO=t=>"line"===t||"area"===t,NO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return VO(i)?e:null==e?void 0:e[0]},UO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let WO=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},n=BR.getComposedEvent(t);if(n){const e=new n(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(BR.getComposedEvent(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()}};var GO;!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"}(GO||(GO={}));const YO=["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 $O,XO,KO;t.ChartEvent=void 0,($O=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",$O.rendered="rendered",$O.renderFinished="renderFinished",$O.animationFinished="animationFinished",$O.regionSeriesDataFilterOver="regionSeriesDataFilterOver",$O.afterInitData="afterInitData",$O.afterInitEvent="afterInitEvent",$O.afterInitMark="afterInitMark",$O.rawDataUpdate="rawDataUpdate",$O.viewDataFilterOver="viewDataFilterOver",$O.viewDataUpdate="viewDataUpdate",$O.viewDataStatisticsUpdate="viewDataStatisticsUpdate",$O.markDeltaYUpdate="markDeltaYUpdate",$O.viewDataLabelUpdate="viewDataLabelUpdate",$O.scaleDomainUpdate="scaleDomainUpdate",$O.scaleUpdate="scaleUpdate",$O.dataZoomChange="dataZoomChange",$O.drill="drill",$O.layoutStart="layoutStart",$O.layoutEnd="layoutEnd",$O.layoutRectUpdate="layoutRectUpdate",$O.playerPlay="playerPlay",$O.playerPause="playerPause",$O.playerEnd="playerEnd",$O.playerChange="playerChange",$O.playerForward="playerForward",$O.playerBackward="playerBackward",$O.scrollBarChange="scrollBarChange",$O.brushStart="brushStart",$O.brushChange="brushChange",$O.brushEnd="brushEnd",$O.brushClear="brushClear",$O.brushActive="brushActive",$O.legendSelectedDataChange="legendSelectedDataChange",$O.legendFilter="legendFilter",$O.legendItemClick="legendItemClick",$O.legendItemHover="legendItemHover",$O.legendItemUnHover="legendItemUnHover",$O.tooltipShow="tooltipShow",$O.tooltipHide="tooltipHide",$O.tooltipRelease="tooltipRelease",$O.afterResize="afterResize",$O.afterRender="afterRender",$O.afterLayout="afterLayout",$O.afterMarkLayoutEnd="afterMarkLayoutEnd",$O.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(XO||(XO={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(KO||(KO={}));const qO=[KO.mark,KO.model,KO.chart,KO.vchart];class ZO{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(KO.vchart,[]),this._levelNodes.set(KO.chart,[]),this._levelNodes.set(KO.model,[]),this._levelNodes.set(KO.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 JO={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 QO{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>NO(t)))};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)||XO.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||XO.chart);o.get(t)||o.set(t,new ZO);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)||XO.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||XO.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)||XO.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||XO.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?qO.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[XO.chart,XO.window,XO.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&&L(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 JO[a]&&(a=JO[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)))}_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,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?KO.model:KO.vchart:KO.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=XO.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!==KO.model&&s!==KO.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=KO.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 XO.chart:return this._viewBubbles;case XO.window:return this._windowBubbles;case XO.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case XO.chart:return this._viewListeners;case XO.window:return this._windowListeners;case XO.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return YO.includes(t)||Object.values(GO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&BR.hasInteractionTrigger(e)}}function tI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function eI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const iI=new Map;let sI;function nI(){sI||(sI=new Ma,eI(sI,"geojson",ya),eI(sI,"topojson",xa),tI(sI,"simplify",Ur))}function rI(t,e,i={type:"geojson",centroid:!0}){iI.has(t)&&Dy(`map type of '${t}' already exists, will be overwritten.`),nI();const s=new Ta(sI),n=j({},{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}),iI.set(t,s)}function aI(t){iI.has(t)?iI.delete(t):Dy(`map type of '${t}' does not exists.`)}function oI(t,e=!1){let i=e;return t.latestData instanceof Ta&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const lI=(t,e)=>0===t.length?[]:1===t.length?oI(t[0],null==e?void 0:e.deep):t.map((t=>oI(t,null==e?void 0:e.deep)));function hI(e,i,s){tI(i=i instanceof Ma?i:e.dataSet,"copyDataView",lI);const n=new Ta(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function cI(t,e,i=[]){var s;if(t instanceof Ta)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(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 Ta(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Dy(`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 Dy(`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([]),Dy("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 dI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var uI,pI,gI,fI;t.TransformLevel=void 0,(uI=t.TransformLevel||(t.TransformLevel={}))[uI.copyDataView=-10]="copyDataView",uI[uI.treemapFilter=-8]="treemapFilter",uI[uI.treemapFlatten=-7]="treemapFlatten",uI[uI.dotObjFlat=-7]="dotObjFlat",uI[uI.linkDotInfo=-7]="linkDotInfo",uI[uI.sankeyLayout=-7]="sankeyLayout",uI[uI.dataZoomFilter=-6]="dataZoomFilter",uI[uI.legendFilter=-5]="legendFilter",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"}(pI||(pI={})),function(t){t.data="data",t.mark="mark"}(gI||(gI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(fI||(fI={}));const mI=["line","area","trail"];function vI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(kO,i?t.slice().sort(i):t.slice()),{keys:[kO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const _I=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function yI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{yI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function xI(t,e,i,s){const n=vI(t,(t=>i(t))),r=vI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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 SI{getRootGroup(){return this._rootGroup}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;y_.setEnv(function(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"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new R_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Cp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Ny(o))&&!1!==c&&BR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=fI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(y_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=y_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>yI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>yI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{yI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Iy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===fI.before&&(this._layoutState=fI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=fI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this._doRender(!0),this.doPreProgressive(),Iy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=bI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=xI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=xI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=vI(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=vI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===XO.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:NO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===XO.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===XO.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===XO.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===XO.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===XO.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.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{yI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=bI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Vy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return vu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{_o.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{yI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=y_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){y_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function AI(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:Fy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function kI(t){t.crosshair=Y(t.crosshair||{}).map((e=>ER({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function MI(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Vy(e.mode)){let t;t=_(h)?y_.getElementById(h):h;const{width:e,height:s}=ri(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 TI(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 wI(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}}var CI,EI,BI,PI,LI,RI;t.LayoutZIndex=void 0,(CI=t.LayoutZIndex||(t.LayoutZIndex={}))[CI.SeriesGroup=0]="SeriesGroup",CI[CI.Axis_Grid=50]="Axis_Grid",CI[CI.CrossHair_Grid=100]="CrossHair_Grid",CI[CI.Region=450]="Region",CI[CI.Mark=300]="Mark",CI[CI.Node=400]="Node",CI[CI.Axis=100]="Axis",CI[CI.MarkLine=500]="MarkLine",CI[CI.MarkArea=100]="MarkArea",CI[CI.MarkPoint=500]="MarkPoint",CI[CI.DataZoom=500]="DataZoom",CI[CI.ScrollBar=500]="ScrollBar",CI[CI.Player=500]="Player",CI[CI.Legend=500]="Legend",CI[CI.CrossHair=500]="CrossHair",CI[CI.Indicator=500]="Indicator",CI[CI.Title=500]="Title",CI[CI.Label=500]="Label",CI[CI.Brush=500]="Brush",CI[CI.CustomMark=500]="CustomMark",CI[CI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(EI=t.LayoutLevel||(t.LayoutLevel={}))[EI.Indicator=10]="Indicator",EI[EI.Region=20]="Region",EI[EI.Axis=30]="Axis",EI[EI.DataZoom=40]="DataZoom",EI[EI.Player=40]="Player",EI[EI.ScrollBar=40]="ScrollBar",EI[EI.Legend=50]="Legend",EI[EI.Title=70]="Title",EI[EI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(BI=t.AttributeLevel||(t.AttributeLevel={}))[BI.Default=0]="Default",BI[BI.Theme=1]="Theme",BI[BI.Chart=2]="Chart",BI[BI.Base_Series=3]="Base_Series",BI[BI.Series=4]="Series",BI[BI.Mark=5]="Mark",BI[BI.User_Chart=6]="User_Chart",BI[BI.User_Series=7]="User_Series",BI[BI.User_Mark=8]="User_Mark",BI[BI.User_SeriesStyle=9]="User_SeriesStyle",BI[BI.Built_In=99]="Built_In";class OI{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({},OI.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]))))}}OI.defaultMarkInfo={};class II{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class DI{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=>ER({},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 FI extends II{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=DI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new OI,this._lastLayoutRect=null,this.id=Gy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new WO(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${QR}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=BR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class zI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(e,i){var s;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=t.LayoutLevel.Region,this._willLayoutTag=!0,this._model=e,this._option=i,this.layoutLevel=i.layoutLevel,this.layoutType=i.layoutType,i.layoutOrient&&(this.layoutOrient=i.layoutOrient),this._spec=null===(s=null==e?void 0:e.getSpec)||void 0===s?void 0:s.call(e)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=gR(mR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:pR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:pR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:pR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:pR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:pR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:pR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=pR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=pR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=pR(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)),k(t.x)&&(this._layoutStartPoint.x=t.x),k(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;k(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),k(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(fR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class jI extends FI{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,this._transformLayoutPadding=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 zI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 HI extends DI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class VI extends jI{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(e,i){var s;super(e,i),this.transformerConstructor=HI,this.modelType="region",this.specKey="region",this.type=VI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,this.seriesDataFilterOver=()=>{this.event.emit(t.ChartEvent.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=e.id,this.coordinate=null!==(s=e.coordinate)&&void 0!==s?s:"cartesian"}_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 e,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((e=>{e&&(e.created(),this.setMarkStyle(e,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",t.AttributeLevel.Built_In),this._groupMark.addMark(e))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex:s});const o=null!==(n=this._spec.clip)&&void 0!==n?n:this._getClipDefaultValue();return this.setMarkStyle(a,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:o},"normal",t.AttributeLevel.Built_In),this.setMarkStyle(a,{cornerRadius:null===(r=this._spec.style)||void 0===r?void 0:r.cornerRadius},"normal",t.AttributeLevel.User_Mark),this._marks.addMark(a),a}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var e,i;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(e=this._spec.style)||void 0===e?void 0:e.fill)?1:0},this._spec.style),"normal",t.AttributeLevel.User_Mark),(null!==(i=this._spec.clip)&&void 0!==i?i:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",t.AttributeLevel.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function NI(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 UI(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 WI(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 GI(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=KI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),WI(d,!0,p,l),s&&UI(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function YI(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=KI(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=KI(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),WI(d,!1,p,o),s&&UI(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function XI(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=KI(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),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);const n={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight};this._layoutNormalItems(e,n);const r={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:a,relativeItems:o,relativeOverlapItems:l,allRelatives:h,overlapItems:c}=this._groupItems(e);this.layoutRegionItems(a,o,l,c,n),this._processAutoIndent(a,o,l,c,h,r,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r,a){if(n.some((t=>t.autoIndent))){const{top:o,bottom:l,left:h,right:c}=this._checkAutoIndent(n,r);(o||l||h||c)&&(this.topCurrent=r.top+o,this.bottomCurrent=r.bottom-l,this.leftCurrent=r.left+h,this.rightCurrent=r.right-c,this.layoutRegionItems(t,e,i,s,a))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=KI(t,this,e);"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=NI(t);n.length&&GI(n,e,i,!1,"left",s),r.length&&GI(r,e,i,!0,"left",s),a.length&&YI(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=NI(t);n.length&&$I(n,e,i,!1,"top",s),r.length&&$I(r,e,i,!0,"top",s),a.length&&XI(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=NI(t);n.length&&GI(n,e,i,!1,"right",s),r.length&&GI(r,e,i,!0,"right",s),a.length&&YI(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=NI(t);n.length&&$I(n,e,i,!1,"bottom",s),r.length&&$I(r,e,i,!0,"bottom",s),a.length&&XI(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=KI(t,this,i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{U(i.getLayoutRect(),e.rect)||i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const{rect:i}=KI(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),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}}},n){let r=this.rightCurrent-this.leftCurrent,a=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),r=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),a=this.bottomCurrent-this.topCurrent;const{regionWidth:o,regionHeight:l}=this._layoutRegionItem(t,r,a);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+o-r})}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+l-a})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:Fy)("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}}}qI.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(PI||(PI={})),t.STATE_VALUE_ENUM=void 0,(LI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",LI.STATE_HOVER="hover",LI.STATE_HOVER_REVERSE="hover_reverse",LI.STATE_DIMENSION_HOVER="dimension_hover",LI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",LI.STATE_SELECTED="selected",LI.STATE_SELECTED_REVERSE="selected_reverse",LI.STATE_SANKEY_EMPHASIS="selected",LI.STATE_SANKEY_EMPHASIS_REVERSE="blur",LI.STATE_HIGHLIGHT="highlight",LI.STATE_BLUR="blur",LI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(RI||(RI={}));const ZI=["linear","radial","conical"],JI={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const QI={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{QI[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class tD extends II{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class eD extends tD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,mI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!QI[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(QR)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.every((e=>{var i,n;return(null===(n=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===n?void 0:n[e])===(null==s?void 0:s[e])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(QR))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(DC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class iD extends II{constructor(){super(...arguments),this.id=Gy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=BR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class sD extends iD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const nD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,rD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=nD(l.delay,n,a,o),d=nD(l.duration,n,a,o),u=nD(l.oneByOne,n,a,o),p=nD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>S(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var s;const n=e.filter((t=>t&&t.toCustomPath&&t.valid));n.length||console.error(n," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(t,n.length,!1),a=null==i?void 0:i.onEnd;let o=n.length;const l=()=>{o--,0===o&&a&&a()};n.forEach(((e,s)=>{var a;const o=r[s],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(s,n.length,o,e):0);Rw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var s,n,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?Fw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:zw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ew(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Pw(t.attribute,l)));if(null==i?void 0:i.individualDelay){const s=i.onEnd;let n=a.length;const r=()=>{n--,0===n&&(e.setAttributes({visible:!0,ratio:null},!1,{type:Go.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const d=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new Lw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:kw,null!==(l=i.easing)&&void 0!==l?l:Mw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Go.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new Ow({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:kw,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Mw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):Rw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},aD=(t,e)=>{const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((s,n)=>t.slice(i*n,n===e-1?t.length:i*(n+1))))},oD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class lD extends iD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new sD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Cp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new jl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==PI.enter&&t.context.diffState!==PI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states))},this.name=e,this.model=i.model,this.key=i.key,this.state=new eD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){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._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,re)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&ER(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(FC(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=oR(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified),e.clamp&&t.clamp&&t.clamp(e.clamp))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let 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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):ZI.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):FC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_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=JL(ZL(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({},JI[n]),o);return t=>{const e={},i=this.getDataView();return Object.keys(u).forEach((s=>{const n=u[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==l?void 0:l.scale(t[h]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ti.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||c[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=n,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)ZI.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=JL(ZL(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return vI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return BR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[nO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=vI(t,this._groupKeyGetter)}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{oD(t),s.push(...t.getGraphics())})),e.forEach((t=>{oD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);rD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=aD(e,n),r=aD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===pI.exit?pI.exit:i===pI.update?pI.update:pI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===PI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===PI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=PI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=PI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=PI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=pI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=pI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return _I(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=_I(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i;const n=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);u(this._markConfig.interactive)||(n.pickable=this._markConfig.interactive);const r=this._transformGraphicAttributes(t,n,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=r}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n;const r=i.context.finalAttrs,a=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=UO(i,r);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):a||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),e&&i.setFinalAttributes(r)}else{const a=i;i=this._createGraphic(r),e&&i.setFinalAttributes(r),i.context=a.context,i.context.diffAttrs=r;const o=this._graphics===t?s:s+this._graphics.length-t.length;if(o>=0&&(this._graphics[o]=i),null===(n=this.renderContext)||void 0===n?void 0:n.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=BR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=BR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===fI.before||(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===PI.exit&&!e.isExiting)if(e.context.animationState===PI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:PI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Cp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var hD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(hD||(hD={}));class cD extends lD{constructor(){super(...arguments),this.type=cD.type,this._marks=[],this._diffState=PI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Dy("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?(Dy("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))}getMarkInUserId(t){let e;return yI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===PI.update){const t=this.hasAnimation(),e=UO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=PI.update}render(){this._isCommited&&(Iy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}cD.type="group";const dD={measureText:JR};class uD{static instance(){return uD.instance_||(uD.instance_=new uD),uD.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 pD{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))?Dy("不要重复添加相同的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 gD extends pD{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}}const fD={type:"fadeIn"};function mD(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 fD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const vD={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"}},_D={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},yD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},bD=()=>{BR.registerAnimation("scaleInOut",(()=>_D))},xD=()=>{BR.registerAnimation("fadeInOut",(()=>yD))},SD=(t,e)=>({appear:mD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Nw,duration:vD.update.duration,easing:vD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),AD=()=>{BR.registerAnimation("line",SD)},kD=()=>{lw.registerBuiltInAnimate("growPointsIn",nC),lw.registerBuiltInAnimate("growPointsOut",rC),lw.registerBuiltInAnimate("growPointsXIn",oC),lw.registerBuiltInAnimate("growPointsXOut",lC),lw.registerBuiltInAnimate("growPointsYIn",cC),lw.registerBuiltInAnimate("growPointsYOut",dC),lw.registerBuiltInAnimate("clipIn",Gw),lw.registerBuiltInAnimate("clipOut",Yw)},MD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class TD{constructor(t){this._markSet=new OI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 wD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class CD extends TD{constructor(t){super(t),this.type="element-highlight",this.resetAll=()=>{const{highlightState:t,blurState:e,interaction:i}=this.options;this._lastGraphic&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:[this._lastGraphic],options:this.options}),this._lastGraphic=null,i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},wD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:e,blurState:i,interaction:s}=this.options;if(this._lastGraphic===t)return;const n=s.updateStates(this,[t],s.getStatedGraphics(this),e,i);s.setStatedGraphics(this,n),this._lastGraphic=t,this.dispatchEvent("start",{graphics:n,options:this.options})}else this._lastGraphic&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}CD.type="element-highlight",CD.defaultOptions=wD;const ED=()=>{BR.registerInteractionTrigger(CD.type,CD)},BD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class PD extends TD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll()},this.options=Object.assign({},BD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,interaction:n}=this.options,r=n.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(e)){if(this._resetType.includes("self")){const s=r&&r.filter((e=>e!==t));s&&s.length?n.setStatedGraphics(this,n.updateStates(this,s,r,e,i)):this.resetAll()}}else{this._timer&&clearTimeout(this._timer),t.addState(e,!0);const a=this.options.interaction.updateStates(this,s&&r?[...r,t]:[t],r,e,i);n.setStatedGraphics(this,a),this.dispatchEvent("start",{graphics:a,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff))}else this._resetType.includes("view")&&r&&r.length&&this.resetAll()}reset(t){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}PD.type="element-select",PD.defaultOptions=BD;const LD=()=>{BR.registerInteractionTrigger(PD.type,PD)};class RD extends pD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class OD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>BR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&uD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&uD.instance().unregisterFunction(t)}static getFunction(t){return t?uD.instance().getFunction(t):null}static getFunctionList(){return uD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=BR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=BR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,iI.get(e);var e}static registerSVG(t,e,i){const s=BR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=BR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){GR.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;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._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=TI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?BR.getSeriesBuiltInTheme(e):BR.getComponentBuiltInTheme(e);i=i?ER({},s,i[e]):s}s===t.length-1&&p(i)&&(i=KR({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},WL(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Vy(v);if(S?ex(mo):"node"===v&&jS(mo),S&&f&&(this._container=_(f)?y_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=YR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new SI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new QO(this,this._compiler),this._event=new WO(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),GR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=ER({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=qR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;OD.getFunctionList()&&OD.getFunctionList().length&&(t=ZR(t,OD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=BR.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=BR.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(e){var i,s,n;if(!this._compiler)return void(null===(i=this._option)||void 0===i||i.onError("compiler is not initialized"));if(this._chart)return void(null===(s=this._option)||void 0===s||s.onError("chart is already initialized"));const r=BR.createChart(e.type,e,this._getChartOption(e.type));r?(this._chart=r,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(t.ChartEvent.initialized,{chart:r,vchart:this})):null===(n=this._option)||void 0===n||n.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{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 MI(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:tO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:eO})}_initDataSet(t){this._dataSet=t instanceof Ma?t:new Ma,eI(this._dataSet,"dataview",Sa),eI(this._dataSet,"array",s),tI(this._dataSet,"copyDataView",lI);for(const t in BR.transforms)tI(this._dataSet,t,BR.transforms[t]);for(const t in BR.dataParser)eI(this._dataSet,t,BR.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;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(t.ChartEvent.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.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?pI.none:pI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,GR.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?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),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 Ta?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=cI(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*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?ER({},t[n][e.index],i):i):t[n]=s?ER({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?ER({},t[n][r],i):i)}else t.id===e&&(t[n]=s?ER({},t[n],i):i)}))}(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=ER({},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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(t.ChartEvent.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(P(n)&&P(r))l=$R(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=PR({},$R(this._currentThemeName),$R(n),$R(r));this._currentTheme=o(a,t)}else{const t=PR({},$R(this._currentThemeName),$R(n),$R(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(VM.poptip,HM,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=!!Vy(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.getTheme("background")||this._option.background}getCurrentTheme(){return $R(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!YR.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),this.updateCustomConfigAndRerender(e,!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},richtext:{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 AI(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(!Vy(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;this._chart.resetLayoutItemTag(),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)?y_.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;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?vR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Dy("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?vR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Dy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return uD.instance().getFunction(t)}registerFunction(t,e){t&&e&&uD.instance().registerFunction(t,e)}unregisterFunction(t){t&&uD.instance().unregisterFunction(t)}getFunctionList(){return uD.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){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(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=BR.getChartPlugins();t.length>0&&(this._chartPlugin=new gD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=BR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new RD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}OD.InstanceManager=GR,OD.ThemeManager=YR,OD.globalConfig={uniqueTooltip:!0},OD.Utils=dD,OD.vglobal=y_;BR.registerRegion("region",VI),BR.registerLayout("base",qI),Xk(),Ok(),BR.registerMark(cD.type,cD),BR.registerStageEventPlugin("gesture",kb),ED(),LD(),HR(kR.name,kR);const ID="monotone",DD="linear",FD="bevel";function zD(t,e){return e("component",t)}function jD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=BR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const HD=(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},VD=(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)))},ND=(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},UD=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=jD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},WD=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const GD=(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 YD(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=XD(UD(h,r,a,c),d,g),o.value=XD(UD(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=UD(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function $D(t,e,i,s,n,r,a){if(d(e)){YD(t,e(n,a),i,s,r,a)}else e&&YD(t,e,i,s,r,a)}const XD=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class KD{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 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=>{y(t)?t.forEach((t=>{$D(a,t,e,i,s,n,r)})):d(t)?$D(a,t,e,i,s,n,r):t&&YD(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:UD(r.visible,t,n),value:XD(UD(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:UD(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=UD(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&GD(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 qD={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}},ZD=(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=MO([],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 JD(a,n,o)},JD=(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)=>{Yy(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=>{Yy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=qD[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},QD=(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=>{Yy(t[e])||(t[e]=0)}))})),t},tF=`${QR}_HIERARCHY_DEPTH`,eF=`${QR}_HIERARCHY_ROOT`,iF=`${QR}_HIERARCHY_ROOT_INDEX`;function sF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function nF(t,e,i){t&&(i.needDefaultSeriesField&&(t[rO]=i.defaultSeriesField),t[sO]=e,t[nO]=i.getKey(t,e,i))}function rF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function aF(t,e,i,s=0,n,r){void 0===r&&(r=e),nF(t,e,i),t[tF]=s,t[eF]=n||t[i.categoryField],t[iF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>aF(e,s,i,t[tF]+1,t[eF],r)))}const oF={label:{name:"label",type:"text"}},lF=`${QR}_rect_x`,hF=`${QR}_rect_x1`,cF=`${QR}_rect_y`,dF=`${QR}_rect_y1`,uF={data:!0},pF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},gF=[...Object.keys(vD),"normal"];function fF(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 bF(n)&&delete n.type,n.oneByOne&&(n=vF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_F,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=ER({},o[e],a);return bF(n)&&delete n.type,n.oneByOne&&(n=vF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:_F,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function mF(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;const i=["custom","customParameters"];return t=I(t,null,i),xF(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}),i),t}(h,i)}function vF(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):k(n)?n:0,h=d(r)?r(t,i,a):k(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):k(n)?n:0,c=d(a)?a(t,r,o):k(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function _F(t,e){var i;return null!==(i=null==t?void 0:t[sO])&&void 0!==i?i:e.context.graphicIndex}function yF(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 bF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function xF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),xF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),xF(t[s],e,i))}function SF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class AF extends DI{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=XL(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=BR.getSeriesMarkMap(o)?function(t,e,i){const s=BR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=ER({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return ER({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&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=ER({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>ER({},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 kF extends FI{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:`${QR}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=AF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(t.ChartEvent.afterInitData,{model:this}),this.initRootMark(),this.initMark();const e=SF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(t.ChartEvent.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)&&(tI(this._rawData.dataSet,"invalidTravel",QD),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=cI(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=hI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=hI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new sD(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=JD(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(){tI(this._dataSet,"dimensionStatistics",ZD);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ta(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&&MO(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){tI(this._dataSet,"dimensionStatistics",ZD);const s=new Ta(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=MO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&MO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ta(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)&&(tI(this._rawData.dataSet,"addVChartProperty",ND),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(e){var i;null===(i=this._rawDataStatistics)||void 0===i||i.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(t.ChartEvent.rawDataUpdate,{model:this})}viewDataFilterOver(e){this.event.emit(t.ChartEvent.viewDataFilterOver,{model:this})}viewDataUpdate(e){var i;this.event.emit(t.ChartEvent.viewDataUpdate,{model:this}),null===(i=this._data)||void 0===i||i.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(e){this.event.emit(t.ChartEvent.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;this._spec.extensionMark&&(null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)})))}_createExtensionMark(t,e,i,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,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=fF({},mF(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.setData(this._data):(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.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Ny(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=ER(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=ER(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=MD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=MD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=MD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:rO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:aO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,aO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new KD(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)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},uF),pF),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=>pF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ta||dI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();SF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){k(t.x)&&(this._layoutStartPoint.x=t.x),k(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){k(t)&&(this._layoutRect.width=t),k(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:rO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new rR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return ZL(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:rO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,ER({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:nO}_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!==hO&&t!==dO&&t!==lO&&t!==cO||(t=this.getStackValueField()),null!==(e=wO(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=>Yy(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:rO]}}function MF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();DC(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 TF(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}}}kF.mark=oF,kF.transformerConstructor=AF;class wF extends kF{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);DC(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:`${QR}_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(hO),this.setFieldX2(lO)):(this.setFieldY(hO),this.setFieldY2(lO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(dO),this.setFieldX2(cO)):(this.setFieldY(dO),this.setFieldY2(cO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(pO),this.setFieldX2(uO)):(this.setFieldY(pO),this.setFieldY2(uO))}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(t.ChartEvent.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)&&(MF("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)}}function CF(t){return"bottom"===t||"top"===t}function EF(t){return"left"===t||"right"===t}function BF(t){return"z"===t}function PF(t,e){return cR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function LF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function RF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?CF(t)?"linear":"band":CF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const OF=(t,e,i)=>{var s;const n=null!==(s="band"===e?zD("axisBand",i):["linear","log","symlog"].includes(e)?zD("axisLinear",i):{})&&void 0!==s?s:{},r=CF(t)?zD("axisX",i):EF(t)?zD("axisY",i):zD("axisZ",i);return ER({},zD("axis",i),n,r)};class IF{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:Fy)("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:Fy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;const n=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)))),r=n.filter((t=>zC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return CF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class DF extends IF{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:XO.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const FF=(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))},zF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},jF=(t,e,i,s)=>{var n;const r=e.getScale(),a=zC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:HF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,VF=(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};class NF extends IF{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)=>!FF(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:XO.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:XO.canvas}),callback:this.onMouseOut}),Ny(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:XO.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ny(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var UF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(UF||(UF={}));const WF={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class GF{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(WF.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(e,i){var s,n;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:FD,curveType:DD,closePath:!0},"normal",t.AttributeLevel.Series);else{const a=null!=i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,o=a===ID?"horizontal"===e?"monotoneY":"monotoneX":a;this.setMarkStyle(r,{curveType:o},"normal",t.AttributeLevel.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series)}return r}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(WF.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:yF(this._spec,WF.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ta(this._option.dataSet,{name:`${QR}_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()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const e=this._symbolMark;if(!e)return this._initSymbolActiveMarkAlone(),e;if(this._initSymbolMark(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(UF.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[WF.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(UF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,ER({},this._spec[WF.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(e){var i;e&&("symbol"!==(null===(i=e.getTarget())||void 0===i?void 0:i.type)&&e.setRule("line-data"),this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(e,i){var s,n,r,a;if(!e)return;const o=this._isFieldAllValid();if("zero"===this._invalidType||o){if(!0===(null===(n=null===(s=e.stateStyle.normal)||void 0===s?void 0:s[i])||void 0===n?void 0:n.style))return;this.setMarkStyle(e,{[i]:!0},"normal",t.AttributeLevel.Series)}else{if(!0!==(null===(a=null===(r=e.stateStyle.normal)||void 0===r?void 0:r[i])||void 0===a?void 0:a.style))return;this.setMarkStyle(e,{[i]:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series)}e.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const YF=Object.assign(Object.assign({},oF),WF),$F=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>$F(t,e[i])));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]))},XF=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class KF extends lD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return XF}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(FC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?$F(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:PI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[nO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class qF extends KF{constructor(){super(...arguments),this.type=qF.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)===YL.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}qF.type="line";const ZF=()=>{BR.registerMark(qF.type,qF),Xk(),zk(),kB(),yB(),kD(),BR.registerGraphicComponent("line",wg)};class JF extends lD{constructor(){super(...arguments),this.type=JF.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}JF.type="symbol";const QF=()=>{BR.registerMark(JF.type,JF),Xk(),qk(),yB(),BR.registerGraphicComponent("symbol",kg)};class tz extends AF{_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 ez(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function iz(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:!k(o.min),extendable_max:!k(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 sz(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 nz(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 rz(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 az(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 oz=(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 f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return BC(v)};class lz{constructor(t){this.id=Gy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class hz extends lz{constructor(){super(hz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!DC(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(e,i){const s=this._checkEnableSync(i);if(!s)return;if(!s.zeroAlign)return;const n=this._getTargetAxis(i,s);n&&i.event.on(t.ChartEvent.scaleDomainUpdate,{filter:({model:t})=>t.id===i.id||t.id===n.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&&ez(c)&&ez(d)))return;const u=iz(t,c),p=iz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!nz(u,p))return}else if(0===y&&0===b){if(!nz(p,u))return}else if(_||A)if(_&&!A){if(!sz(u,p))return}else if(A&&!_){if(!sz(p,u))return}else{if(f===b)return;if(f>b){if(!rz(u,p))return}else if(!rz(p,u))return}else{if(0===f&&0===y){if(!az(u,p))return}else if(0===b&&0===g&&!az(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===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)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){tI(e.getOption().dataSet,"tickAlign",oz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}hz.pluginType="component",hz.type="AxisSyncPlugin";const cz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function dz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function uz(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 pz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const gz=t=>"band"===t||"ordinal"===t||"point"===t;function fz(t,e){return{id:t,label:t,value:e,rawValue:t}}function mz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class vz extends pD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const _z=`${QR}_ARC_TRANSFORM_VALUE`,yz=`${QR}_ARC_RATIO`,bz=`${QR}_ARC_START_ANGLE`,xz=`${QR}_ARC_END_ANGLE`,Sz=`${QR}_ARC_K`,Az=`${QR}_ARC_MIDDLE_ANGLE`,kz=`${QR}_ARC_QUADRANT`,Mz=`${QR}_ARC_RADIAN`,Tz=-Math.PI/2,wz=3*Math.PI/2,Cz=.6,Ez=(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 ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Bz=(t,e,i)=>{var s;const n=null!==(s="band"===e?zD("axisBand",i):"linear"===e?zD("axisLinear",i):{})&&void 0!==s?s:{},r=zD("angle"===t?"axisAngle":"axisRadius",i);return ER({},zD("axis",i),n,r)};function Pz(t,e,i,s){switch(t){case r.cartesianBandAxis:return OF(PF(i,["z"]),"band",e);case r.cartesianLinearAxis:return OF(PF(i,["z"]),"linear",e);case r.cartesianLogAxis:return OF(PF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return OF(PF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return OF(PF(i),void 0,e);case r.polarBandAxis:return Bz(i.orient,"band",e);case r.polarLinearAxis:return Bz(i.orient,"linear",e);case r.polarAxis:return Bz(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,trigger:c,triggerOff:d}=null!==(s=zD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>CF(t.orient)));let g;g=p(u)?ER({},gz(u.type)?a:o,l):l;const f=n.find((t=>EF(t.orient)));let m;return m=p(f)?ER({},zC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=zD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?ER({},gz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?ER({},zC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Lz(i,zD(t,e));default:return zD(t,e)}}const Lz=(t,e)=>{var i;const s=ER({},e,e[LF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Rz extends DI{getTheme(t,e){return Pz(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({},mR(e)),{[s]:0}))}}class Oz extends jI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Rz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Oc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:XO.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 vz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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}}getDatum(t){}}var Iz,Dz;Oz.transformerConstructor=Rz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Iz||(Iz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Dz||(Dz={}));class Fz extends lD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=BR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(GO.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Fz.type="component";const zz=()=>{BR.registerMark(Fz.type,Fz)},jz=t=>t;class Hz extends Oz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Iz.circleAxis:Iz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Dz.circleAxisGrid:Dz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=fF(null===(h=BR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new sD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return HL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?DC(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 HL(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(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const e=VL(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));e.length>1?this._option.dataSet.multipleDataViewAddListener(e,"change",(()=>{this.updateScaleDomain()})):1===e.length&&e[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(HL(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=FO(s=t.domainLine)).startSymbol=FO(s.startSymbol),s.endSymbol=FO(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 HO(ER({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:HO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>HO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=HO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 HO(ER({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:HO(t.tick.style)),t.tick.state&&(i.tick.state=zO(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 HO(ER({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:HO(t.subTick.style)),t.subTick.state&&(i.subTick.state=zO(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=cz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:ER({},d,HO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:HO(h.style)}),h.state&&(i.title.state.shape=zO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:HO(o.style)}),o.state&&(i.title.state.background=zO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=zO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=HO(t.background.style)),t.background.state&&(i.panel.state=zO(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 HO(ER({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:HO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:HO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=jD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){eI(this._option.dataSet,"scale",jz);const i=this.registerTicksTransform();return new Ta(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)}getDatum(t){var e;return t&&t.name===pT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Hz.specKey="axes";const Vz=()=>{zz(),BR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Nz=[hz];class Uz extends Hz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(i,s){super(i,s),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=t.LayoutZIndex.Axis,this.layoutLevel=t.LayoutLevel.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),HL(this._regions,(t=>{const e=this.getOrient();CF(e)?mz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):EF(e)?mz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):BF(e)&&mz(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 k(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),k(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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=ER({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(ER({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=CF(this.getOrient()),n=t=>{var e;return(s?!CF(t.getOrient()):CF(t.getOrient()))&&DC(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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{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=PF(i,["z"]),BF(this._orient)&&(this.layoutType="absolute"),this._dataSet=s.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(!pz(e))return null;const{axisType:t,componentName:s}=RF(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=>EF(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(!pz(t))return;const{axisType:s,componentName:n}=RF(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=BR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return CF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):BF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(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(Nz.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){CF(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&&!CF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!BF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;EF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=pR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=CF(this.getOrient())?t.fieldX:BF(this.getOrient())?t.fieldZ:t.fieldY,DC(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:DC(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;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(GO.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(CF(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=CF(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)}))}collectScale(){const t=[];return HL(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]:CF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:BF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HL(this._regions,(e=>{CF(t)?mz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):EF(t)?mz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):BF(t)&&mz(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=CF(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=CF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=ER(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=CF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(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;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return fz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:DC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(t.ChartEvent.layoutEnd,this._updateAxisLayout),this.event.on(t.ChartEvent.layoutEnd,this._fixAxisOnZero),this.event.on(t.ChartEvent.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}}}}Uz.type=r.cartesianAxis,Uz.specKey="axes";const Wz=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Gz(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,$z=(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 Xz(t,e,i="count"){const s=$z(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,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Kz=Math.sqrt(50),qz=Math.sqrt(10),Zz=Math.sqrt(2);class Jz{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=uz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(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=CF(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=k(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=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Yz),e.sort(Yz),{domain:Gz(t,e),scope:Xz(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}=uz(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>=Kz?10:n>=qz?5:n>=Zz?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(e,i){if(void 0===i)return void delete this._extend[e];this._extend[e]=i;const s=this._scale.domain();if(this.extendDomain(s),this.includeZero(s),this.setDomainMinMax(s),this.niceDomain(s),this._scale.domain(s,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(t.ChartEvent.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(e){if(e=null!=e?e:this._scale.domain(),this.extendDomain(e),this.includeZero(e),this.setDomainMinMax(e),this.niceDomain(e),this._scale.domain(e,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(e),this._domainAfterSpec=this._scale.domain(),this.event.emit(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.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=>k(+t)?Math.round(+t*s)/s:t}}const Qz={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},tj={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}}},ej={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}}},ij={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}}};class sj extends Uz{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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(!BF(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=CF(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=dR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(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 tI(this._option.dataSet,t,IE),t}}sj.type=r.cartesianLinearAxis,sj.specKey="axes",sj.builtInTheme={axis:ij,axisLinear:Qz,axisX:tj,axisY:ej},G(sj,Jz);const nj=()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),Vz(),BR.registerComponent(sj.type,sj)};class rj{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new sD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(t.ChartEvent.scaleDomainUpdate,{model:this}),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=fz(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=>fz(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 aj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class oj extends Uz{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new rE}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 tI(this._option.dataSet,t,HE),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=qC(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{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),Vz(),BR.registerComponent(oj.type,oj,!1)};class hj extends sj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{CF(this.getOrient())?mz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):mz(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=ER({},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 Ta(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 sD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>fz(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=>fz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return tI(this._option.dataSet,t,IE),t}transformScaleDomain(){}}hj.type=r.cartesianTimeAxis,hj.specKey="axes",hj.builtInTheme={axis:ij,axisX:tj,axisY:ej};class cj extends sj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new BE}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 tI(this._option.dataSet,t,IE),t}transformScaleDomain(){}}cj.type=r.cartesianLogAxis,cj.specKey="axes",cj.builtInTheme={axis:ij,axisLinear:Qz,axisX:tj,axisY:ej},G(cj,Jz);class dj extends sj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new PE}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 tI(this._option.dataSet,t,IE),t}transformScaleDomain(){}}dj.type=r.cartesianSymlogAxis,dj.specKey="axes",dj.builtInTheme={axis:ij,axisLinear:Qz,axisX:tj,axisY:ej},G(dj,Jz);const uj=`${QR}_hide_`;function pj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const gj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[uj]&&(pj(t,!0),t[uj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[uj]=!0,pj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},fj=()=>{BR.registerGrammarTransform("symbolOverlap",{transform:gj,runType:"afterEncode"})},mj={min:K,max:X,average:IL,sum:OL};function vj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function _j(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 yj(t,e,i,s){return _j(t,e,i,"min",s)}function bj(t,e,i,s){return _j(t,e,i,"max",s)}function xj(t,e,i,s){return _j(t,e,i,"average",s)}function Sj(t,e,i,s){return _j(t,e,i,"sum",s)}const Aj=(t,e)=>{let i=d(t.size)?t.size():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=vj;if("min"===n?l=yj:"max"===n?l=bj:"average"===n?l=xj:"sum"===n&&(l=Sj),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[]},kj=()=>{BR.registerGrammarTransform("dataSampling",{transform:Aj})};class Mj extends wF{constructor(){super(...arguments),this.type=YL.line,this.transformerConstructor=tz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}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(fF(null===(i=BR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),mF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=TF(this);this._symbolMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),mF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Mj.type=YL.line,Mj.mark=YF,Mj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Mj.transformerConstructor=tz,G(Mj,GF);class Tj{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)=>{dI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ta)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];Dy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Dy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class wj{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)=>{$y(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{MO(e,[{key:t,operations:DC(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&&MO(e,[{key:i.field,operations:DC(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?oR("colorOrdinal"):oR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&($y(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(U(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(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),$y(s.domain)?e.reRender=!0:U(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(!$y(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=DC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=DC(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;DC(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(DC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=DC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));DC(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 Cj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Ej extends II{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Gy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:tO,height:eO},this._viewRect={width:tO,height:eO},this._viewBox={x1:0,y1:0,x2:tO,y2:eO},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=mR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new WO(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Tj(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),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Cj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=BR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=BR.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({},i),{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:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=BR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"base");if(s){const t=new s(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(){var 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._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.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,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof FI)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 lD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof lD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&dI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=MI(this._spec,this._option,{width:tO,height:eO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=ZL(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new wj(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){TI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=ZL(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(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{TI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!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++,TI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):TI(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()];TI(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(e){let i=this.getCanvasRect();if(e){this._viewBox=e;const{x1:t=0,y1:s=0,x2:n,y2:r}=e;i={width:n-t,height:r-s}}else this._viewBox={x1:0,y1:0,x2:i.width,y2:i.height};this._viewRect=i,this.padding=gR(this._paddingSpec,i,i),this._layoutRect.width=i.width-this.padding.left-this.padding.right,this._layoutRect.height=i.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(t.ChartEvent.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){this._backgroundMark&&this._backgroundMark.compile()}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i,this._option.globalInstance)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t,this._option.globalInstance),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i,this._option.globalInstance)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(GO.AFTER_MARK_RENDER_END,e)};this._event.on(GO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:NO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(VO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===UF.dimensionHover||s===UF.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>zC(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(a)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.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&&(a?t.hideCrosshair():t.showCrosshair(n))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Bj=(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 Pj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):TR(t,a,c.spec),TR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=Bj(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=Bj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(BR.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(BR.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=BR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=BR.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=BR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):HD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=HD(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"];return 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}))}_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 Lj extends Pj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),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])})),L(i,"trimPadding")&&ER(i,wI(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 Rj extends Lj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),kI(t)}}const Oj=(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,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=CO(t,!0);for(const e in o)for(const i in o[e].nodes)LO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)PO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&BO(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((e=>{e.event.on(t.ChartEvent.regionSeriesDataFilterOver,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class Dj{_beforeInit(){this._dataSet&&tI(this._dataSet,"stackSplit",Oj)}_initStack(){this._stack=new Ij(this),this._stack.init()}}const Fj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:UF.dimensionHover};class zj extends TD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Fj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=NO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}zj.type="dimension-hover",zj.defaultOptions=Fj;const jj=()=>{BR.registerInteractionTrigger(zj.type,zj)},Hj=()=>{BR.registerComposedEvent(UF.dimensionHover,NF),BR.registerComposedEvent(UF.dimensionClick,DF)},Vj=t=>t.fieldX[0],Nj=t=>t.fieldY[0],Uj=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},Wj=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},Gj=(t,e)=>t?e?Vj:Uj:e?Nj:Wj,Yj=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=VF(t,(t=>CF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=VF(t,(t=>EF(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=>{zC(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=$j(t,i,Gj(e,zC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=$j(t,i,Gj(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},$j=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:Xj(t,s,i)},Xj=(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=jF(e,t,"cartesian",null!=i?i:CF(t.getOrient())?Vj:Nj);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},Kj=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(zC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(DC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=dz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};Zj(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&qj(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),qj=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=jD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},Zj=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},Jj=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=Qj(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},Qj=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},tH=(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(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return Kj(c,r,e),c.xField.cacheInfo?Jj(c.xField):c.yField.cacheInfo?Jj(c.yField):void 0},eH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],iH=(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])&&eH.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(sH(s).every((t=>{var e;return!GD("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},sH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},nH={dom:`${QR}_TOOLTIP_HANDLER_DOM`,canvas:`${QR}_TOOLTIP_HANDLER_CANVAS`},rH={key:"其他",value:"..."};var aH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(aH||(aH={}));class oH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=u(null==o?void 0:o.key)&&u(null==o?void 0:o.value)&&!(null==l?void 0:l.length);if(this.component.event.emit(t.ChartEvent.tooltipShow,Object.assign(Object.assign({},i),{isEmptyTooltip:h,tooltipData:e,activeType:this.activeType,tooltip:this.component})),h)return 1;let c;return(null===(s=a.handler)||void 0===s?void 0:s.showTooltip)?c=a.handler.showTooltip.bind(a.handler):(null===(n=this.component.tooltipHandler)||void 0===n?void 0:n.showTooltip)&&(c=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),c?null!==(r=c(this.activeType,e,i))&&void 0!==r?r:0:1},this.component=e}_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=iH(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({},rH),t):rH;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)&&GD(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 lH extends oH{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,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],0===n.length)n=void 0;else if(n.length>1){const t=n.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!zC(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(n=t.length?t:n.slice(0,1),n.length>1){const t=new Set;n.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return n}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const hH=()=>{BR.registerTooltipProcessor("dimension",lH)};class cH extends oH{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.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Wo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(NO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){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)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const dH=()=>{BR.registerTooltipProcessor("mark",cH)};class uH extends oH{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 pH=()=>{BR.registerTooltipProcessor("group",uH)};class gH extends Ej{constructor(){super(...arguments),this.transformerConstructor=Rj,this.type="line",this.seriesType=YL.line}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}gH.type="line",gH.seriesType=YL.line,gH.transformerConstructor=Rj,G(gH,Dj);const fH=[...XF,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class mH extends KF{constructor(){super(...arguments),this.type=mH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return fH}_getIgnoreAttributes(){return[]}}mH.type="area";const vH=()=>{BR.registerMark(mH.type,mH),Xk(),Ck(),kB(),yB(),kD(),BR.registerGraphicComponent("area",Jg)};class _H extends KD{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 yH=Object.assign(Object.assign(Object.assign({},oF),WF),{area:{name:"area",type:"area"}}),bH=()=>{BR.registerAnimation("area",SD),AD(),bD()};class xH extends tz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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=ER({},f.style,g.style),l.state=ER({},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 SH extends wF{constructor(){super(...arguments),this.type=YL.area,this.transformerConstructor=xH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(SH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var e,i,s,n,r;const a=null!==(s=null===(i=null===(e=this.getSpec().area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.curveType)&&void 0!==s?s:null===(r=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.curveType,o=a===ID?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return lR(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",t.AttributeLevel.Series),this.setMarkStyle(l,{fill:!!e&&this.getColorAttribute(),stroke:!!i&&this.getColorAttribute()},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(l,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[hO]},"normal",t.AttributeLevel.Series),this.setMarkStyle(l,{curveType:o},"normal",t.AttributeLevel.Built_In),Object.keys(l.stateStyle).forEach((t=>{l.stateStyle[t].stroke&&l.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(fF(null===(e=BR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),mF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(fF(null===(i=BR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),mF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=TF(this);this._symbolMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),mF("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 _H(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(){super.onLayoutEnd(),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}}}SH.type=YL.area,SH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},SH.mark=yH,SH.transformerConstructor=xH,G(SH,GF);class AH extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),kI(t)}}class kH extends Ej{constructor(){super(...arguments),this.transformerConstructor=AH,this.type="area",this.seriesType=YL.area}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}kH.type="area",kH.seriesType=YL.area,kH.transformerConstructor=AH,G(kH,Dj);function MH(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 TH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:MH(t,e)}),wH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:MH(t,e)}),CH={type:"fadeIn"},EH={type:"growCenterIn"};function BH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return CH;case"scaleIn":return EH;default:return TH(t)}}class PH extends lD{constructor(){super(...arguments),this.type=PH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}PH.type="rect";const LH=()=>{Xk(),Wk(),mB("rect",xB),BR.registerMark(PH.type,PH),lw.registerBuiltInAnimate("growHeightIn",tC),lw.registerBuiltInAnimate("growHeightOut",eC),lw.registerBuiltInAnimate("growWidthIn",vC),lw.registerBuiltInAnimate("growWidthOut",_C),lw.registerBuiltInAnimate("growCenterIn",Zw),lw.registerBuiltInAnimate("growCenterOut",Jw),BR.registerGraphicComponent("rect",Pg)},RH=Object.assign(Object.assign({},oF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function OH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=_R(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[lF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):lR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[hF]):lR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=lR(this._dataToPosX(t),e,i),n=lR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[cF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):lR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[dF]):lR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=lR(this._dataToPosY(t),e,i),n=lR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},FH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:yF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(tI(this._option.dataSet,"addVChartProperty",ND),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};tI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Ta(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new sD(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=dF,s=cF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=hF,s=lF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=CO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)OH(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=lR(this[r](t),l,i),u=lR(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,r),x1:t=>this._getBarXEnd(t,r),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.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[lO],n=t[hO],r=t[cO],h=t[dO];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]),{[lO]:i,[hO]:s}),a?{[cO]:o,[dO]: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(Pg(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 e,i,s,n;const r=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),a=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0);if("horizontal"===this.direction){const e=p(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>lR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},e),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r)},e),"normal",t.AttributeLevel.Series)}else{const e=p(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>lR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},e),{y:t=>this._getBarYStart(t,a),y1:t=>this._getBarYEnd(t,a)}),"normal",t.AttributeLevel.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},e),{y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a)}),"normal",t.AttributeLevel.Series)}}_initBandBarBackgroundMarkStyle(){var e,i,s,n,r;if(!this._barBackgroundMark)return;const a=null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),o=null===(n=null===(s=this._yAxisHelper)||void 0===s?void 0:s.getScale)||void 0===n?void 0:n.call(s,0),l=null!==(r=this._spec.barBackground)&&void 0!==r?r:{},h=u(l.fieldLevel)?void 0:l.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(a),x1:()=>this._getBarBackgroundXEnd(a),y:t=>this._getPosition(this.direction,t,h,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,h),width:()=>{},y1:()=>{}},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,h,"barBackground"),y:()=>this._getBarBackgroundYStart(o),y1:()=>this._getBarBackgroundYEnd(o),width:()=>this._getBarWidth(this._xAxisHelper,h),x1:()=>{},height:()=>{}},"normal",t.AttributeLevel.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=TF(this);this._barMark.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),mF(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=_R(this._spec.barWidth,a)),l&&(c=Math.max(c,_R(this._spec.barMinWidth,a))),h&&(c=Math.min(c,_R(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,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=_R(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=DC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}FH.type=YL.bar,FH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},FH.mark=RH,FH.transformerConstructor=DH;const zH=()=>{kj(),LH(),BR.registerAnimation("bar",((t,e)=>({appear:BH(t,e),enter:TH(t,!1),exit:wH(t,!1),disappear:wH(t)}))),lj(),nj(),BR.registerSeries(FH.type,FH)};class jH extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),kI(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 HH extends Ej{constructor(){super(...arguments),this.transformerConstructor=jH,this.type="bar",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}HH.type="bar",HH.seriesType=YL.bar,HH.transformerConstructor=jH,G(HH,Dj);const VH=[10,20],NH=OC.Linear,UH="circle",WH=OC.Ordinal,GH=["circle","square","triangle","diamond","star"],YH=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},$H=Object.assign(Object.assign({},oF),{point:{name:"point",type:"symbol"}});class XH extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class KH extends wF{constructor(){super(...arguments),this.type=YL.scatter,this.transformerConstructor=XH,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=`${QR}_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=`${QR}_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)&&A(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:NH,defaultRange:VH},"size")}getShapeAttribute(t,e){return u(e)?UH:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:WH,defaultRange:GH},"shape")}initMark(){this._symbolMark=this._createMark(KH.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yF(this._spec,KH.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=TF(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(fF(null===(i=BR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),mF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:UH},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(e){super.viewDataStatisticsUpdate(e);const i=[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||i?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",t.AttributeLevel.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(e){e&&(this._labelMark=e,this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}KH.type=YL.scatter,KH.mark=$H,KH.builtInTheme={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"}}}}},KH.transformerConstructor=XH;const qH=()=>{QF(),BR.registerAnimation("scatter",((t,e)=>Object.assign({appear:YH(0,e)},_D))),lj(),nj(),BR.registerSeries(KH.type,KH)};class ZH extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class JH extends Ej{constructor(){super(...arguments),this.transformerConstructor=ZH,this.type="scatter",this.seriesType=YL.scatter}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}JH.type="scatter",JH.seriesType=YL.scatter,JH.transformerConstructor=ZH,G(JH,Dj);class QH extends kF{constructor(){super(...arguments),this.type=YL.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=`${QR}_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 tV=`${QR}_MAP_LOOK_UP_KEY`,eV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[sO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[tV]=e.nameMap[n]:t[tV]=n})),t.features);class iV extends KD{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 sV extends lD{constructor(){super(...arguments),this.type=sV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}sV.type="path";const nV=()=>{BR.registerMark(sV.type,sV),Xk(),Hk(),BR.registerGraphicComponent("path",Kg)},rV=Object.assign(Object.assign({},oF),{area:{name:"area",type:"path"}});class aV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ba(i,e):Ca[i]?(wa[i]||(wa[i]=Ba(i,Ca[i])),wa[i]):null}(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 oV{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(){}}class lV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 hV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:oV}:Ny(e)||Uy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:lV}:null}const cV={debounce:bt,throttle:xt};class dV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Ny(this._renderMode)||Uy(this._renderMode),hV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return hV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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:KO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:KO.chart,consume:!1}];l.on(...c,cV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,cV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||hV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||hV(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:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),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:KO.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:KO.chart,consume:!1}];l.on(...c,cV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,cV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){hV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||hV(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:KO.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:KO.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||hV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:KO.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||hV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:KO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:KO.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:KO.chart,source:XO.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:KO.chart,source:XO.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();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,f=d.canvasY;this._handleDragMouseUp=cV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=cV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:KO.chart})}));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:KO.chart,source:XO.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:KO.chart,source:XO.chart},this._handleDragMouseUp)}))}}function uV(t,e){return`${QR}_${e}_${t}`}class pV extends Oz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:uV(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=ER(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(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?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 aV(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===YL.map||e.type===YL.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),HL(this._regions,(t=>{var e;if(t.type===YL.map||t.type===YL.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==YL.map&&e.type!==YL.pictogram||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[tV],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=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}pV.type=r.geoCoordinate,G(pV,dV);const gV=()=>{BR.registerComponent(pV.type,pV)};class fV extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class mV extends QH{constructor(){super(...arguments),this.type=YL.map,this.transformerConstructor=fV,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 !`),iI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),tI(this._dataSet,"copyDataView",lI),tI(this._dataSet,"map",eV),tI(this._dataSet,"lookup",VD);const s=iI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Ta(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:tV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new sD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(mV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:yF(this._spec,mV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:rO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:rO]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",t.AttributeLevel.Series),e.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",t.AttributeLevel.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(fF(null===(t=BR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),mF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new iV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[sO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[sO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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]:k(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 sO}getActiveMarks(){return[this._pathMark]}}mV.type=YL.map,mV.mark=rV,mV.builtInTheme={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"}}}}},mV.transformerConstructor=fV;const vV=`${QR}_waterfall_default_seriesField`,_V=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[mO]=!0:delete t[mO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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=yV([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 f=g[0];let{start:m,end:v}=bV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((t=>{t[c]=+m,t[d]=ee(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=yV(r,t,n,a,c,h,i,e),a.push(n)})),a};function yV(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}=bV(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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(u(p)||p===vV)&&(t[vV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function bV(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?Dy("total.collectCountField error"):n=e[a].start;o<0?Dy("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=ee(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 xV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},SV={type:"fadeIn"},AV={type:"growCenterIn"};function kV(t,e){switch(e){case"fadeIn":return SV;case"scaleIn":return AV;default:return TH(t,!1)}}class MV extends lD{constructor(){super(...arguments),this.type=MV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return wg(t)}}MV.type="rule";const TV=()=>{BR.registerMark(MV.type,MV),Xk(),zk(),BR.registerGraphicComponent("line",wg)},wV=Object.assign(Object.assign({},RH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),CV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:EV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function EV(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)=>EV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class BV{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 Ta(e instanceof Ma?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),tI(e,"dimensionTree",CV),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 PV extends DH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const LV={rect:zV,symbol:DV,arc:HV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=DV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:VV,line:NV,area:NV,rect3d:zV,arc3d:HV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function RV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=LV[t])&&void 0!==i?i:LV.point;return e.series.type===YL.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=IV(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:UV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function OV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==YL.sankey){const{formatFunc:t,args:n}=jD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function IV(t){return d(t)?e=>t(e.data):t}function DV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=IV(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:FV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function FV(){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=IV(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 HV(t){var e;const{labelSpec:i}=t,s=null!==(e=IV(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 VV(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=OV(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),xg(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 NV(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}))):[{index:0,[rO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function UV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class WV extends FH{constructor(){super(...arguments),this.type=YL.waterfall,this.transformerConstructor=PV,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 BV(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=vV)}getSeriesKeys(){return this._seriesField===vV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),tI(this._dataSet,"waterfallFillTotal",xV),tI(this._dataSet,"waterfall",_V),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=hI(this.getViewData(),this._dataSet,{name:`${QR}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new sD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:lO,endAs:hO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!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=TF(this);this._barMark.setAnimationConfig(fF(null===(i=BR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),mF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mF("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(){super.initMark();const t=this._createMark(WV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}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.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return VV(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?lR(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):lR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&function(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}WV.type=YL.waterfall,WV.mark=wV,WV.builtInTheme={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}}}},WV.transformerConstructor=PV;const GV=()=>{TV(),LH(),BR.registerAnimation("waterfall",((t,e)=>({appear:kV(t,e),enter:TH(t,!1),exit:wH(t,!1),disappear:wH(t,!1)}))),xD(),lj(),nj(),BR.registerSeries(WV.type,WV)},YV=`${QR}_BOX_PLOT_OUTLIER_VALUE`;var $V;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}($V||($V={}));const XV=(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={[YV]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class KV extends KD{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===$V.OUTLIER)return this.series.getOutliersField();if(t===$V.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case $V.MIN:return this.series.getMinField();case $V.MAX:return this.series.getMaxField();case $V.MEDIAN:return this.series.getMedianField();case $V.Q1:return this.series.getQ1Field();case $V.Q3:return this.series.getQ3Field();case $V.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===$V.OUTLIER)return e[YV];if(t===$V.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case $V.MIN:return e[this.series.getMinField()];case $V.MAX:return e[this.series.getMaxField()];case $V.MEDIAN:return e[this.series.getMedianField()];case $V.Q1:return e[this.series.getQ1Field()];case $V.Q3:return e[this.series.getQ3Field()];case $V.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[YV])}getDefaultContentList(t){return[{key:this.getContentKey($V.OUTLIER),value:this.getContentValue($V.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey($V.MAX),value:this.getContentValue($V.MAX)},{key:this.getContentKey($V.Q3),value:this.getContentValue($V.Q3)},{key:this.getContentKey($V.MEDIAN),value:this.getContentValue($V.MEDIAN)},{key:this.getContentKey($V.Q1),value:this.getContentValue($V.Q1)},{key:this.getContentKey($V.MIN),value:this.getContentValue($V.MIN)},{key:this.getContentKey($V.SERIES_FIELD),value:this.getContentValue($V.SERIES_FIELD)}]}}class qV extends lD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==PI.enter&&t.context.diffState!==PI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Rg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=BR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const ZV=()=>{BR.registerGraphicComponent("glyph",Rg),Xk(),Lk()},JV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],QV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class tN extends qV{constructor(){super(...arguments),this.type=tN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=JV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=QV,this._channelEncoder=null,this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}tN.type="boxPlot";const eN=Object.assign(Object.assign({},oF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),iN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},sN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},nN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),rN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=nN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=nN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=nN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=nN(t,"box").attribute.width,i=nN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=nN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=nN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=nN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=nN(t,"box").attribute.height,i=nN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},aN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=nN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=nN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=nN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=nN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=nN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=nN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=nN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=nN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=nN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=nN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class oN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return iN(rN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class lN extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return sN(rN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class hN extends oN{computeAttribute(){return iN(aN)(this.target,this.params,this.params.options)}}class cN extends lN{computeAttribute(){return sN(aN)(this.target,this.params,this.params.options)}}class dN extends wF{constructor(){super(...arguments),this.type=YL.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(){this._boxPlotMark=this._createMark(dN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(dN.mark.outlier,{key:sO,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()}))}initMarkStyle(){var e,i,s,n,r;const a=this._boxPlotMark;if(a){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"===this._shaftShape?this.getColorAttribute():"#000"};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},s),{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)},s),{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(a,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this.getColorAttribute(),size:S(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initBoxPlotMarkStyle(){var e,i;const s=this._boxPlotMark,n="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(s&&n){const{dataToPosition:i}=n,r=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0);this.setMarkStyle(s,{min:t=>lR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>lR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>lR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>lR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>lR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}const r=this._outlierMark;if(r&&n){const{dataToPosition:e}=n,s=null===(i=null==n?void 0:n.getScale)||void 0===i?void 0:i.call(n,0),a="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:t=>lR(e(this.getDatumPositionValues(t,YV),{bandPosition:this._bandPosition}),s)}:{x:this.dataToPositionX.bind(this),y:t=>lR(e(this.getDatumPositionValues(t,YV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initData(){if(super.initData(),!this._data)return;tI(this._dataSet,"foldOutlierData",XV),tI(this._dataSet,"addVChartProperty",ND);const t=new Ta(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${QR}_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:sF.bind(this),call:nF}},!1),this._outlierDataView=new sD(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(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},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=TF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=BR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(mF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(fF(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(fF(null===(a=BR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new KV(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]}}dN.type=YL.boxPlot,dN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},dN.mark=eN;const uN=()=>{ZV(),zk(),Wk(),BR.registerGraphicComponent("line",(t=>wg(t))),BR.registerGraphicComponent("rect",(t=>Pg(t))),BR.registerMark(tN.type,tN),QF(),bD(),lj(),nj(),lw.registerBuiltInAnimate("boxplotScaleIn",oN),lw.registerBuiltInAnimate("boxplotScaleOut",lN),lw.registerBuiltInAnimate("barBoxplotScaleIn",hN),lw.registerBuiltInAnimate("barBoxplotScaleOut",cN),BR.registerSeries(dN.type,dN)};class pN extends lD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Yg(t):xg(t)}}pN.type="text";const gN=()=>{BR.registerMark(pN.type,pN),Xk(),Jk(),Yk(),BR.registerGraphicComponent("text",xg),BR.registerGraphicComponent("richtext",Yg)};class fN extends KD{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 mN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),vN={type:"fadeIn"},_N=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function yN(t,e){return"fadeIn"===e?vN:mN(t)}const bN=Object.assign(Object.assign({},RH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class xN extends DH{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 SN extends FH{constructor(){super(...arguments),this.type=YL.rangeColumn,this._barMarkType="rect",this._barName=YL.bar,this.transformerConstructor=xN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(SN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yF(this._spec,SN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(SN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(SN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(e,i,s,n,r,a,o,l,h){e.setMarkStyle(i,{textAlign:t=>{if("vertical"===h())return"center";const e=r(t),i=a(t);if("middle"===s)return"center";if(e>=i){if("start"===s)return"left";if("end"===s)return"right";if("outside"===s)return"left"}else{if("start"===s)return"right";if("end"===s)return"left";if("outside"===s)return"right"}return"center"},textBaseline:t=>{if("horizontal"===h())return"middle";const e=o(t),i=l(t);if("middle"===s)return"middle";if(i>=e){if("start"===s)return"bottom";if("end"===s)return"top";if("outside"===s)return"bottom"}else{if("start"===s)return"top";if("end"===s)return"bottom";if("outside"===s)return"top"}return"middle"}}),e.setMarkStyle(i,{x:t=>{const e=h(),i=r(t),o=a(t);if("vertical"===e)return(i+o)/2;if("middle"===s)return(i+o)/2;if(i>=o){if("start"===s)return o+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return o-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+o)/2},y:t=>{const e=h(),i=o(t),r=l(t);if("horizontal"===e)return(i+r)/2;if("middle"===s)return(i+r)/2;if(i>=r){if("start"===s)return r+n;if("end"===s)return i-n;if("outside"===s)return i+n}else{if("start"===s)return r-n;if("end"===s)return i+n;if("outside"===s)return i-n}return(i+r)/2}},"normal",t.AttributeLevel.Series)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=TF(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(fF(null===(i=BR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),mF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(fF(null===(n=BR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),mF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fN(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)}}SN.type=YL.rangeColumn,SN.mark=bN,SN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},SN.transformerConstructor=xN;const AN=()=>{LH(),gN(),BR.registerAnimation("rangeColumn",((t,e)=>({appear:yN(t,e),enter:mN(t),exit:_N(t),disappear:_N(t)}))),xD(),lj(),nj(),BR.registerSeries(SN.type,SN)};var kN,MN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(kN||(kN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(MN||(MN={}));class TN extends KD{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 wN=Object.assign({},yH);class CN extends SH{constructor(){super(...arguments),this.type=YL.rangeArea}initMark(){this._areaMark=this._createMark(CN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const e=this._areaMark;e&&(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",t.AttributeLevel.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",t.AttributeLevel.Series),this.setMarkStyle(e,{stroke:!1},"normal",t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new TN(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))}}CN.type=YL.rangeArea,CN.mark=wN;class EN extends kF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Cz,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:[]};DC(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:[]};DC(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(t.ChartEvent.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)&&MF(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 BN(t){return Yy(t)?Number.parseFloat(t):0}const PN=(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&&LN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=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[_z],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[_z]*t;v(e,A,i),A+=i}))}if(0!==_&&(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},LN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BN(t[e])))||!i&&0===t.reduce(((t,i)=>t+BN(i[e])),0)));function RN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const ON=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:RN(t,!0,pI.appear)}),IN={type:"fadeIn"},DN=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:RN(t,!0,pI.enter)}),FN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:RN(t,!0,pI.exit)}),zN=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:RN(t,!0,pI.exit)});function jN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return IN;case"growRadius":return ON(Object.assign(Object.assign({},t),{growField:"radius"}));default:return ON(Object.assign(Object.assign({},t),{growField:"angle"}))}}class HN extends lD{constructor(t,e){super(t,e),this.type=VN.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Az])[t]+s,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 VN extends HN{constructor(){super(...arguments),this.type=VN.type}}VN.type="arc";const NN=()=>{Xk(),Tk(),mB("arc",wB),lw.registerBuiltInAnimate("growRadiusIn",gC),lw.registerBuiltInAnimate("growRadiusOut",fC),lw.registerBuiltInAnimate("growAngleIn",Kw),lw.registerBuiltInAnimate("growAngleOut",qw),BR.registerGraphicComponent("arc",ef),BR.registerMark(VN.type,VN)},UN=Object.assign(Object.assign({},oF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class WN extends AF{_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=ER({},this._theme,i,t);const n=(t,e)=>ER({},"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 GN=`${QR}_LABEL_VISIBLE`;class YN extends EN{constructor(){super(...arguments),this.transformerConstructor=WN,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:pR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:pR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Tz,this._endAngle=wz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Az];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(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)?re(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?re(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;tI(this._dataSet,"pie",PN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:bz,asEndAngle:xz,asRatio:yz,asMiddleAngle:Az,asRadian:Mz,asQuadrant:kz,asK:Sz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ta(this._dataSet,{name:`${QR}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new sD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},YN.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:nO,groupKey:this._seriesField,isSeriesMark:!0},{morph:yF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return UL(bz)(t)}endAngleScale(t){return UL(xz)(t)}_computeLayoutRadius(){return Ez((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:hR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:hR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e.name===this._pieMarkName){const i=this.getSpec()[e.name];if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:UL(GN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.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[Az];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===pI.appear)return this._startAngle;if(i===pI.disappear)return this._endAngle;const r=[pI.disappear,pI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[sO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[sO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[sO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[sO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[Az]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[Az]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[Az]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[Az]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=fF(null===(i=BR.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]}}YN.transformerConstructor=WN,YN.mark=UN,YN.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class $N extends YN{constructor(){super(...arguments),this.type=YL.pie}}$N.type=YL.pie;const XN=()=>{NN(),BR.registerAnimation("pie",((t,e)=>({appear:jN(t,e),enter:DN(t),exit:FN(t),disappear:zN(t)}))),BR.registerAnimation("emptyCircle",((t,e)=>({appear:jN(t,e)}))),BR.registerSeries($N.type,$N)};function KN(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const qN=t=>({type:KN(t.growField),options:{overall:!0}}),ZN={type:"fadeIn"},JN=t=>({type:KN(t.growField)}),QN=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e},tU=QN;function eU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZN;case"growAngle":return qN(Object.assign(Object.assign({},t),{growField:"angle"}));default:return qN(Object.assign(Object.assign({},t),{growField:"radius"}))}}class iU extends EN{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(hO),this.setInnerRadiusField(lO)}setValueFieldToPercent(){this.setRadiusField(dO),this.setInnerRadiusField(cO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const sU=Object.assign(Object.assign({},oF),{rose:{name:"rose",type:"arc"}});class nU extends AF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class rU extends Hz{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:f,outerRadius:m,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=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,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=BR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(e,i){super(e,i),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=t.LayoutZIndex.Axis,this._tick=void 0,this._center=null,this._startAngle=Tz,this._endAngle=wz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HL(this._regions,(t=>{"radius"===this.getOrient()?mz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):mz(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:pR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:pR(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=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:dz(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(){HL(this._regions,(t=>{"radius"===this.getOrient()?mz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):mz(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 DC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:DC(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(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=>fz(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",scale:this._scale});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=ne.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",scale:this._scale.clone()});(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 Ez((()=>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=Cz,e=0;const i=this.getChart().getSpec();return HL(this.getRegions(),(s=>{const n=s;if(r=n.type,[YL.rose,YL.radar,YL.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;k(s)&&(t=s),k(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.getComponent().setAttributes(ER({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(ER({},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)}}rU.type=r.polarAxis,rU.specKey="axes";const aU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},oU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class lU extends rU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new TE}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 tI(this._option.dataSet,t,IE),t}}lU.type=r.polarLinearAxis,lU.specKey="axes",lU.builtInTheme={axis:ij,axisLinear:Qz,axisAngle:oU,axisRadius:aU},G(lU,Jz);const hU=()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),BR.registerGraphicComponent(Iz.circleAxis,((t,e)=>new EC(t,e))),BR.registerGraphicComponent(Dz.circleAxisGrid,((t,e)=>new IB(t,e))),Vz(),BR.registerComponent(lU.type,lU)};class cU extends rU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new rE}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 tI(this._option.dataSet,t,UE),t}transformScaleDomain(){}}cU.type=r.polarBandAxis,cU.specKey="axes",cU.builtInTheme={axis:ij,axisBand:aj,axisAngle:oU,axisRadius:aU},G(cU,rj);const dU=()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),BR.registerGraphicComponent(Iz.circleAxis,((t,e)=>new EC(t,e))),BR.registerGraphicComponent(Dz.circleAxisGrid,((t,e)=>new IB(t,e))),Vz(),BR.registerComponent(cU.type,cU)};class uU extends iU{constructor(){super(...arguments),this.type=YL.rose,this.transformerConstructor=nU,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(){this._roseMark=this._createMark(uU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:yF(this._spec,uU.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=>lR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=lR(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(fF(null===(i=BR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),mF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}uU.type=YL.rose,uU.mark=sU,uU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},uU.transformerConstructor=nU;const pU=()=>{BR.registerSeries(uU.type,uU),NN(),BR.registerAnimation("rose",((t,e)=>({appear:eU(t,e),enter:JN(t),exit:QN(t),disappear:tU(t)}))),dU(),hU()};class gU extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,PL(this._fromAngle,this._toAngle)&&PL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({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);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class fU extends Nw{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}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})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!jL(t)&&!jL(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({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 se(s,n,r,a);return o.defined=e.defined,o}}const mU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function vU(t,e,i){return"fadeIn"===e?mU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function _U(t,e,i){return"fadeIn"===e?mU(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 yU=(t,e)=>({custom:Hw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),bU=Object.assign(Object.assign(Object.assign({},oF),WF),{area:{name:"area",type:"area"}});class xU extends iU{constructor(){super(...arguments),this.type=YL.radar,this.transformerConstructor=tz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}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){this._areaMark=this._createMark(xU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.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:DD,closePath:!0},"normal",t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",t.AttributeLevel.Series),this.event.on(t.ChartEvent.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"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)?re(this._spec.startAngle):Tz},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(fF(null===(s=BR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),mF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=BR.getAnimationInKey(e);t.setAnimationConfig(fF(null==i?void 0:i(n,r),mF(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}}}xU.type=YL.radar,xU.mark=bU,xU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},xU.transformerConstructor=tz,G(xU,GF);const SU=()=>{BR.registerSeries(xU.type,xU),vH(),ZF(),QF(),BR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:vU(t,e,"in"),enter:vU(t,e,"in"),exit:vU(t,e,"out"),disappear:"clipIn"===e?void 0:vU(t,e,"out"),update:[{channel:["points","center"],custom:fU,customParameters:t,duration:vD.update.duration,easing:vD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),BR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:_U(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:_U(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:gU,customParameters:t,duration:vD.update.duration,easing:vD.update.easing}]}))),BR.registerAnimation("radarGroup",((t,e)=>({appear:yU(t,"in"),disappear:yU(t,"out")}))),Tk(),dU(),hU()};class AU extends KD{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=>gi.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 kU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(QR)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[sO]:r,[nO]:`${s}_${e}`})),r++}))})),n},MU={fill:"#bbb",fillOpacity:.2},TU=Object.assign(Object.assign({},oF),{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 wU extends wF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),tI(this._option.dataSet,"objFlat",kU),tI(this._option.dataSet,"copyDataView",lI),eI(this._option.dataSet,"dataview",Sa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.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(ER(MU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(wU.mark.group),this._containerMark=this._createMark(wU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(wU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(wU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(wU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(wU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(wU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(wU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1}));const s=this._gridBackgroundMark;s&&this.setMarkStyle(s,{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",t.AttributeLevel.Series);const n=this._gridMark;n&&this.setMarkStyle(n,{stroke:this.getColorAttribute(),x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),x1:this.getRegionRectRight.bind(this),y1:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const a=this._titleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const o=this._subTitleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",t.AttributeLevel.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(){var e,i;super.onLayoutEnd();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",t.AttributeLevel.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:rO}}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 rR).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:rO}}initTooltip(){this._tooltipHelper=new AU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}wU.type=YL.dot,wU.mark=TU,wU.builtInTheme={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"}}}}};class CU extends KD{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=>gi.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 EU=Object.assign(Object.assign({},oF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),BU=(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 PU extends wF{constructor(){super(...arguments),this.type=YL.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 e;super.initData(),tI(this._option.dataSet,"linkDotInfo",BU),null===(e=this.getViewData())||void 0===e||e.transform({type:"linkDotInfo",options:{infoKey:"dots",fields:()=>({fromField:this._fromField,toField:this._toField,xField:this._dotSeriesSpec.xField,yField:this._dotSeriesSpec.yField}),linkData:()=>this._rawData.latestData,dotData:()=>this._getDotData()},level:t.TransformLevel.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(PU.mark.group),this._containerMark=this._createMark(PU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(PU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(PU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var e,i,s,n;const r=this._clipMark;r&&(this.setMarkStyle(r,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!1}));const o=this._linkMark;o&&this.setMarkStyle(o,{stroke:this.getColorAttribute(),strokeOpacity:this.dataToOpacity.bind(this),x:this.dataToPositionXFrom.bind(this),y:this.dataToPositionYFrom.bind(this),x1:this.dataToPositionXTo.bind(this),y1:this.dataToPositionYTo.bind(this)},"normal",t.AttributeLevel.Series);const l=this._arrowMark;if(l){const r=null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size)&&void 0!==n?n:10;this.setMarkStyle(l,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,r),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:r,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",t.AttributeLevel.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:rO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new CU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}PU.type=YL.link,PU.mark=EU,PU.builtInTheme={link:{arrow:{style:{size:10}}}};const LU=Object.assign(Object.assign({},oF),{group:{name:"group",type:"group"}});class RU extends EN{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()?lO:SO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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()?hO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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)?re(n):Tz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?re(r):wz,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=lR(this.angleAxisHelper.dataToPosition([t[lO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=lR(this.angleAxisHelper.dataToPosition([t[hO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?lR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(RU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return ef(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Pg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 FU=()=>{BR.registerAnimation("circularProgress",((t,e)=>({appear:DU(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class zU extends AF{constructor(){super(...arguments),this._supportStack=!0}}class jU extends RU{constructor(){super(...arguments),this.type=YL.circularProgress,this.transformerConstructor=zU,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(k(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(k(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(){return this._progressMark=this._createMark(jU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:yF(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var e;const i=this._progressMark;i&&this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(e=this._spec.roundCap)&&void 0!==e&&e,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",t.AttributeLevel.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(jU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&this.setMarkStyle(e,{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()?lO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?hO: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",t.AttributeLevel.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(fF(null===(i=BR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),mF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}jU.type=YL.circularProgress,jU.mark=OU,jU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},jU.transformerConstructor=zU;const HU=()=>{BR.registerSeries(jU.type,jU),NN(),FU(),xD(),dU(),hU()};function VU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const NU=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:VU(t)}),UU={type:"fadeIn"};function WU(t,e="grow"){return!1===e?{}:"fadeIn"===e?UU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:VU(t)}))(t)}class GU extends KD{enableByType(t){return"dimension"!==t}}const YU=Object.assign(Object.assign({},oF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class $U extends wF{constructor(){super(...arguments),this.type=YL.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;return this._progressMark=this._createMark($U.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return lR(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+n},y1:t=>{var e,i;return lR(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,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return lR(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 e,s;return lR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?lR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark($U.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return lR(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",t.AttributeLevel.Series):this.setMarkStyle(e,{x:0,y:t=>{var e,i;return lR(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",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(fF(null===(i=BR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),mF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),mF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new GU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}$U.type=YL.linearProgress,$U.mark=YU,$U.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const XU=()=>{LH(),BR.registerAnimation("linearProgress",((t,e)=>({appear:WU(t,e),enter:WU(t),disappear:NU(t)}))),xD(),BR.registerSeries($U.type,$U)},KU=[0],qU=[20,40],ZU=[200,500],JU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},QU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],tW=`${QR}_WORD_CLOUD_TEXT`,eW=Object.assign(Object.assign({},oF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),iW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}};class sW extends kF{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=qU}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:ZU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:KU,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)?tW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:JU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Vy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:KU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!QU.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 e;this._wordMark=this._createMark(sW.mark.word,{key:nO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(sW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}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",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.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",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.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(fF(BR.getAnimationInKey("wordCloud")(n,s),mF("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 rR).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:rO])}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 TE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new TE).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[sO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:nO,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,createCanvas:y_.createCanvas.bind(y_),getTextBounds:df}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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()),{createImage:jg,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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}sW.mark=eW,sW.builtInTheme={wordCloud:iW};function nW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||vD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let 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=rW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,kt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=kt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},aW=(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=aW(t.children,e,t,n))})),s},oW=(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=oW(t.children,e,t,n)),n=e(t,s,i,n)})),n},lW=(t,e=[],i)=>{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):lW(t.children,e,i)))})),e};function hW(t,e){let i,s;if(uW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function uW(t,e){for(let i=0;i1e-6?(w+Math.sqrt(w*w-4*T*C))/(2*T):C/w);return{x:s+S+A*E,y:n+k+M*E,radius:E}}function mW(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 vW(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 _W(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 yW(t){return{_:t,next:null,prev:null}}function bW(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];mW(n,s,r);let a,o,l,h,c,d,u,p=yW(s),g=yW(n),f=yW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=rW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Tt)/Tt}(),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:kW.defaultOpionts.nodeSort;aW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)aW([o],xW(h)),oW([o],SW(this._getPadding,.5,a)),aW([o],AW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);aW([o],xW(kW.defaultOpionts.setRadius)),oW([o],SW(Pt,1,a)),c&&oW([o],SW(this._getPadding,o.radius/t,a)),aW([o],AW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}kW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const MW=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=MW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function TW(t){return t.depth}function wW(t,e){return e-1-t.endDepth}const CW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),EW=(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},BW={left:TW,right:wW,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:TW,end:wW},PW=_t(0,1);class LW{constructor(t){this._ascendingSourceBreadth=(t,e)=>CW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>CW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},LW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Et(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):BW[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)};"vertical"===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<=0)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))),"vertical"===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=[];MW(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:kt(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+=kt(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=[EW(s[t.source]),EW(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=kt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=kt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=mt(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;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=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,f=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),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*PW(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(CW),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(CW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];RW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),OW);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({},IW.defaultOpionts,t):Object.assign({},IW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Et(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Bt(this.options.center[0],t.width),s=t.y0+Bt(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=>Bt(t,n))):Bt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Bt(t,n))):Bt(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=Bt(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=rW(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=le({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)}}}function DW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:RW,slice:DW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?DW:RW)(t,e,i,s,n)}};class jW{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({},jW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Et(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?FW(this.options.aspectRatio):null!==(e=zW[this.options.splitType])&&void 0!==e?e:zW.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=rW(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)}))}}function HW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=HW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ti(o.map(Ti))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=VW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function XW(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Ei((function(i){return-1*KW({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},ZW=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null}=t;let c={},d={};if(e.length>0){const u=e.map((t=>({sets:Y(t[a]),size:t[o]})));let p=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||UW,s=e.lossFunction||NW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]),i=e.toString(),s=d[i],n=Object.assign(Object.assign({},t),{datum:t,sets:e,key:i,size:t[o],labelX:null==s?void 0:s.x,labelY:null==s?void 0:s.y}),r=c[i];if(r)return Object.assign(Object.assign({},n),{type:"circle",x:r.x,y:r.y,radius:r.radius});const l=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)c[t])));return Object.assign(Object.assign({},n),{type:"overlap",x:0,y:0,path:qW(l),arcs:l})}))},JW={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:QW,triangle:QW,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 QW(){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 tG(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 eG=t=>JW[t]?JW[t]():JW.circle(),iG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function sG(t){return d(t)?t:function(){return t}}class nG{constructor(t){var e,i;switch(this.options=j({},nG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=eG(this.options.shape),this.getText=null!==(e=sG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=sG(this.options.fontWeight),this.getTextFontSize=sG(this.options.fontSize),this.getTextFontStyle=sG(this.options.fontStyle),this.getTextFontFamily=sG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>iG(10,50);break;case"random-light":this.getTextColor=()=>iG(50,90);break;default:this.getTextColor=sG(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 re(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():Mt(e);return re(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 aG extends nG{constructor(t){var e;super(j({},aG.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<=aG.defaultOptions.minFontSize&&(this.options.minFontSize=aG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=rG[this.options.spiral])&&void 0!==e?e:rG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=sG(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}=tG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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(this.options.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){if(this.options.customInsertZerosToArray)return this.options.customInsertZerosToArray(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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(cG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(hG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}cG(p,this._size)&&(p=dG(p,this._size))}else if(cG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||lG(p,i))&&(!i||!oG(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 oG(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 lG(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,cG=(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 dG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},pG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},gG=(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()},fG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=tG(t.shape,[i,s]);n.fillStyle=e,r&&(n.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()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=eG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)gG(n,pG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)gG(n,pG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)gG(n,pG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)gG(n,pG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)gG(n,pG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=pG({x:l,y:h},o,-Math.PI/2,5),e=pG({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]);gG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let vG=class t extends rG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?pG(t,o,l.width,l.height,h):"geometric"===t.type&&mG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=eG(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()}};vG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class _G extends rG{constructor(t){super(j({},_G.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)}_G.defaultOptions={enlarge:!1};const bG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},xG=(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?SG(t.fontFamily):"sans-serif",d=t.fontStyle?SG(t.fontStyle):"normal",u=t.fontWeight?SG(t.fontWeight):"normal",p=t.rotate?SG(t.rotate):0,g=SG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?SG(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},bG),t.as):bG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?SG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=kG(MG(t,l),C);w=i=>e(t(i))}let E=oG;"fast"===t.layoutType?E=_G:"grid"===t.layoutType&&(E=vG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},SG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],AG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=AG(t[0]),n=AG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(AG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},MG=(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 TG(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{PR.registerGrammarTransform("wordcloud",{transform:xG}),fN(),PR.registerAnimation("wordCloud",((t,e)=>({appear:rW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),PR.registerSeries(wG.type,wG)},EG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},BG=(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},PG=`${tO}_FUNNEL_TRANSFORM_RATIO`,LG=`${tO}_FUNNEL_REACH_RATIO`,RG=`${tO}_FUNNEL_HEIGHT_RATIO`,OG=`${tO}_FUNNEL_VALUE_RATIO`,IG=`${tO}_FUNNEL_LAST_VALUE_RATIO`,DG=`${tO}_FUNNEL_NEXT_VALUE_RATIO`,FG=`${tO}_FUNNEL_LAST_VALUE`,zG=`${tO}_FUNNEL_CURRENT_VALUE`,jG=`${tO}_FUNNEL_NEXT_VALUE`,HG=`${tO}_FUNNEL_TRANSFORM_LEVEL`;class VG extends qD{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[LG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class NG extends hD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class UG extends NG{constructor(){super(...arguments),this.type=UG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}UG.type="polygon";const WG=()=>{PR.registerMark(UG.type,UG),Kk(),Uk(),hw.registerBuiltInAnimate("growPointsOut",aC),PR.registerGraphicComponent("polygon",nf)},GG=Object.assign(Object.assign({},lF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YG extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $G extends MF{constructor(){super(...arguments),this.type=$L.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YG,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;eI(this._dataSet,"funnel",EG),eI(this._dataSet,"funnelTransform",BG);const t=new Ta(this._dataSet,{name:`${tO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new nD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:zG,asTransformRatio:PG,asReachRatio:LG,asHeightRatio:RG,asValueRatio:OG,asNextValueRatio:DG,asLastValueRatio:IG,asLastValue:FG,asNextValue:jG,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:HG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$G.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:bF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$G.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark($G.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark($G.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new VG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Iy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Iy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*WL(LG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),vF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(mF(PR.getAnimationInKey("fadeInOut")(),vF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(mF(PR.getAnimationInKey("funnel")({},o),vF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(mF(null===(a=PR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),vF("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[IG])/2:this._getSecondaryAxisLength(t[OG])/2,n=this._getSecondaryAxisLength(t[OG])/2):(s=this._getSecondaryAxisLength(t[OG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[DG])/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[HG])}_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[rO]===t[rO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{WG(),fN(),wV(),PR.registerSeries($G.type,$G),PR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},bD))),PR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Nw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Nw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),SD()},KG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},qG=t=>{const e=t.filter((t=>t.context.diffState===LI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},ZG=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},JG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qG(i.parent.children),a=ZG(r,s,n);return KG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qG(i.parent.children),a=ZG(r,s,n);return KG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),QG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},tY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qG(i.parent.children),a=QG(r);return KG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=qG(i.parent.children),a=QG(r);return KG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),eY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},iY=(t,e={})=>{if(!t)return[];const i=[];return hW(t,i,e),i},sY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new DW(i).layout(t,{width:s,height:n})};class nY extends qD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var rY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(rY||(rY={}));const aY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===rY.DrillDown){return Y(IO(t,n,s,"children"))}if(i.type===rY.DrillUp){const e=DO(t,n,s,"children");if(e)return Y(e)}return t};class oY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=cV(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;eI(t,"drillFilter",aY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:rY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:rY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:rY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:rY.DrillUp},model:this}),r}}const lY=Object.assign(Object.assign({},lF),{sunburst:{name:"sunburst",type:"arc"}}),hY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:eF,operations:["max","min","values"]}),t.push({key:iF,operations:["values"]}),t),cY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class dY extends BN{constructor(){super(...arguments),this.type=$L.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:iF),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:rO},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),eI(this._dataSet,"sunburstLayout",sY),eI(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 hY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(eI(t.dataSet,"addVChartProperty",UD),t.transform({type:"addVChartProperty",options:{beforeCall:aF.bind(this),call:oF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(dY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(dY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new nY(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(mF(null===(e=PR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),vF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),vF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}dY.type=$L.sunburst,dY.mark=lY,dY.builtInTheme={sunburst:cY},G(dY,oY);const uY=()=>{PR.registerSeries(dY.type,dY),UN(),fN(),SD(),PR.registerAnimation("sunburst",((t,e)=>({appear:eY(0,e),enter:JG(t),exit:tY(t),disappear:tY(t)})))},pY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new MW(i).layout(t,{width:s,height:n})};class gY extends qD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const fY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},mY=Object.assign(Object.assign({},lF),{circlePacking:{name:"circlePacking",type:"arc"}});class vY extends CF{constructor(){super(...arguments),this.type=$L.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:iF),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:rO},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),eI(this._dataSet,"circlePackingLayout",pY),eI(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)||(eI(t.dataSet,"addVChartProperty",UD),t.transform({type:"addVChartProperty",options:{beforeCall:aF.bind(this),call:oF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(vY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(vY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return hY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new gY(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(mF(null===(i=PR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),vF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),vF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}vY.type=$L.circlePacking,vY.mark=mY,vY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(vY,oY);const _Y=()=>{PR.registerSeries(vY.type,vY),UN(),fN(),xD(),PR.registerAnimation("circlePacking",((t,e)=>({appear:fY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},yY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&yY(t,e.children,i)}))},bY=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},xY=(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 RW(e),r=[];return r.push(n.layout(s,i)),r},SY=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:[]},AY=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 kY extends qD{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 MY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),TY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:MY(t),wY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class CY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class EY extends bw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const BY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},PY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class LY extends ZV{constructor(){super(...arguments),this.type=LY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?PY:BY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}LY.type="linkPath";const RY=Object.assign(Object.assign({},lF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class OY extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const IY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class DY extends CF{constructor(){super(...arguments),this.type=$L.sankey,this.transformerConstructor=OY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new je,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=UO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=UO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=UO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),IY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=UO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=UO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=UO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=UO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=UO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void IY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void IY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(UO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=UO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=UO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void IY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void IY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void IY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){eI(this._dataSet,"sankeyLayout",xY),eI(this._dataSet,"sankeyFormat",bY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;eI(o,"sankeyNodes",SY),eI(o,"flatten",iY);const l=new Ta(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:nF.bind(this),call:rF}},!1),this._nodesSeriesData=l,eI(o,"sankeyLinks",AY);const h=new Ta(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:nF.bind(this),call:rF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(DY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(DY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=HD(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(mF(null===(i=PR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),vF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),vF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:qO.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(UO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new kY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new aR;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 yY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}DY.type=$L.sankey,DY.transformerConstructor=OY,DY.mark=RY,DY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const FY=()=>{RH(),JV(),Vk(),PR.registerGraphicComponent("path",(t=>Xg(t))),PR.registerMark(LY.type,LY),fN(),PR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:TY(t,e)},bD))),PR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:wY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),hw.registerBuiltInAnimate("linkPathGrowOut",EY),hw.registerBuiltInAnimate("linkPathGrowIn",CY),SD(),PR.registerSeries(DY.type,DY)},zY=(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=JD([{latestData:r}],e),i};class jY extends qD{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 HY=Object.assign(Object.assign({},lF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),VY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class NY extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const UY=(t,e)=>{if(e.getViewBox()){const i=new HW(e).layout(t,e.getViewBox()),s=[];return hW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[iF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class WY extends CF{constructor(){super(...arguments),this.type=$L.treemap,this.transformerConstructor=NY,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:iF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:rO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),eI(this._dataSet,"treemap",UY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(eI(this._rawData.dataSet,"addVChartProperty",UD),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:aF.bind(this),call:oF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=zY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){eI(this._dataSet,"hierarchyDimensionStatistics",zY),eI(this._dataSet,"flatten",iY);const i=new Ta(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 hY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(WY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(WY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),vF(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 jY(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(YO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(YO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}WY.type=$L.treemap,WY.mark=HY,WY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},WY.transformerConstructor=NY,G(WY,oY),G(WY,uV);const GY=()=>{PR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),PR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),RH(),fN(),PR.registerAnimation("treemap",((t,e)=>({appear:VY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),SD(),PR.registerSeries(WY.type,WY)},YY=Object.assign(Object.assign({},RU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),$Y=Object.assign(Object.assign({},lF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),XY={type:"fadeIn"};function KY(t,e){return"fadeIn"===e?XY:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class qY extends kF{constructor(){super(...arguments),this._supportStack=!1}}class ZY extends qD{enableByType(t){return"dimension"!==t}}const JY="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",QY={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:JY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:JY,fill:"#ddd"}}};class t$ extends OU{constructor(){super(...arguments),this.type=$L.gaugePointer,this.transformerConstructor=qY,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(t$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},t$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(t$.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 ZY(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=mt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(mF(null===(i=PR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}t$.type=$L.gaugePointer,t$.mark=$Y,t$.builtInTheme={gaugePointer:QY},t$.transformerConstructor=qY;const e$=()=>{PR.registerSeries(t$.type,t$),rV(),RH(),PR.registerAnimation("gaugePointer",((t,e)=>{const i=KY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),uU(),cU()};class i$ extends kF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class s$ extends OU{constructor(){super(...arguments),this.type=$L.gauge,this.transformerConstructor=i$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();eI(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[kO]=t[this._angleField[0]],t[AO]=e>0?i[e-1][kO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(s$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(s$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?hR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[AO])?this.angleAxisHelper.dataToPosition([t[AO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[kO]])}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(mF(null===(i=PR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),vF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}s$.type=$L.gauge,s$.mark=YY,s$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},s$.transformerConstructor=i$;class n$ extends hD{constructor(){super(...arguments),this.type=n$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Ag(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}n$.type="cell";function r$(t){return!1===t?{}:{type:"fadeIn"}}class a$ extends qD{enableByType(t){return"dimension"!==t}}const o$=Object.assign(Object.assign({},lF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class l$ extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class h$ extends CF{constructor(){super(...arguments),this.type=$L.heatmap,this.transformerConstructor=l$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(h$.mark.cell,{isSeriesMark:!0},{morph:bF(this._spec,h$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(h$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ni(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=wF(this);this._cellMark.setAnimationConfig(mF(null===(i=PR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),vF("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 a$(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]}}h$.type=$L.heatmap,h$.mark=o$,h$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},h$.transformerConstructor=l$;const c$=()=>{fN(),PR.registerMark(n$.type,n$),PR.registerGraphicComponent("symbol",Ag),Kk(),Zk(),bB(),PR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},bD),{appear:r$(e)}))),hj(),rj(),PR.registerSeries(h$.type,h$)},d$=Object.assign(Object.assign({},lF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),u$=`${tO}_CORRELATION_X`,p$=`${tO}_CORRELATION_Y`,g$=`${tO}_CORRELATION_SIZE`,f$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=re(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Bt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Bt(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+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Et(e.field),C=t.map(w),[E,B]=Lt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Et(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Lt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=m$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),v$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},v$=(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,[nO]:null==n?void 0:n[nO],[aO]:null==n?void 0:n[aO]}};class y$ extends ZV{constructor(){super(...arguments),this.type=y$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}y$.type="ripple";const b$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class x$ extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class S$ extends BN{constructor(){super(...arguments),this.type=$L.correlation,this.transformerConstructor=x$,this._viewBox=new je}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;eI(this._dataSet,"correlation",f$);const s=new Ma;iI(s,"dataview",Sa),eI(s,"correlationCenter",_$);const n=new Ta(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 nD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(S$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:nO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(S$.mark.ripplePoint,{key:nO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(S$.mark.centerPoint,{key:nO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[u$],y:t=>t[p$],size:t=>t[g$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),vF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}S$.type=$L.correlation,S$.mark=d$,S$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},S$.transformerConstructor=x$;const A$=()=>{tz(),JV(),Zk(),PR.registerMark(y$.type,y$),PR.registerGraphicComponent("symbol",(t=>Ag(t))),PR.registerSeries(S$.type,S$),PR.registerAnimation("correlation",((t,e)=>Object.assign({appear:b$(0,e)},yD)))},k$=Object.assign(Object.assign({},lF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class M$ extends ZV{constructor(){super(...arguments),this.type=M$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}M$.type="liquid";const T$=(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 w$ extends qD{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 C$ extends MF{constructor(){super(...arguments),this.type=$L.liquid,this.transformerConstructor=ez,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Bg({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=Ag({x:s,y:n,size:r,symbolType:T$(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=vR(this._spec.outlineMargin),this._paddingSpec=vR(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=Wt(...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(C$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(C$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(C$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(C$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new w$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(mF(null===(i=PR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),vF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(mF(null===(s=PR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),vF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=xM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}C$.type=$L.liquid,C$.mark=k$,C$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},C$.transformerConstructor=ez;const E$=t=>Y(t).join(",");class B$ extends qD{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>E$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>E$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const P$=Object.assign(Object.assign({},lF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class L$ extends kF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const R$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?JW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class O$ extends MF{constructor(){super(...arguments),this.type=$L.venn,this.transformerConstructor=L$,this._viewBox=new je}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:rO)}initData(){var t;super.initData(),eI(this._dataSet,"venn",R$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(O$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(O$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>E$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>E$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new B$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:E$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return E$(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[E$(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(E$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),vF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(mF(null===(e=PR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),vF(t.name,this._spec,this._markAttributeContext)))}))}}O$.type=$L.venn,O$.mark=P$,O$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},O$.transformerConstructor=L$;class I$ extends zH{constructor(){super(...arguments),this.type=$L.mosaic,this.transformerConstructor=FH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(bO),this.setFieldX2(yO)),this.setFieldY(SO),this.setFieldY2(xO)):(t&&(this.setFieldY(bO),this.setFieldY2(yO)),this.setFieldX(SO),this.setFieldX2(xO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}I$.type=$L.mosaic,I$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},I$.transformerConstructor=FH;class D$ extends Lj{_isValidSeries(t){return t===$L.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class F$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=D$,this.type="map",this.seriesType=$L.map}}F$.type="map",F$.seriesType=$L.map,F$.transformerConstructor=D$;class z$ extends Lj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 j$ extends z${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=pz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,BR({},s,l)),n&&Object.assign(o,BR({},n,o))}}class H$ extends z${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class V$ extends z${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class N$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=V$}}N$.transformerConstructor=V$;class U$ extends N${constructor(){super(...arguments),this.transformerConstructor=V$,this.type="pie",this.seriesType=$L.pie}}U$.type="pie",U$.seriesType=$L.pie,U$.transformerConstructor=V$;class W$ extends H${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Ez,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Ez,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>BR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const G$=(t,e)=>{if(!t)return null;const i=NF(t,(t=>"angle"===t.getOrient()),e),s=NF(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&&jC(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=zL({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=jL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=HF(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&&jC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=zL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jL(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 _=HF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class Y$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="rose",this.seriesType=$L.rose}_setModelOption(){this._modelOption.getDimensionInfo=G$}}Y$.type="rose",Y$.seriesType=$L.rose,Y$.transformerConstructor=W$,G(Y$,Fj);class $$ extends H${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=BR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>BR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class X$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=$$,this.type="radar",this.seriesType=$L.radar}_setModelOption(){this._modelOption.getDimensionInfo=G$}}X$.type="radar",X$.seriesType=$L.radar,X$.transformerConstructor=$$,G(X$,Fj);class K$ extends Lj{_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=>{L(e,"trimPadding")&&BR(e,CI(this.type,t))})),this._transformAxisSpec(t)}}class q$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=$j(t,e,i))&&void 0!==s?s:[],...null!==(n=G$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}q$.type="common",q$.transformerConstructor=K$,G(q$,Fj);class Z$ extends Rj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class J$ extends Bj{constructor(){super(...arguments),this.transformerConstructor=Z$}}J$.transformerConstructor=Z$,G(J$,Fj);class Q$ extends Z${transformSpec(t){super.transformSpec(t),MI(t)}}class tX extends J${constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="histogram",this.seriesType=$L.bar}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}tX.type="histogram",tX.seriesType=$L.bar,tX.transformerConstructor=Q$;class eX extends j${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class iX extends Bj{constructor(){super(...arguments),this.transformerConstructor=eX,this.type="circularProgress",this.seriesType=$L.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=G$}}iX.type="circularProgress",iX.seriesType=$L.circularProgress,iX.transformerConstructor=eX,G(iX,Fj);class sX extends j${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=$L.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===$L.gauge||t.type===$L.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===$L.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class nX extends Bj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="gauge",this.seriesType=$L.gaugePointer}}nX.type="gauge",nX.seriesType=$L.gaugePointer,nX.transformerConstructor=sX;class rX extends Lj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class aX extends Bj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="wordCloud",this.seriesType=$L.wordCloud}}aX.transformerConstructor=rX;class oX extends aX{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="wordCloud",this.seriesType=$L.wordCloud}}oX.type="wordCloud",oX.seriesType=$L.wordCloud,oX.transformerConstructor=rX;class lX extends Lj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class hX extends Bj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="funnel",this.seriesType=$L.funnel}}hX.type="funnel",hX.seriesType=$L.funnel,hX.transformerConstructor=lX;class cX extends Rj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=pz(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=pz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class dX extends Bj{constructor(){super(...arguments),this.transformerConstructor=cX,this.type="linearProgress",this.seriesType=$L.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}dX.type="linearProgress",dX.seriesType=$L.linearProgress,dX.transformerConstructor=cX,G(dX,Fj);class uX extends Rj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),MI(t)}}class pX extends Bj{constructor(){super(...arguments),this.transformerConstructor=uX,this.type="rangeColumn",this.seriesType=$L.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}pX.type="rangeColumn",pX.seriesType=$L.rangeColumn,pX.transformerConstructor=uX;class gX extends Lj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fX extends Bj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="sunburst",this.seriesType=$L.sunburst}}fX.type="sunburst",fX.seriesType=$L.sunburst,fX.transformerConstructor=gX;class mX extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vX extends Bj{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="circlePacking",this.seriesType=$L.circlePacking}}vX.type="circlePacking",vX.seriesType=$L.circlePacking,vX.transformerConstructor=mX;class _X extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class yX extends Bj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="treemap",this.seriesType=$L.treemap}}yX.type="treemap",yX.seriesType=$L.treemap,yX.transformerConstructor=_X;class bX extends HH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),MI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e}}class xX extends VH{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="waterfall",this.seriesType=$L.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}xX.type="waterfall",xX.seriesType=$L.waterfall,xX.transformerConstructor=bX;class SX extends Rj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),MI(t)}}class AX extends Bj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="boxPlot",this.seriesType=$L.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}AX.type="boxPlot",AX.seriesType=$L.boxPlot,AX.transformerConstructor=SX;class kX extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MX extends Bj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="sankey",this.seriesType=$L.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=UO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}MX.type="sankey",MX.seriesType=$L.sankey,MX.transformerConstructor=kX;class TX extends Rj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),MI(t)}}class wX extends Bj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="rangeArea",this.seriesType=$L.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=$j,this._modelOption.getDimensionInfoByValue=Kj,this._modelOption.getRectByDimensionData=eH}}wX.type="rangeArea",wX.seriesType=$L.rangeArea,wX.transformerConstructor=TX;class CX extends Rj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class EX extends Bj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="heatmap",this.seriesType=$L.heatmap}}EX.type="heatmap",EX.seriesType=$L.heatmap,EX.transformerConstructor=CX;class BX extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class PX extends Bj{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="correlation",this.seriesType=$L.correlation}}PX.type="correlation",PX.seriesType=$L.correlation,PX.transformerConstructor=BX;function LX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=VO(t.style)),P(t.textStyle)||BR(s.textStyle,VO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&VO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&VO(s.background.style),s}const RX=(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},OX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:aO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class IX extends Iz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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=dR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new nD(this._option,e),this._initSelectedData(),VL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(VL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(BR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(BR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(BR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}IX.specKey="legends";class DX extends IX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return VD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){eI(this._option.dataSet,"discreteLegendFilter",OX),eI(this._option.dataSet,"discreteLegendDataMake",RX);const t=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return VL(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(!Xy(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=CO(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:f,regionIndex:m,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=LX(s):b.title={visible:!1},P(n.focusIconStyle)||VO(n.focusIconStyle),n.shape&&(n.shape=zO(n.shape)),n.label&&(n.label=zO(n.label)),n.value&&(n.value=zO(n.value)),n.background&&(n.background=zO(n.background)),uR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),uR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),uR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||VO(r.railStyle),P(r.sliderStyle)||VO(r.sliderStyle)):(P(r.textStyle)||VO(r.textStyle),r.handler&&zO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(BR(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 KP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(NP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(NP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=HD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=HD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}DX.specKey="legends",DX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},DX.type=r.discreteLegend;const FX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},zX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?FO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const jX={color:tL,size:iL},HX={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}},VX=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({},HX),{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"}}}})},NX={horizontal:VX(!0),vertical:VX(!1)},UX=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({},HX),{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"}}}})},WX={horizontal:UX(!0),vertical:UX(!1)},GX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],YX=[2,10];class $X extends IX{static getSpecInfo(t){const e=VD(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(e){super.init(e),VL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){eI(this._option.dataSet,"continuousLegendFilter",zX),eI(this._option.dataSet,"continuousLegendDataMake",FX);const t=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NL(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=CO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Xy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=CO(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()),P(a)&&(a="color"===this._legendType?GX:YX);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=BR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=LX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=VO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=VO(r.style)),P(a.style)||(w.trackStyle=VO(a.style)),w.startText=zO(o),w.endText=zO(l),w.handlerText=zO(h),P(c)||(w.sizeBackground=VO(c)),d.visible&&!P(d.style)&&(BR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return jX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}$X.specKey="legends",$X.builtInTheme={colorLegend:NX,sizeLegend:WX},$X.type=r.continuousLegend;const XX=(t,e)=>p(e)?t.map((t=>e[t])):void 0,KX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),qX=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function ZX(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=JX(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=>KX(i,s)(t)&&KX(n,r)(t)&&(u(a)||KX([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: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:KO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return ID.globalConfig.uniqueTooltip&&ID.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:KO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return ID.globalConfig.uniqueTooltip&&ID.hideTooltip(l.id),c}return"none"}const JX=(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=XX(c,t);let _=XX(d,t);const y=qX(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(KX(c,v));if(!y&&(_=XX(d,i),!qX(_)))return;const n=e.type===$L.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=jC(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(KX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=XX(d,o),!qX(_))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(KX(c,n));if(!y&&(_=XX(d,r),!qX(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===$L.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(KX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=XX(d,i),!qX(_))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},QX=t=>p(t)&&!y(t),tK=t=>p(t)&&y(t);class eK extends Oz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=BR({},this._theme,r.style),r.offset=BR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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:Wy(this._option.mode)||!Ny(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=y_.getElementById(t.parentElement)):Ny(this._option.mode)&&(t.parentElement=null==Vy?void 0:Vy.body)}}const iK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class sK extends Iz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=eK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Ny(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&QX(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&&ID.globalConfig.uniqueTooltip&&l&&ID.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:KO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:KO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?rH.canvas:rH.dom,n=PR.getComponentPluginInType(t);n||zy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=PR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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)||Wy(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=ZX(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(tK(t)){if(QX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>zF(t,e[i])))}if(tK(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}}sK.type=r.tooltip,sK.transformerConstructor=eK,sK.builtInTheme={tooltip:iK},sK.specKey="tooltip";var nK,rK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(nK||(nK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(rK||(rK={}));const aK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class oK extends Iz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{jC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:qO.chart}:{source:KO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Uy(e)||Wy(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(t.ChartEvent.tooltipHide,{source:KO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:KO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:KO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{aK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}oK.specKey="crosshair";const lK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class hK extends oK{static getSpecInfo(t){return VD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=EF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){EF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:BF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"cartesian");e&&(qj(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=Qj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new rT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new aT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}hK.specKey="crosshair",hK.builtInTheme={crosshair:lK},hK.type=r.cartesianCrosshair;class cK extends oK{static getSpecInfo(t){return VD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=UL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=uz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=HD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new rT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new lT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new hT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new oT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}cK.specKey="crosshair",cK.builtInTheme={crosshair:lK},cK.type=r.polarCrosshair;const dK=(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},uK=(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)},pK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class gK extends Iz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 VL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),VL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this._start+f,0,1),_=mt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=LF(t),this._isHorizontal="horizontal"===RF(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=>!FC(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(FC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};VL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,FC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;FC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else VL(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:n}=this._option;iI(n,"dataview",Sa),eI(n,"dataFilterComputeDomain",pK);const r=new Ta(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new nD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(FC(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&&FC(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,FC(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=FC(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 aE,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||(eI(this._option.dataSet,"dataFilterWithNewDomain",uK),eI(this._option.dataSet,"lockStatisticsFilter",dK),VL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>FC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(FC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=xt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&jC(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,jC(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]}clear(){this._throttledHide=null}}G(gK,uV);class fK extends Oz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=BR({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}}}const mK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),vK={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:mK(!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:mK(!0)};class _K extends gK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=fK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new wE;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(!FC(t.type)||e[0]!==$(e))&&(!jC(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 UB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:VO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:VO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:VO(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:VO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:VO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:VO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:VO(g.style)},selectedBackgroundStyle:VO(this._spec.selectedBackground.style),dragMaskStyle:VO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:BR(VO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},VO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:BR(VO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},VO(null===(d=m.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}=HD(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()}}_K.type=r.dataZoom,_K.transformerConstructor=fK,_K.builtInTheme={dataZoom:vK},_K.specKey="dataZoom";const yK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class bK extends gK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 cM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=LL(this._start,e)&&LL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=VO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=VO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}bK.type=r.scrollBar,bK.builtInTheme={scrollBar:yK},bK.specKey="scrollBar";const xK=(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},SK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),AK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:SK("l1FontSize","primaryFontColor")},content:{visible:!0,style:SK("l2FontSize","tertiaryFontColor")}};class kK extends Iz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return VD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(UO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(UO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){eI(this._option.dataSet,"indicatorFilter",xK);const t=new Ta(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 nD(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=BR({},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({},HO(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?yR(l,this._computeLayoutRadius()):0,dy:h?yR(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({},HO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}kK.type=r.indicator,kK.builtInTheme={indicator:AK},kK.specKey="indicator";const MK=["sum","average","min","max","variance","standardDeviation","median"];function TK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function wK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&TK(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=uR(t.x)?PK(t.x,n)+r.x:LK(l.getXAxisHelper(),[t.x])+r.x,h}function CK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&TK(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=uR(t.y)?PK(t.y,n)+r.y:LK(l.getYAxisHelper(),[t.y])+r.y,h}function EK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&TK(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)),LK(a.angleAxisHelper,[t.angle])}function BK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&TK(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)),LK(a.radiusAxisHelper,[t.radius])}function PK(t,e){return Number(t.substring(0,t.length-1))*e/100}function LK(t,e){const i=t.getScale(0);return FC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function RK(t){return MK.includes(t)}function OK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=wK(t,_,n,u,c,o),r=CK(t,y,n,u,d,o),IK(s,b,S,g.length),IK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=wK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);IK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=CK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);IK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function IK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=EK(t,l,n,r),i=BK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=EK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=BK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function FK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=uR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=uR(i)?Number(i.substring(0,i.length-1))*f/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])&&TK(_,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])&&TK(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:LK(d.getXAxisHelper(),b)+p.x+m,y:LK(d.getYAxisHelper(),x)+p.y+v})})),n}function zK(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])&&TK(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])&&TK(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:LK(l.angleAxisHelper,d),radius:LK(l.radiusAxisHelper,u)})})),s}function jK(t,e,i){let{x:s,y:n}=t;return uR(s)&&(s=PK(s,e)),uR(n)&&(n=PK(n,i)),{x:s,y:n}}function HK(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}=jK(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=>jK(t,n,r)))}function VK(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 NK(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},VO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},WK(VO(n.style),i,s)),p(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=WK(VO(r),i,s)),t}return{visible:!1}}function UK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function WK(t,e,i){return d(t)?t(e,i):t}function GK(t,e){return d(t)?t(e):t}function YK(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 $K(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function XK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=$K(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function KK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=$K(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function qK(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function ZK(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])&&RK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&RK(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])&&RK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&RK(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=>QK(i,t,e))):i.x=QK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>QK(i,t,e))):i.y=QK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>QK(i,t,e))):i.angle=QK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>QK(i,t,e))):i.radius=QK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=QK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const JK={min:(t,e)=>RL(t[0].latestData,e.field),max:(t,e)=>OL(t[0].latestData,e.field),sum:function(t,e){return IL(t[0].latestData,e.field)},average:function(t,e){return DL(t[0].latestData,e.field)},variance:function(t,e){return FL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(FL(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 QK(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(m(t)){const{aggrType:i,field:s}=t;return JK[i](e,{field:s})}return t}function tq(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 eq extends Iz{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 VD(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)&&RK(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 Ma;return e.registerParser("array",s),new Ta(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=UL(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){u(this._spec.offsetX)||(this._layoutOffsetX=gR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=gR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();eI(this._option.dataSet,"markerAggregation",ZK),eI(this._option.dataSet,"markerFilter",tq);const i=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function iq(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=RL(t,e),r=OL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class sq extends eq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=XK(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:WK(VO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>NK(t,this._markerData,this._markAttributeContext))),state:{line:UK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:UK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:UK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return UK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return UK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:WK(VO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:WK(VO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=VK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=XK(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;eI(this._option.dataSet,"markerAggregation",ZK),eI(this._option.dataSet,"markerRegression",iq),eI(this._option.dataSet,"markerFilter",tq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ta(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}sq.specKey="markLine";const nq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),rq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},aq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:nq(!1),endSymbol:nq(!0),label:rq};class oq extends sq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new CP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=XK(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=OK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=FK(i,r,d,e.coordinatesOffset):c&&(y=HK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s;const n=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const s=this._startRelativeSeries,r=this._endRelativeSeries,{multiSegment:a,mainSegmentIndex:o}=this._spec.line||{},{connectDirection:l,expandDistance:h=0}=this._spec;let c;if(uR(h)){const t=s.getRegion(),e=t.getLayoutStartPoint(),i=r.getRegion(),n=i.getLayoutStartPoint();if("bottom"===l||"top"===l){const s=Math.abs(Math.min(e.y,n.y)-Math.max(e.y+t.getLayoutRect().height,n.y+i.getLayoutRect().height));c=Number(h.substring(0,h.length-1))*s/100}else{const s=Math.abs(Math.min(e.x,n.x)-Math.max(e.x+t.getLayoutRect().width,n.x+i.getLayoutRect().width));c=Number(h.substring(0,h.length-1))*s/100}}else c=h;const{points:d,limitRect:u}=n,g=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(d[0],d[1],l,c);let f;f=a&&p(o)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(d[0],d[1],l,c));const m=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),v=Y(n.label),_=Y(this._spec.label);null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:a?[[g[0],g[1]],[g[1],g[2]],[g[2],g[3]]]:g,label:v.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=f.dx)&&void 0!==i?i:0,h=null!==(s=f.dy)&&void 0!==s?s:0;const c=null!==(n=_[e])&&void 0!==n?n:_[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),f),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=m[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:u,multiSegment:a,mainSegmentIndex:o,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(s=this._markerComponent)||void 0===s||s.setAttributes(n)}_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}=XK(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 Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}oq.type=r.markLine,oq.coordinateType="cartesian",oq.builtInTheme={markLine:aq};class lq extends sq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=XK(this._spec);return e||i?new PP(t):new CP(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}=XK(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=DK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=zK(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=XK(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}}}lq.type=r.polarMarkLine,lq.coordinateType="polar",lq.builtInTheme={polarMarkLine:aq};class hq extends Iz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=dR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return VD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=gR(this._spec.width,l.width,null,l.width),c=gR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new sL(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}}hq.type=r.title,hq.specKey=r.title,hq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class cq extends eq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=KK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:WK(VO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>NK(t,this._markerData,this._markAttributeContext))),state:{area:UK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>UK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return UK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=VK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=KK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}cq.specKey="markArea";const dq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class uq extends cq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new BP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=KK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=OK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=OK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=FK(s,a,u,i.coordinatesOffset):d&&(f=HK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=KK(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}}}uq.type=r.markArea,uq.coordinateType="cartesian",uq.builtInTheme={markArea:dq};class pq extends cq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=KK(this._spec);return i||e||s?new LP(t):new BP(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}=KK(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=DK(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=zK(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=KK(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}}}pq.type=r.polarMarkArea,pq.coordinateType="polar",pq.builtInTheme={polarMarkArea:dq};const gq=t=>VO(Object.assign({},t)),fq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},VO(t.style))}),mq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=gq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=gq(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:{},VO(Object.assign({},y)));var y;const b=fq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=fq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=fq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=fq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},vq=t=>"left"===t||"right"===t,_q=t=>"top"===t||"bottom"===t,yq={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class bq extends Iz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},mq(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({},mq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new yL(t):this._playerComponent=new SL(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=vq(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=vq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(pL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(pL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(pL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(pL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=vq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=_q(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):vq(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))):_q(this._orient)?this._maxSize():t.height}_computeDx(t){return vq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return _q(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}bq.builtInTheme={player:yq},bq.specKey="player",bq.type=r.player;class xq extends Iz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=eR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==LI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}xq.type=r.label;class Sq extends gN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}Sq.type="text",Sq.constructorType="label";const Aq=()=>{fN(),PR.registerMark(Sq.constructorType,Sq)};class kq extends Oz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Mq extends xq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=kq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(YO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(YO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),VL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=BR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},OV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[_O])):t=>t.filter((t=>t.data[vO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?IV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Mq.type=r.label,Mq.specKey="label",Mq.transformerConstructor=kq;class Tq extends xq{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[fO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return BR({textStyle:{pickable:!0===this._spec.interactive},position:wq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[_O]:t.data[vO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>IV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function wq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Tq.type=r.totalLabel,Tq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Tq.specKey="totalLabel";class Cq extends eq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=qK(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=NK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=WK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=VO(WK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=WK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=WK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:GK(R.offsetX,this._relativeSeries.getRegion()),offsetY:GK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:WK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:WK(I.style,this._markerData,this._markAttributeContext)},state:{line:UK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:UK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:UK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:UK(J,this._markerData,this._markAttributeContext),textBackground:UK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:UK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:VO(st.style)}):{visible:!1};return new OP(et)}_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}=VK([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:YK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:YK(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}=qK(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Cq.specKey="markPoint";const Eq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Bq extends Cq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=OK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=FK(n,r,h,s.coordinatesOffset)[0]:l&&(c=HK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=qK(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}}}Bq.type=r.markPoint,Bq.coordinateType="cartesian",Bq.builtInTheme={markPoint:Eq};class Pq extends Cq{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=DK(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:le({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}])]}}}Pq.type=r.polarMarkPoint,Pq.coordinateType="polar",Pq.builtInTheme={polarMarkPoint:Eq};class Lq extends Cq{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}])]}}}Lq.type=r.geoMarkPoint,Lq.coordinateType="geo",Lq.builtInTheme={geoMarkPoint:Eq};const Rq="inBrush",Oq="outOfBrush";class Iq extends Iz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return VD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Rq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Oq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new TL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:VO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(bL.brushActive,(s=>{this._initMarkBrushState(i,Oq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(bL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(bL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(bL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(bL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(bL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},VO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Rq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Rq),i.addState(Oq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Rq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Rq),i.addState(Oq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ee(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Rq),s.removeState(Oq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Iq.type=r.brush,Iq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Iq.specKey="brush";class Dq extends Iz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${tO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=mF({},vF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Dq.type=r.customMark,Dq.specKey="customMark";class Fq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>zq(t))),a=n.filter((t=>!zq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>zq(t))),h=o.filter((t=>!zq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function zq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Fq.type="grid";const jq="vchart-tooltip",Hq=`${jq}-container`,Vq=`${jq}-title`,Nq=`${jq}-content-box`,Uq={offsetX:10,offsetY:10},Wq="99999999999999";function Gq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Yq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,$q=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Gq(t):"",Xq=(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},Kq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},qq=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Kq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class Zq extends hz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=GD(null==T?void 0:T.position,b,e),C=null!==(r=GD(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:eO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:iO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Ny(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Yq(e,F),V=Yq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(qq(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=Xq(t,_),W.top=Xq(i,_),W.right=Xq(e,_),W.bottom=Xq(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=Xq(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=qq(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Qq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Jq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Jq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},tZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?gR(e,t.fontSize):0},eZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ni(r),a.padding=Jq(o)),{panelStyle:a,panelPadding:o}};function iZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const sZ=t=>{PR.registerComponentPlugin(t.type,t)};class nZ extends Zq{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(nZ.type),this.type=rH.dom,this._tooltipContainer=null==Vy?void 0:Vy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Vy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=eZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Jq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Qq(h),x=Qq(d),S=Qq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Jq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Jq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Jq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(tZ(p),tZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Vq))),l=a.find((t=>t.className.includes(Nq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Vq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(iZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${jq}-column`),e.classList.add(`${jq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(Nq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];iZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));iZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${jq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=$q(e.key),e.keyStyle&&Qq(e.keyStyle,l)):"value"===i?(o.innerHTML=$q(e.value),e.valueStyle&&Qq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Gq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Gq(c):m,y=p,b=t=>new Sg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=ch.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Gq(u):"currentColor",`\n \n \n \n `;const w=T?ch.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),iZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(Nq))),h=[...o.children].find((t=>t.className.includes(Vq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(Vq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=gR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,iZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},hf||(hf=of.CreateGraphic("richtext",{})),hf.setAttributes(a),hf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function oZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:rZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const lZ=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 Zq{constructor(){super(hZ.type),this.type=rH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=vR(d.padding),x=oZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=oZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=oZ(m,i),k={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},M={panel:lZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=BR({},S,oZ(b,void 0,{})),{width:s,height:n,text:r}=aZ(h,i);T.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(m)){const t=BR({},A,oZ(x,void 0,{})),{width:e,height:s,text:n}=aZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=BR({},x,oZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=aZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}hZ.type=rH.canvas;const cZ=()=>{sZ(hZ)},dZ=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values($L).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=PR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,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?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=PR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.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];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},uZ=(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=dZ(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):TR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=BR({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:BR(f,m),hasChanged:!0};const i=BR({},t,m);wR(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},pZ=t=>{PR.registerChartPlugin(t.type,t)};class gZ extends hz{constructor(){super(gZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[gZ.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[gZ.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=ER(this._option.globalInstance.getSpec(),["data",gZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=ER(this._baseChartSpec,["data",gZ.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=uZ(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=ER(i,["data",gZ.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()}}gZ.pluginType="chart",gZ.specKey="media",gZ.type="MediaQueryPlugin";const fZ=/\{([^}]+)\}/,mZ=/\{([^}]+)\}/g,vZ=/:/;class _Z extends hz{constructor(){super(_Z.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[_Z.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)),PR.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=fZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(mZ,((t,i)=>{if(!vZ.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(yi.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}}_Z.pluginType="chart",_Z.specKey="formatter",_Z.type="formatterPlugin";ID.useRegisters([()=>{cH(),uH(),gH(),Vj(),Hj(),Mj(),mj(),JF(),tz(),kD(),xD(),hj(),rj(),PR.registerSeries(Tj.type,Tj),PR.registerChart(fH.type,fH)},()=>{cH(),uH(),gH(),Hj(),Mj(),mj(),JF(),_H(),tz(),xH(),hj(),rj(),PR.registerSeries(AH.type,AH),Vj(),PR.registerChart(MH.type,MH)},()=>{cH(),uH(),gH(),Hj(),jH(),Vj(),PR.registerChart(VH.type,VH)},()=>{cH(),uH(),Vj(),Hj(),ZH(),PR.registerChart(QH.type,QH)},()=>{uH(),KN(),PR.registerChart(U$.type,U$)},()=>{cH(),uH(),Vj(),Hj(),gU(),PR.registerChart(Y$.type,Y$)},()=>{cH(),uH(),gH(),Vj(),Hj(),AU(),PR.registerChart(X$.type,X$)},()=>{cH(),uH(),gH(),Vj(),Hj(),jH(),PR.registerChart(tX.type,tX)},()=>{uH(),fV(),rV(),PR.registerSeries(vV.type,vV),PR.registerImplement("registerMap",aI),PR.registerImplement("unregisterMap",oI),SD(),PR.registerChart(F$.type,F$)},()=>{uH(),e$(),PR.registerSeries(s$.type,s$),UN(),zU(),cU(),VU(),PR.registerChart(nX.type,nX)},()=>{uH(),CG(),PR.registerChart(oX.type,oX)},()=>{uH(),XG(),PR.registerChart(hX.type,hX)},()=>{cH(),uH(),gH(),Vj(),Hj(),YV(),PR.registerChart(xX.type,xX)},()=>{cH(),uH(),Vj(),Hj(),pN(),PR.registerChart(AX.type,AX)},()=>{cH(),uH(),Vj(),Hj(),VU(),PR.registerChart(iX.type,iX)},()=>{cH(),uH(),Vj(),Hj(),KU(),PR.registerChart(dX.type,dX)},()=>{cH(),uH(),Vj(),Hj(),kN(),PR.registerChart(pX.type,pX)},()=>{cH(),uH(),gH(),Vj(),Hj(),_H(),hj(),rj(),PR.registerSeries(EN.type,EN),PR.registerChart(wX.type,wX)},()=>{uH(),uY(),PR.registerChart(fX.type,fX)},()=>{uH(),_Y(),PR.registerChart(vX.type,vX)},()=>{uH(),GY(),PR.registerChart(yX.type,yX)},()=>{uH(),Eh.load(gM),FY(),PR.registerChart(MX.type,MX)},()=>{uH(),c$(),PR.registerChart(EX.type,EX)},()=>{uH(),A$(),PR.registerChart(PX.type,PX)},()=>{cH(),uH(),gH(),Vj(),PR.registerChart(q$.type,q$),Hj()},rj,hj,()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),Nz(),PR.registerComponent(cj.type,cj)},()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),Nz(),PR.registerComponent(dj.type,dj)},()=>{PR.registerGraphicComponent(Dz.lineAxis,((t,e)=>new kC(t,e))),PR.registerGraphicComponent(Fz.lineAxisGrid,((t,e)=>new OB(t,e))),Nz(),PR.registerComponent(uj.type,uj)},uU,cU,()=>{PR.registerComponent(DX.type,DX)},()=>{PR.registerComponent($X.type,$X)},()=>{PR.registerComponent(sK.type,sK)},()=>{PR.registerComponent(hK.type,hK)},()=>{PR.registerComponent(cK.type,cK)},()=>{PR.registerComponent(_K.type,_K)},()=>{PR.registerComponent(bK.type,bK)},()=>{PR.registerComponent(kK.type,kK)},fV,()=>{PR.registerComponent(oq.type,oq),wP()},()=>{PR.registerComponent(uq.type,uq),EP()},()=>{PR.registerComponent(Bq.type,Bq),RP()},()=>{PR.registerComponent(lq.type,lq),PP._animate=lP,wP()},()=>{PR.registerComponent(pq.type,pq),LP._animate=cP,EP()},()=>{PR.registerComponent(Pq.type,Pq),RP()},()=>{PR.registerComponent(Lq.type,Lq),RP()},()=>{PR.registerComponent(hq.type,hq)},()=>{PR.registerComponent(bq.type,bq)},()=>{PR.registerGraphicComponent(Mq.type,(t=>new BB(t))),Aq(),jz(),PR.registerComponent(Mq.type,Mq,!0,1/0)},()=>{PR.registerGraphicComponent(Tq.type,(t=>new BB(t))),Aq(),jz(),PR.registerComponent(Tq.type,Tq,!0)},()=>{PR.registerComponent(Iq.type,Iq)},()=>{PR.registerComponent(Dq.type,Dq)},()=>{Eh.load(sT)},()=>{PR.registerLayout(Fq.type,Fq)},cZ,BD,RD]),ID.useRegisters([()=>{nA(Eh)}]),t.AxisSyncPlugin=cz,t.CanvasTooltipHandler=hZ,t.DEFAULT_CHART_HEIGHT=iO,t.DEFAULT_CHART_WIDTH=eO,t.DEFAULT_CLOSE_STROKE_JOIN=zD,t.DEFAULT_DATA_INDEX=nO,t.DEFAULT_DATA_KEY=rO,t.DEFAULT_DATA_SERIES_FIELD=aO,t.DEFAULT_KEY=MO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=FD,t.DEFAULT_MEASURE_CANVAS_ID=sO,t.DEFAULT_SERIES_STYLE_NAME=oO,t.DEFAULT_SMOOTH_INTERPOLATE=DD,t.DomTooltipHandler=nZ,t.Factory=PR,t.FormatterPlugin=_Z,t.MOSAIC_CAT_END_PERCENT=SO,t.MOSAIC_CAT_START_PERCENT=xO,t.MOSAIC_VALUE_END_PERCENT=bO,t.MOSAIC_VALUE_START_PERCENT=yO,t.ManualTicker=class extends aw{constructor(t){super(t),this.lastFrameTime=0,this.status=To.RUNNING}setupTickHandler(){const t=new ow;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===To.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===To.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=To.RUNNING,!0}},t.MediaQuery=gZ,t.PREFIX=tO,t.SEGMENT_FIELD_END=kO,t.SEGMENT_FIELD_START=AO,t.STACK_FIELD_END=cO,t.STACK_FIELD_END_OffsetSilhouette=gO,t.STACK_FIELD_END_PERCENT=uO,t.STACK_FIELD_KEY=lO,t.STACK_FIELD_START=hO,t.STACK_FIELD_START_OffsetSilhouette=pO,t.STACK_FIELD_START_PERCENT=dO,t.STACK_FIELD_TOTAL=fO,t.STACK_FIELD_TOTAL_BOTTOM=_O,t.STACK_FIELD_TOTAL_PERCENT=mO,t.STACK_FIELD_TOTAL_TOP=vO,t.StreamLight=class extends bw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=mo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Fl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=mo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Uo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=sl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=sl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{sZ(nZ)},t.registerFormatPlugin=()=>{pZ(_Z)},t.registerMediaQuery=()=>{pZ(gZ)},t.registerTheme=VR,t.removeTheme=UR,t.themeExist=WR,t.themes=zR,t.token=AR,t.transformColorSchemeToStandardStruct=nR,t.transformToGraphic=VO,t.version="2.0.5",t.vglobal=y_,t.warn=Fy,Object.defineProperty(t,"__esModule",{value:!0})})); +let mG=class t extends nG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),A=S*this.gridSize,k=x*this.gridSize;d.setAttribute("width",""+A),d.setAttribute("height",""+k),u.scale(1,1),u.translate(A/2,k/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,A,k).data;if(this.exceedTime())return null;const T=[];let w,C=S;const E=[x/2,S/2,x/2,S/2],B=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*A+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(w=x;w--;)B(C,w,T);return{datum:t,occupied:T,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,e=1){const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),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,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?uG(t,o,l.width,l.height,h):"geometric"===t.type&&fG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=tG(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()}};mG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vG extends nG{constructor(t){super(j({},vG.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)}vG.defaultOptions={enlarge:!1};const yG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bG=(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?xG(t.fontFamily):"sans-serif",d=t.fontStyle?xG(t.fontStyle):"normal",u=t.fontWeight?xG(t.fontWeight):"normal",p=t.rotate?xG(t.rotate):0,g=xG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?xG(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,A=t.randomVisible,k=t.as?Object.assign(Object.assign({},yG),t.as):yG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?xG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=AG(kG(t,l),C);w=i=>e(t(i))}let E=aG;"fast"===t.layoutType?E=vG:"grid"===t.layoutType&&(E=mG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},xG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),AG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SG(t[0]),n=SG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},kG=(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 MG(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{BR.registerGrammarTransform("wordcloud",{transform:bG}),gN(),BR.registerAnimation("wordCloud",((t,e)=>({appear:nW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),BR.registerSeries(TG.type,TG)},CG=(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:f=!1,isCone:m=!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=k(y*v)&&0!==v?y/v:0,S=k(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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EG=(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},BG=`${QR}_FUNNEL_TRANSFORM_RATIO`,PG=`${QR}_FUNNEL_REACH_RATIO`,LG=`${QR}_FUNNEL_HEIGHT_RATIO`,RG=`${QR}_FUNNEL_VALUE_RATIO`,OG=`${QR}_FUNNEL_LAST_VALUE_RATIO`,IG=`${QR}_FUNNEL_NEXT_VALUE_RATIO`,DG=`${QR}_FUNNEL_LAST_VALUE`,FG=`${QR}_FUNNEL_CURRENT_VALUE`,zG=`${QR}_FUNNEL_NEXT_VALUE`,jG=`${QR}_FUNNEL_TRANSFORM_LEVEL`;class HG extends KD{constructor(t){var e,i;super(t),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?this._transformRatioText:null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[PG])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class VG extends lD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class NG extends VG{constructor(){super(...arguments),this.type=NG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}NG.type="polygon";const UG=()=>{BR.registerMark(NG.type,NG),Xk(),Nk(),lw.registerBuiltInAnimate("growPointsOut",rC),BR.registerGraphicComponent("polygon",rf)},WG=Object.assign(Object.assign({},oF),{funnel:{name:"funnel",type:"polygon"},transform:{name:"transform",type:"polygon"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class GG extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class YG extends kF{constructor(){super(...arguments),this.type=YL.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=GG,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;tI(this._dataSet,"funnel",CG),tI(this._dataSet,"funnelTransform",EG);const t=new Ta(this._dataSet,{name:`${QR}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new sD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FG,asTransformRatio:BG,asReachRatio:PG,asHeightRatio:LG,asValueRatio:RG,asNextValueRatio:IG,asLastValueRatio:OG,asLastValue:DG,asNextValue:zG,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:jG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},YG.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:yF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},YG.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(YG.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(YG.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new HG(this),this._funnelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelMark),this._funnelTransformMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._funnelTransformMark)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",t.AttributeLevel.Series);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===this._funnelMark){this._labelMark=e,this.setMarkStyle(e,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Oy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&Oy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*UL(PG).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",t.AttributeLevel.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),mF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(fF(BR.getAnimationInKey("fadeInOut")(),mF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(fF(BR.getAnimationInKey("funnel")({},o),mF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(fF(null===(a=BR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),mF("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[OG])/2:this._getSecondaryAxisLength(t[RG])/2,n=this._getSecondaryAxisLength(t[RG])/2):(s=this._getSecondaryAxisLength(t[RG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[IG])/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[jG])}_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[nO]===t[nO]));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;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(_=this._getPolygonCenter(i).y-s/2-e,y=!1!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{UG(),gN(),TV(),BR.registerSeries(YG.type,YG),BR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},yD))),BR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vw,customParameters:(e,i)=>({animationType:"out",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),xD()},XG=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},KG=t=>{const e=t.filter((t=>t.context.diffState===PI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},qG=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},ZG=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=KG(i.parent.children),a=qG(r,s,n);return XG(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=KG(i.parent.children),a=qG(r,s,n);return XG(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),JG=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},QG=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=KG(i.parent.children),a=JG(r);return XG(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=KG(i.parent.children),a=JG(r);return XG(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),tY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},eY=(t,e={})=>{if(!t)return[];const i=[];return lW(t,i,e),i},iY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new IW(i).layout(t,{width:s,height:n})};class sY extends KD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var nY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(nY||(nY={}));const rY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===nY.DrillDown){return Y(OO(t,n,s,"children"))}if(i.type===nY.DrillUp){const e=IO(t,n,s,"children");if(e)return Y(e)}return t};class aY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=hV(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;tI(t,"drillFilter",rY),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(e=[]){const{getRawData:i,event:s}=this._drillParams;if(!y(e)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:nY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:nY.DrillDown},model:this}),e}drillUp(){var e,i;const{getRawData:s,event:n}=this._drillParams,r=null!==(i=null===(e=this._drillInfo)||void 0===e?void 0:e.path)&&void 0!==i?i:[];if(!y(r)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:nY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:nY.DrillUp},model:this}),r}}const oY=Object.assign(Object.assign({},oF),{sunburst:{name:"sunburst",type:"arc"}}),lY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:tF,operations:["max","min","values"]}),t.push({key:eF,operations:["values"]}),t),hY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:{type:"palette",key:"primaryFontColor"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}};class cY extends EN{constructor(){super(...arguments),this.type=YL.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:eF),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:nO},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),tI(this._dataSet,"sunburstLayout",iY),tI(this._dataSet,"flatten",eY),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 lY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(tI(t.dataSet,"addVChartProperty",ND),t.transform({type:"addVChartProperty",options:{beforeCall:rF.bind(this),call:aF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(cY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(cY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new sY(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(fF(null===(e=BR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),mF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),mF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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}}cY.type=YL.sunburst,cY.mark=oY,cY.builtInTheme={sunburst:hY},G(cY,aY);const dY=()=>{BR.registerSeries(cY.type,cY),NN(),gN(),xD(),BR.registerAnimation("sunburst",((t,e)=>({appear:tY(0,e),enter:ZG(t),exit:QG(t),disappear:QG(t)})))},uY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new kW(i).layout(t,{width:s,height:n})};class pY extends KD{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const gY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},fY=Object.assign(Object.assign({},oF),{circlePacking:{name:"circlePacking",type:"arc"}});class mY extends wF{constructor(){super(...arguments),this.type=YL.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:eF),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:nO},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),tI(this._dataSet,"circlePackingLayout",uY),tI(this._dataSet,"flatten",eY),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)||(tI(t.dataSet,"addVChartProperty",ND),t.transform({type:"addVChartProperty",options:{beforeCall:rF.bind(this),call:aF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(mY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(mY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return lY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new pY(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(fF(null===(i=BR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),mF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),mF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}mY.type=YL.circlePacking,mY.mark=fY,mY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}},label:{visible:!0,style:{cursor:"pointer",fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},G(mY,aY);const vY=()=>{BR.registerSeries(mY.type,mY),NN(),gN(),bD(),BR.registerAnimation("circlePacking",((t,e)=>({appear:gY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},_Y=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&_Y(t,e.children,i)}))},yY=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},bY=(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 LW(e),r=[];return r.push(n.layout(s,i)),r},xY=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:[]},SY=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 AY extends KD{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 kY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),MY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:kY(t),TY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class wY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class CY extends yw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const EY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},BY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class PY extends qV{constructor(){super(...arguments),this.type=PY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?BY:EY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}PY.type="linkPath";const LY=Object.assign(Object.assign({},oF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class RY extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const OY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class IY extends wF{constructor(){super(...arguments),this.type=YL.sankey,this.transformerConstructor=RY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new je,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=NO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=NO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=NO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),OY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=NO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=NO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=NO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=NO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=NO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void OY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void OY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(NO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=NO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=NO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void OY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void OY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void OY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){tI(this._dataSet,"sankeyLayout",bY),tI(this._dataSet,"sankeyFormat",yY),a.transform({type:"sankeyFormat"},!1),r.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;tI(o,"sankeyNodes",xY),tI(o,"flatten",eY);const l=new Ta(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),l.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}},!1),this._nodesSeriesData=l,tI(o,"sankeyLinks",SY);const h=new Ta(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:sF.bind(this),call:nF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(IY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(IY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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 e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=jD(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(fF(null===(i=BR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),mF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),mF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:KO.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(NO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new AY(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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new rR;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 _Y(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}IY.type=YL.sankey,IY.transformerConstructor=RY,IY.mark=LY,IY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const DY=()=>{LH(),ZV(),Hk(),BR.registerGraphicComponent("path",(t=>Kg(t))),BR.registerMark(PY.type,PY),gN(),BR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:MY(t,e)},yD))),BR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:TY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),lw.registerBuiltInAnimate("linkPathGrowOut",CY),lw.registerBuiltInAnimate("linkPathGrowIn",wY),xD(),BR.registerSeries(IY.type,IY)},FY=(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=eY(n);return i=ZD([{latestData:r}],e),i};class zY extends KD{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 jY=Object.assign(Object.assign({},oF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),HY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class VY extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const NY=(t,e)=>{if(e.getViewBox()){const i=new jW(e).layout(t,e.getViewBox()),s=[];return lW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[eF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class UY extends wF{constructor(){super(...arguments),this.type=YL.treemap,this.transformerConstructor=VY,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:eF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:nO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),tI(this._dataSet,"treemap",NY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(tI(this._rawData.dataSet,"addVChartProperty",ND),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:rF.bind(this),call:aF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=FY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){tI(this._dataSet,"hierarchyDimensionStatistics",FY),tI(this._dataSet,"flatten",eY);const i=new Ta(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 lY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(UY.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(UY.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initNonLeafLabelMarkStyle(e){e&&(this._nonLeafLabelMark=e,e.setRule("treemap"),this.setMarkStyle(e,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),mF(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 zY(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(GO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(GO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}UY.type=YL.treemap,UY.mark=jY,UY.builtInTheme={treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}}},UY.transformerConstructor=VY,G(UY,aY),G(UY,dV);const WY=()=>{BR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),BR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),LH(),gN(),BR.registerAnimation("treemap",((t,e)=>({appear:HY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),xD(),BR.registerSeries(UY.type,UY)},GY=Object.assign(Object.assign({},LU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),YY=Object.assign(Object.assign({},oF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),$Y={type:"fadeIn"};function XY(t,e){return"fadeIn"===e?$Y:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class KY extends AF{constructor(){super(...arguments),this._supportStack=!1}}class qY extends KD{enableByType(t){return"dimension"!==t}}const ZY="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",JY={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:ZY,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:ZY,fill:"#ddd"}}};class QY extends RU{constructor(){super(...arguments),this.type=YL.gaugePointer,this.transformerConstructor=KY,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(QY.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},QY.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(QY.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 qY(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=mt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}getInteractionTriggers(){return this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(fF(null===(i=BR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),mF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}QY.type=YL.gaugePointer,QY.mark=YY,QY.builtInTheme={gaugePointer:JY},QY.transformerConstructor=KY;const t$=()=>{BR.registerSeries(QY.type,QY),nV(),LH(),BR.registerAnimation("gaugePointer",((t,e)=>{const i=XY(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),dU(),hU()};class e$ extends AF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class i$ extends RU{constructor(){super(...arguments),this.type=YL.gauge,this.transformerConstructor=e$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();tI(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[AO]=t[this._angleField[0]],t[SO]=e>0?i[e-1][AO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(i$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(i$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?lR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[SO])?this.angleAxisHelper.dataToPosition([t[SO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[AO]])}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(fF(null===(i=BR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),mF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}i$.type=YL.gauge,i$.mark=GY,i$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},i$.transformerConstructor=e$;class s$ extends lD{constructor(){super(...arguments),this.type=s$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return kg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}s$.type="cell";function n$(t){return!1===t?{}:{type:"fadeIn"}}class r$ extends KD{enableByType(t){return"dimension"!==t}}const a$=Object.assign(Object.assign({},oF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class o$ extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class l$ extends wF{constructor(){super(...arguments),this.type=YL.heatmap,this.transformerConstructor=o$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(l$.mark.cell,{isSeriesMark:!0},{morph:yF(this._spec,l$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(l$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}initCellBackgroundMarkStyle(){var e,i,s;const n=ni(null!==(s=null===(i=null===(e=this._spec.cellBackground)||void 0===e?void 0:e.style)||void 0===i?void 0:i.padding)&&void 0!==s?s:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+n[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+n[0]},width:()=>this.getCellSize(this._xAxisHelper)-n[1]-n[3],height:()=>this.getCellSize(this._yAxisHelper)-n[0]-n[2]},"normal",t.AttributeLevel.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}getInteractionTriggers(){return this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=TF(this);this._cellMark.setAnimationConfig(fF(null===(i=BR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),mF("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 r$(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]}}l$.type=YL.heatmap,l$.mark=a$,l$.builtInTheme={heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}}},l$.transformerConstructor=o$;const h$=()=>{gN(),BR.registerMark(s$.type,s$),BR.registerGraphicComponent("symbol",kg),Xk(),qk(),yB(),BR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},yD),{appear:n$(e)}))),lj(),nj(),BR.registerSeries(l$.type,l$)},c$=Object.assign(Object.assign({},oF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),d$=`${QR}_CORRELATION_X`,u$=`${QR}_CORRELATION_Y`,p$=`${QR}_CORRELATION_SIZE`,g$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=re(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Bt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Bt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Bt(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+Bt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Et(e.field),C=t.map(w),[E,B]=Lt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Et(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Lt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=f$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=T[0]+i*Math.cos(a),r=T[1]+i*Math.sin(a),m$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,a>D?a=I: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},m$=(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,[sO]:null==n?void 0:n[sO],[rO]:null==n?void 0:n[rO]}};class _$ extends qV{constructor(){super(...arguments),this.type=_$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}_$.type="ripple";const y$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class b$ extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class x$ extends EN{constructor(){super(...arguments),this.type=YL.correlation,this.transformerConstructor=b$,this._viewBox=new je}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;tI(this._dataSet,"correlation",g$);const s=new Ma;eI(s,"dataview",Sa),tI(s,"correlationCenter",v$);const n=new Ta(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 sD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){const e=this._createMark(x$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:sO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(x$.mark.ripplePoint,{key:sO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(x$.mark.centerPoint,{key:sO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var e,i,s,n;const r=this._nodePointMark;if(!r)return;const a=null!==(i=null===(e=this._spec.nodePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(r,{x:t=>t[d$],y:t=>t[u$],size:t=>t[p$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRipplePointMarkStyle(){var e,i,s,n,r;const a=this._ripplePointMark;if(!a)return;const o=null!==(i=null===(e=this._spec.ripplePoint)||void 0===e?void 0:e.style)&&void 0!==i?i:{};this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=o.fill)&&void 0!==s?s:this.getColorAttribute(),opacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.2,ripple:null!==(r=o.ripple)&&void 0!==r?r:0},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initCenterPointMarkStyle(){var e,i,s,n,r,a;const o=this._centerPointMark;o&&this.setMarkStyle(o,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(s=null===(i=null===(e=this._spec.centerPoint)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(a=null===(r=null===(n=this._spec.centerPoint)||void 0===n?void 0:n.style)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(e){e&&this.setMarkStyle(e,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),mF("nodePoint",this._spec,this._markAttributeContext)))}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._nodePointMark,this._centerPointMark]}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}x$.type=YL.correlation,x$.mark=c$,x$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},x$.transformerConstructor=b$;const S$=()=>{QF(),ZV(),qk(),BR.registerMark(_$.type,_$),BR.registerGraphicComponent("symbol",(t=>kg(t))),BR.registerSeries(x$.type,x$),BR.registerAnimation("correlation",((t,e)=>Object.assign({appear:y$(0,e)},_D)))},A$=Object.assign(Object.assign({},oF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class k$ extends qV{constructor(){super(...arguments),this.type=k$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}k$.type="liquid";const M$=(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 T$ extends KD{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 w$ extends kF{constructor(){super(...arguments),this.type=YL.liquid,this.transformerConstructor=tz,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 f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Pg({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=kg({x:s,y:n,size:r,symbolType:M$(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=mR(this._spec.outlineMargin),this._paddingSpec=mR(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=Wt(...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(w$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(w$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(w$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(w$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new T$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(fF(null===(i=BR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),mF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(fF(null===(s=BR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),mF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=bM(t.attribute.fill,n.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}w$.type=YL.liquid,w$.mark=A$,w$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},w$.transformerConstructor=tz;const C$=t=>Y(t).join(",");class E$ extends KD{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>C$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>C$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const B$=Object.assign(Object.assign({},oF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class P$ extends AF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const L$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?ZW(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class R$ extends kF{constructor(){super(...arguments),this.type=YL.venn,this.transformerConstructor=P$,this._viewBox=new je}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:nO)}initData(){var t;super.initData(),tI(this._dataSet,"venn",L$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(R$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(R$.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.STATE_HOVER,t.AttributeLevel.Series))}initLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>C$(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initOverlapLabelMarkStyle(e){e&&(this._labelMark=e,e.setRule("venn"),this.setMarkStyle(e,{x:t=>t.labelX,y:t=>t.labelY,text:t=>C$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new E$(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:C$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return C$(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[C$(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(C$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),mF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(fF(null===(e=BR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),mF(t.name,this._spec,this._markAttributeContext)))}))}}R$.type=YL.venn,R$.mark=B$,R$.builtInTheme={venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}}},R$.transformerConstructor=P$;class O$ extends FH{constructor(){super(...arguments),this.type=YL.mosaic,this.transformerConstructor=DH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(yO),this.setFieldX2(_O)),this.setFieldY(xO),this.setFieldY2(bO)):(t&&(this.setFieldY(yO),this.setFieldY2(_O)),this.setFieldX(xO),this.setFieldX2(bO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}O$.type=YL.mosaic,O$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},O$.transformerConstructor=DH;class I$ extends Pj{_isValidSeries(t){return t===YL.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class D$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="map",this.seriesType=YL.map}}D$.type="map",D$.seriesType=YL.map,D$.transformerConstructor=I$;class F$ extends Pj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 z$ extends F${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=uz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,ER({},s,l)),n&&Object.assign(o,ER({},n,o))}}class j$ extends F${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class H$ extends F${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class V$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=H$}}V$.transformerConstructor=H$;class N$ extends V${constructor(){super(...arguments),this.transformerConstructor=H$,this.type="pie",this.seriesType=YL.pie}}N$.type="pie",N$.seriesType=YL.pie,N$.transformerConstructor=H$;class U$ extends j${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Cz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Cz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>ER({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const W$=(t,e)=>{if(!t)return null;const i=VF(t,(t=>"angle"===t.getOrient()),e),s=VF(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&&zC(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=FL({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=zL(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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=jF(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&&zC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FL({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=zL(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 _=jF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class G$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="rose",this.seriesType=YL.rose}_setModelOption(){this._modelOption.getDimensionInfo=W$}}G$.type="rose",G$.seriesType=YL.rose,G$.transformerConstructor=U$,G(G$,Dj);class Y$ extends j${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=ER({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>ER({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class $$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="radar",this.seriesType=YL.radar}_setModelOption(){this._modelOption.getDimensionInfo=W$}}$$.type="radar",$$.seriesType=YL.radar,$$.transformerConstructor=Y$,G($$,Dj);class X$ extends Pj{_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=>{L(e,"trimPadding")&&ER(e,wI(this.type,t))})),this._transformAxisSpec(t)}}class K$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=Yj(t,e,i))&&void 0!==s?s:[],...null!==(n=W$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}K$.type="common",K$.transformerConstructor=X$,G(K$,Dj);class q$ extends Lj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class Z$ extends Ej{constructor(){super(...arguments),this.transformerConstructor=q$}}Z$.transformerConstructor=q$,G(Z$,Dj);class J$ extends q${transformSpec(t){super.transformSpec(t),kI(t)}}class Q$ extends Z${constructor(){super(...arguments),this.transformerConstructor=J$,this.type="histogram",this.seriesType=YL.bar}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}Q$.type="histogram",Q$.seriesType=YL.bar,Q$.transformerConstructor=J$;class tX extends z${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class eX extends Ej{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="circularProgress",this.seriesType=YL.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=W$}}eX.type="circularProgress",eX.seriesType=YL.circularProgress,eX.transformerConstructor=tX,G(eX,Dj);class iX extends z${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=YL.circularProgress,e}transformSpec(e){var i,s,n,r,a;super.transformSpec(e);let o=null===(i=e.series)||void 0===i?void 0:i.find((t=>t.type===YL.gauge||t.type===YL.circularProgress));u(o)&&(o=null!==(s=e.gauge)&&void 0!==s?s:this._getDefaultCircularProgressSeriesSpec(e),"circularProgress"===o.type&&(u(o.radiusField)&&u(o.categoryField)&&(o.radiusField=null!==(r=null!==(n=e.radiusField)&&void 0!==n?n:e.categoryField)&&void 0!==r?r:e.seriesField),u(o.valueField)&&u(o.angleField)&&(o.valueField=null!==(a=e.valueField)&&void 0!==a?a:e.angleField)),1===e.series.length?e.series.push(o):e.series.forEach((t=>{t.type===o.type&&Object.keys(o).forEach((e=>{e in t||(t[e]=o[e])}))}))),o.type===YL.circularProgress?this._transformProgressAxisSpec(e,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:t.LayoutZIndex.Region+50}):this._transformGaugeAxisSpec(e)}_transformGaugeAxisSpec(e){var i;e.axes||(e.axes=[]);const s={radius:null,angle:null};(null!==(i=e.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle={orient:"angle",visible:!0},e.axes.push(s.angle)),s.radius||(s.radius={orient:"radius",visible:!1},e.axes.push(s.radius)),u(s.angle.type)&&(s.angle.type="linear"),u(s.radius.type)&&(s.radius.type="linear"),u(s.angle.zIndex)&&(s.angle.zIndex=t.LayoutZIndex.Region+50)}}class sX extends Ej{constructor(){super(...arguments),this.transformerConstructor=iX,this.type="gauge",this.seriesType=YL.gaugePointer}}sX.type="gauge",sX.seriesType=YL.gaugePointer,sX.transformerConstructor=iX;class nX extends Pj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class rX extends Ej{constructor(){super(...arguments),this.transformerConstructor=nX,this.type="wordCloud",this.seriesType=YL.wordCloud}}rX.transformerConstructor=nX;class aX extends rX{constructor(){super(...arguments),this.transformerConstructor=nX,this.type="wordCloud",this.seriesType=YL.wordCloud}}aX.type="wordCloud",aX.seriesType=YL.wordCloud,aX.transformerConstructor=nX;class oX extends Pj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class lX extends Ej{constructor(){super(...arguments),this.transformerConstructor=oX,this.type="funnel",this.seriesType=YL.funnel}}lX.type="funnel",lX.seriesType=YL.funnel,lX.transformerConstructor=oX;class hX extends Lj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=uz(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=uz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class cX extends Ej{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="linearProgress",this.seriesType=YL.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}cX.type="linearProgress",cX.seriesType=YL.linearProgress,cX.transformerConstructor=hX,G(cX,Dj);class dX extends Lj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),kI(t)}}class uX extends Ej{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="rangeColumn",this.seriesType=YL.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}uX.type="rangeColumn",uX.seriesType=YL.rangeColumn,uX.transformerConstructor=dX;class pX extends Pj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gX extends Ej{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="sunburst",this.seriesType=YL.sunburst}}gX.type="sunburst",gX.seriesType=YL.sunburst,gX.transformerConstructor=pX;class fX extends Pj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class mX extends Ej{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="circlePacking",this.seriesType=YL.circlePacking}}mX.type="circlePacking",mX.seriesType=YL.circlePacking,mX.transformerConstructor=fX;class vX extends Pj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _X extends Ej{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="treemap",this.seriesType=YL.treemap}}_X.type="treemap",_X.seriesType=YL.treemap,_X.transformerConstructor=vX;class yX extends jH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),kI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class bX extends HH{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="waterfall",this.seriesType=YL.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}bX.type="waterfall",bX.seriesType=YL.waterfall,bX.transformerConstructor=yX;class xX extends Lj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),kI(t)}}class SX extends Ej{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="boxPlot",this.seriesType=YL.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}SX.type="boxPlot",SX.seriesType=YL.boxPlot,SX.transformerConstructor=xX;class AX extends Pj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kX extends Ej{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="sankey",this.seriesType=YL.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=NO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}kX.type="sankey",kX.seriesType=YL.sankey,kX.transformerConstructor=AX;class MX extends Lj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),kI(t)}}class TX extends Ej{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="rangeArea",this.seriesType=YL.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=Yj,this._modelOption.getDimensionInfoByValue=Xj,this._modelOption.getRectByDimensionData=tH}}TX.type="rangeArea",TX.seriesType=YL.rangeArea,TX.transformerConstructor=MX;class wX extends Lj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class CX extends Ej{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="heatmap",this.seriesType=YL.heatmap}}CX.type="heatmap",CX.seriesType=YL.heatmap,CX.transformerConstructor=wX;class EX extends Pj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class BX extends Ej{constructor(){super(...arguments),this.transformerConstructor=EX,this.type="correlation",this.seriesType=YL.correlation}}BX.type="correlation",BX.seriesType=YL.correlation,BX.transformerConstructor=EX;function PX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=HO(t.style)),P(t.textStyle)||ER(s.textStyle,HO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&HO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&HO(s.background.style),s}const LX=(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},RX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:rO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class OX extends Oz{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Legend,this.layoutLevel=t.LayoutLevel.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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=cR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new sD(this._option,e),this._initSelectedData(),HL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(HL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(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)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(ER({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(ER({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(ER({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}OX.specKey="legends";class IX extends OX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return HD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){tI(this._option.dataSet,"discreteLegendFilter",RX),tI(this._option.dataSet,"discreteLegendDataMake",LX);const t=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HL(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(!$y(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=wO(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:f,regionIndex:m,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=PX(s):b.title={visible:!1},P(n.focusIconStyle)||HO(n.focusIconStyle),n.shape&&(n.shape=FO(n.shape)),n.label&&(n.label=FO(n.label)),n.value&&(n.value=FO(n.value)),n.background&&(n.background=FO(n.background)),dR(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),dR(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),dR(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(P(r.railStyle)||HO(r.railStyle),P(r.sliderStyle)||HO(r.sliderStyle)):(P(r.textStyle)||HO(r.textStyle),r.handler&&FO(r.handler)),b.pager=r,a.visible&&!P(a.style)&&(ER(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 XP}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener(VP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(VP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(VP.legendItemUnHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemUnHover,{model:this,value:i,event:e})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:k(s)?s:1,strokeOpacity:k(n)?n:1,opacity:k(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}=jD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=jD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}IX.specKey="legends",IX.builtInTheme={discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1}},IX.type=r.discreteLegend;const DX=(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;k(n)&&(t=Math.min(n,t)),k(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},FX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?DO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const zX={color:QP,size:eL},jX={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}},HX=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({},jX),{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"}}}})},VX={horizontal:HX(!0),vertical:HX(!1)},NX=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({},jX),{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"}}}})},UX={horizontal:NX(!0),vertical:NX(!1)},WX=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],GX=[2,10];class YX extends OX{static getSpecInfo(t){const e=HD(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(e){super.init(e),HL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){tI(this._option.dataSet,"continuousLegendFilter",FX),tI(this._option.dataSet,"continuousLegendDataMake",DX);const t=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>VL(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=wO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!$y(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=wO(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()),P(a)&&(a="color"===this._legendType?WX:GX);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=ER({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:A,seriesIndex:k,seriesId:M,padding:T}=i,w=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?w.title=PX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=HO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=HO(r.style)),P(a.style)||(w.trackStyle=HO(a.style)),w.startText=FO(o),w.endText=FO(l),w.handlerText=FO(h),P(c)||(w.sizeBackground=HO(c)),d.visible&&!P(d.style)&&(ER(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return zX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}YX.specKey="legends",YX.builtInTheme={colorLegend:VX,sizeLegend:UX},YX.type=r.continuousLegend;const $X=(t,e)=>p(e)?t.map((t=>e[t])):void 0,XX=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),KX=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function qX(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=ZX(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=>XX(i,s)(t)&&XX(n,r)(t)&&(u(a)||XX([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: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:XO.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};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return OD.globalConfig.uniqueTooltip&&OD.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:XO.chart,event:_(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return OD.globalConfig.uniqueTooltip&&OD.hideTooltip(l.id),c}return"none"}const ZX=(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=$X(c,t);let _=$X(d,t);const y=KX(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(XX(c,v));if(!y&&(_=$X(d,i),!KX(_)))return;const n=e.type===YL.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=zC(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(XX(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=$X(d,o),!KX(_))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(XX(c,n));if(!y&&(_=$X(d,r),!KX(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===YL.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(XX(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=$X(d,i),!KX(_))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},JX=t=>p(t)&&!y(t),QX=t=>p(t)&&y(t);class tK extends Rz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=ER({},this._theme,r.style),r.offset=ER({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return 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)||!Vy(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=y_.getElementById(t.parentElement)):Vy(this._option.mode)&&(t.parentElement=null==Hy?void 0:Hy.body)}}const eK={offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}};class iK extends Oz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=tK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Vy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&JX(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&&OD.globalConfig.uniqueTooltip&&l&&OD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return 0;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:XO.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:XO.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(t.ChartEvent.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(t.ChartEvent.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?nH.canvas:nH.dom,n=BR.getComponentPluginInType(t);n||Fy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=BR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_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),(Ny(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=qX(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(QX(t)){if(JX(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>FF(t,e[i])))}if(QX(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}}iK.type=r.tooltip,iK.transformerConstructor=tK,iK.builtInTheme={tooltip:eK},iK.specKey="tooltip";var sK,nK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(sK||(sK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(nK||(nK={}));const rK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class aK extends Oz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),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}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{zC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshairBySpec(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t];if(e&&e.visible&&e.defaultSelect){const{axisIndex:i=0,datum:s}=e.defaultSelect,n=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===i));n&&(this._stateByField[t].currentValue.clear(),this._stateByField[t].currentValue.set(i,{axis:n,datum:s}))}}))}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){this.showDefault?(this._showDefaultCrosshairBySpec(),this.layoutByValue(!1)):this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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:KO.chart}:{source:XO.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)}onBeforeRender(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Ny(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(t.ChartEvent.tooltipHide,{source:XO.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:XO.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:XO.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{rK[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}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}aK.specKey="crosshair";const oK={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}};class lK extends aK{static getSpecInfo(t){return HD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const i=CF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){CF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:EF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"cartesian");e&&(Kj(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=Jj(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new nT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new rT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}lK.specKey="crosshair",lK.builtInTheme={crosshair:oK},lK.type=r.cartesianCrosshair;class hK extends aK{static getSpecInfo(t){return HD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=NL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=dz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=jD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new nT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new oT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new aT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}hK.specKey="crosshair",hK.builtInTheme={crosshair:oK},hK.type=r.polarCrosshair;const cK=(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},dK=(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)},uK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r}=e.input,{stateField:a,valueField:o}=e.output,l={},h=[],c=[];let d=!1;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&&(d=!0,r.domain.forEach((t=>{u(l[t])&&(c.push(t),l[t]=0)}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(l[t[i]])&&(c.push(t[i]),l[t[i]]=0),u(s[e])||(l[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const p=d?c:!1===r?c.sort(((t,e)=>t-e)):Object.keys(l);return p.forEach((t=>{const e={[a]:t};o&&(e[o]=l[t]),h.push(e)})),h};class pK extends Oz{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,i=e.getScale(),s=this._isReverse(),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._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 HL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HL(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,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this._regions[0].getLayoutStartPoint(),{width:h,height:c}=this._regions[0].getLayoutRect(),d=Math.abs(this._start-this._end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this._start+f,0,1),_=mt(this._end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(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,s;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))return;(null===(i=this._spec.roamDrag)||void 0===i?void 0:i.autoVisible)&&this.show();const[n,r]=t;let a=this._isHorizontal?n:r;this._dragAttr.reverse&&(a=-a),this._handleChartMove(a,null!==(s=this._dragAttr.rate)&&void 0!==s?s: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=PF(t),this._isHorizontal="horizontal"===LF(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=>!DC(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(DC(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(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=[];let s;if(this._relatedAxisComponent){const n={};HL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l;t.push(r.getRawData());const u=r.getSpec(),p="cartesian"===r.coordinate?Y(u.xField):Y(null!==(a=u.angleField)&&void 0!==a?a:u.categoryField),g="cartesian"===r.coordinate?Y(u.yField):Y(null!==(o=u.radiusField)&&void 0!==o?o:u.valueField);if(n[r.id]="link"===r.type?["from_xField"]:c===l?p:g,DC(c.getScale(0).type)?(s=!1,e.push(n[r.id])):e.push(n[r.id][0]),this._valueField){const t="link"===r.type?["from_yField"]:d===l?p:g;DC(d.getScale(0).type)&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else HL(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:n}=this._option;eI(n,"dataview",Sa),tI(n,"dataFilterComputeDomain",uK);const r=new Ta(n,{name:`${this.type}_${this.id}_data`});r.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i,isCategoryState:s},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new sD(this._option,r),r.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},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(DC(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&&DC(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,DC(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=DC(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 rE,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||(tI(this._option.dataSet,"dataFilterWithNewDomain",dK),tI(this._option.dataSet,"lockStatisticsFilter",cK),HL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>DC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}_parseDomainFromState(t,e){if(DC(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,o;const l={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,allowComponentZoom:!0};if(this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,l),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,l),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,l),null===(o=this._spec.roamDrag)||void 0===o?void 0:o.autoVisible){const t="panend";this._throttledHide=xt((()=>this.hide()),300),this.event.on(t,(()=>{this._throttledHide()}))}}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}onLayoutEnd(){const t=!(0===this._start&&1===this._end);this._autoVisible(t),super.onLayoutEnd()}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&&zC(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,zC(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]}clear(){this._throttledHide=null}}G(pK,dV);class gK extends Rz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=ER({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}}}const fK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),mK={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:fK(!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:fK(!0)};class vK extends pK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=gK,this.specKey="dataZoom",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="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!==(s=e.filterMode)&&void 0!==s?s:"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(){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new TE;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(!DC(t.type)||e[0]!==$(e))&&(!zC(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 NB(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(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange){s&&this._component&&this._component.setStartAndEnd(e,i),this._start=e,this._end=i;const r=this.statePointToData(e),a=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,r,a):this._handleStateChange(r,a,n))&&this.event.emit(t.ChartEvent.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:e,end:i,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){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:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:HO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:HO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:HO(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:HO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:HO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:HO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:HO(g.style)},selectedBackgroundStyle:HO(this._spec.selectedBackground.style),dragMaskStyle:HO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:ER(HO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},HO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:ER(HO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},HO(null===(d=m.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}=jD(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()}}vK.type=r.dataZoom,vK.transformerConstructor=gK,vK.builtInTheme={dataZoom:mK},vK.specKey="dataZoom";const _K={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class yK extends pK{constructor(e,i){var s;super(e,i),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=t.LayoutZIndex.DataZoom,this.layoutLevel=t.LayoutLevel.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(s=e.filterMode)&&void 0!==s?s:"axis"}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(){var t,e;this._updateScaleRange(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t),super.onLayoutEnd()}_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 hM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(e,i,s){super._handleChange(e,i,s);const n=PL(this._start,e)&&PL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this.statePointToData(e),r=this.statePointToData(i);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(this.statePointToData(e),this.statePointToData(i)))&&this.event.emit(t.ChartEvent.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=HO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=HO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}yK.type=r.scrollBar,yK.builtInTheme={scrollBar:_K},yK.specKey="scrollBar";const bK=(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},xK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),SK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:xK("l1FontSize","primaryFontColor")},content:{visible:!0,style:xK("l2FontSize","tertiaryFontColor")}};class AK extends Oz{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Indicator,this.layoutLevel=t.LayoutLevel.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return HD(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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(NO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(NO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){tI(this._option.dataSet,"indicatorFilter",bK);const t=new Ta(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 sD(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=ER({},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({},jO(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?_R(l,this._computeLayoutRadius()):0,dy:h?_R(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({},jO(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)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nL(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}AK.type=r.indicator,AK.builtInTheme={indicator:SK},AK.specKey="indicator";const kK=["sum","average","min","max","variance","standardDeviation","median"];function MK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function TK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&MK(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=dR(t.x)?BK(t.x,n)+r.x:PK(l.getXAxisHelper(),[t.x])+r.x,h}function wK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&MK(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=dR(t.y)?BK(t.y,n)+r.y:PK(l.getYAxisHelper(),[t.y])+r.y,h}function CK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&MK(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)),PK(a.angleAxisHelper,[t.angle])}function EK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&MK(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)),PK(a.radiusAxisHelper,[t.radius])}function BK(t,e){return Number(t.substring(0,t.length-1))*e/100}function PK(t,e){const i=t.getScale(0);return DC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function LK(t){return kK.includes(t)}function RK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getXAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=TK(t,_,n,u,c,o),r=wK(t,y,n,u,d,o),OK(s,b,S,g.length),OK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=TK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);OK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=wK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);OK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function OK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=CK(t,l,n,r),i=EK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=CK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=EK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function DK(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=dR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=dR(i)?Number(i.substring(0,i.length-1))*f/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])&&MK(_,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])&&MK(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:PK(d.getXAxisHelper(),b)+p.x+m,y:PK(d.getYAxisHelper(),x)+p.y+v})})),n}function FK(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])&&MK(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])&&MK(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:PK(l.angleAxisHelper,d),radius:PK(l.radiusAxisHelper,u)})})),s}function zK(t,e,i){let{x:s,y:n}=t;return dR(s)&&(s=BK(s,e)),dR(n)&&(n=BK(n,i)),{x:s,y:n}}function jK(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}=zK(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=>zK(t,n,r)))}function HK(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 VK(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},HO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},UK(HO(n.style),i,s)),p(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=UK(HO(r),i,s)),t}return{visible:!1}}function NK(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function UK(t,e,i){return d(t)?t(e,i):t}function WK(t,e){return d(t)?t(e):t}function GK(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 YK(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function $K(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=YK(t);return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h&&(!c||"process"in t&&"xy"in t.process)}}function XK(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=YK(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function KK(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function qK(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])&&LK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&LK(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])&&LK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&LK(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=>JK(i,t,e))):i.x=JK(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>JK(i,t,e))):i.y=JK(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>JK(i,t,e))):i.angle=JK(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>JK(i,t,e))):i.radius=JK(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=JK(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const ZK={min:(t,e)=>LL(t[0].latestData,e.field),max:(t,e)=>RL(t[0].latestData,e.field),sum:function(t,e){return OL(t[0].latestData,e.field)},average:function(t,e){return IL(t[0].latestData,e.field)},variance:function(t,e){return DL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DL(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 JK(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(m(t)){const{aggrType:i,field:s}=t;return ZK[i](e,{field:s})}return t}function QK(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 tq extends Oz{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 HD(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)&&LK(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 Ma;return e.registerParser("array",s),new Ta(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=NL(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){u(this._spec.offsetX)||(this._layoutOffsetX=pR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=pR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();tI(this._option.dataSet,"markerAggregation",qK),tI(this._option.dataSet,"markerFilter",QK);const i=new Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function eq(t,e){return function(t,e,i){const{predict:s}=It(t,(t=>t[e]),(t=>t[i])),n=LL(t,e),r=RL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class iq extends tq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=t.LayoutZIndex.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=$K(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:UK(HO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>VK(t,this._markerData,this._markAttributeContext))),state:{line:NK(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:NK(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:NK(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return NK(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return NK(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:UK(HO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:UK(HO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=HK([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=$K(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;tI(this._option.dataSet,"markerAggregation",qK),tI(this._option.dataSet,"markerRegression",eq),tI(this._option.dataSet,"markerFilter",QK);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ta(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}iq.specKey="markLine";const sq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),nq={style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}},refY:5},rq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:sq(!1),endSymbol:sq(!0),label:nq};class aq extends iq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new wP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=$K(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=RK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=DK(i,r,d,e.coordinatesOffset):c&&(y=jK(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(dR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}:Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=$K(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 Ta(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}aq.type=r.markLine,aq.coordinateType="cartesian",aq.builtInTheme={markLine:rq};class oq extends iq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=$K(this._spec);return e||i?new BP(t):new wP(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}=$K(e);let p=[],g={};const f={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=IK(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=FK(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=$K(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}}}oq.type=r.polarMarkLine,oq.coordinateType="polar",oq.builtInTheme={polarMarkLine:rq};class lq extends Oz{get orient(){return this._orient}constructor(e,i){super(e,i),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=t.LayoutZIndex.Title,this.layoutLevel=t.LayoutLevel.Title,this._orient="top",this._orient=cR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return HD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}afterSetLayoutStartPoint(t){k(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),k(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:k(t.width())?t.width():0,height:this._spec.height?this._spec.height:k(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=pR(this._spec.width,l.width,null,l.width),c=pR(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)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iL(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}}lq.type=r.title,lq.specKey=r.title,lq.builtInTheme={title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}}};class hq extends tq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=XK(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:UK(HO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>VK(t,this._markerData,this._markAttributeContext))),state:{area:NK(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>NK(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return NK(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=HK([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=XK(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}hq.specKey="markArea";const cq={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}};class dq extends hq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=XK(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=RK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=RK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=DK(s,a,u,i.coordinatesOffset):d&&(f=jK(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=XK(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}}}dq.type=r.markArea,dq.coordinateType="cartesian",dq.builtInTheme={markArea:cq};class uq extends hq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=XK(this._spec);return i||e||s?new PP(t):new EP(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}=XK(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=IK(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=FK(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=XK(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}}}uq.type=r.polarMarkArea,uq.coordinateType="polar",uq.builtInTheme={polarMarkArea:cq};const pq=t=>HO(Object.assign({},t)),gq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},HO(t.style))}),fq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=pq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=pq(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:{},HO(Object.assign({},y)));var y;const b=gq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=gq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=gq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=gq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},mq=t=>"left"===t||"right"===t,vq=t=>"top"===t||"bottom"===t,_q={visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class yq extends Oz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},fq(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({},fq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _L(t):this._playerComponent=new xL(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=mq(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=mq(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(t.ChartEvent.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())})),this._playerComponent.addEventListener(uL.end,(()=>{var e;this.event.emit(t.ChartEvent.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(e=this._spec)||void 0===e?void 0:e.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uL.backward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerBackward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.forward,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerForward,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.play,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPlay,{model:this,value:{spec:s,index:i,specs:this._specs}})})),this._playerComponent.addEventListener(uL.pause,(e=>{const{index:i}=e.detail,s=this._specs[i];this.event.emit(t.ChartEvent.playerPause,{model:this,value:{spec:s,index:i,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=mq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=vq(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):mq(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))):vq(this._orient)?this._maxSize():t.height}_computeDx(t){return mq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return vq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}}yq.builtInTheme={player:_q},yq.specKey="player",yq.type=r.player;class bq extends Oz{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Label,this._regions=i.getRegionsInIndex(i.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=tR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==PI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}bq.type=r.label;class xq extends pN{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}render(){}}xq.type="text",xq.constructorType="label";const Sq=()=>{gN(),BR.registerMark(xq.constructorType,xq)};class Aq extends Rz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class kq extends bq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=Aq,this.layoutZIndex=t.LayoutZIndex.Label,this._layoutRule=e.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(GO.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(GO.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),d(null==r?void 0:r.getStyleHandler)){const t=r.getStyleHandler(a);null==t||t.call(a,n,r)}(null===(s=null===(i=n.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&n.setAttribute("stroke",a.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=ER({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},RV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[vO])):t=>t.filter((t=>t.data[mO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?OV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}kq.type=r.label,kq.specKey="label",kq.transformerConstructor=Aq;class Mq extends bq{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=t.LayoutZIndex.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var e;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[gO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return ER({textStyle:{pickable:!0===this._spec.interactive},position:Tq(t,this._baseMark.type,a),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>"bottom"===a?t.data[vO]:t.data[mO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>OV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Tq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Mq.type=r.totalLabel,Mq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Mq.specKey="totalLabel";class wq extends tq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=KK(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L;const{itemContent:R={},itemLine:O={},targetSymbol:I={}}=this._spec,D=R,{type:F="text",text:z,symbol:H,image:V,richText:N,customMark:U,textStyle:W,symbolStyle:G,imageStyle:Y,richTextStyle:$,customMarkStyle:X,style:K={},state:q={}}=D,Z=e(D,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let J=null,Q=null,tt={};"text"===F?(J=null!==(t=null==z?void 0:z.state)&&void 0!==t?t:q,tt={dx:0,dy:0},Q=VK(j(tt,null!==(i=null!=z?z:W)&&void 0!==i?i:K),this._markerData,this._markAttributeContext)):"richText"===F?(J=null!==(s=null==N?void 0:N.state)&&void 0!==s?s:q,tt={width:100,height:100},Q=UK(j(tt,null!==(r=null!==(n=null==N?void 0:N.style)&&void 0!==n?n:$)&&void 0!==r?r:K),this._markerData,this._markAttributeContext)):"symbol"===F?(J=null!==(a=null==H?void 0:H.state)&&void 0!==a?a:q,tt={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},Q=HO(UK(j(tt,null!==(l=null!==(o=null==H?void 0:H.style)&&void 0!==o?o:G)&&void 0!==l?l:K),this._markerData,this._markAttributeContext))):"image"===F?(J=null!==(h=null==V?void 0:V.state)&&void 0!==h?h:q,tt={width:80,height:80},Q=UK(j(tt,null!==(d=null!==(c=null==V?void 0:V.style)&&void 0!==c?c:Y)&&void 0!==d?d:K),this._markerData,this._markAttributeContext)):"custom"===F&&(J=null!==(u=null==U?void 0:U.state)&&void 0!==u?u:q,Q=UK(null!==(g=null!==(p=null==U?void 0:U.style)&&void 0!==p?p:X)&&void 0!==g?g:K,this._markerData,this._markAttributeContext));const et={zIndex:this.layoutZIndex,interactive:null===(f=this._spec.interactive)||void 0===f||f,hover:null===(m=this._spec.interactive)||void 0===m||m,select:null===(v=this._spec.interactive)||void 0===v||v,position:{x:0,y:0},clipInRange:null!==(_=this._spec.clip)&&void 0!==_&&_,itemContent:Object.assign(Object.assign({type:F,offsetX:WK(R.offsetX,this._relativeSeries.getRegion()),offsetY:WK(R.offsetX,this._relativeSeries.getRegion())},Z),{style:UK(Q,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(y=I.offset)&&void 0!==y?y:0,visible:null!==(b=I.visible)&&void 0!==b&&b,size:null!==(x=I.size)&&void 0!==x?x:20,style:UK(I.style,this._markerData,this._markAttributeContext)},state:{line:NK(null!==(A=null===(S=this._spec.itemLine.line)||void 0===S?void 0:S.state)&&void 0!==A?A:{},this._markerData,this._markAttributeContext),lineStartSymbol:NK(null!==(M=null===(k=this._spec.itemLine.startSymbol)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineEndSymbol:NK(null!==(w=null===(T=this._spec.itemLine.endSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),itemContent:NK(J,this._markerData,this._markAttributeContext),textBackground:NK(null===(E=null===(C=this._spec.itemContent.text)||void 0===C?void 0:C.labelBackground)||void 0===E?void 0:E.state,this._markerData,this._markAttributeContext),targetItem:NK(null!==(P=null===(B=this._spec.targetSymbol)||void 0===B?void 0:B.state)&&void 0!==P?P:{},this._markerData,this._markAttributeContext)},animation:null!==(L=this._spec.animation)&&void 0!==L&&L,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:it,line:st={}}=O,nt=e(O,["visible","line"]);et.itemLine=!1!==it?Object.assign(Object.assign({},nt),{visible:!0,lineStyle:HO(st.style)}):{visible:!1};return new RP(et)}_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}=HK([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:GK(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:GK(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}=KK(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}wq.specKey="markPoint";const Cq={itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},endSymbol:{style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}},line:{style:{stroke:{type:"palette",key:"markLineStrokeColor"}}}},itemContent:{offsetY:-50}};class Eq extends wq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=RK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=DK(n,r,h,s.coordinatesOffset)[0]:l&&(c=jK(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=KK(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}}}Eq.type=r.markPoint,Eq.coordinateType="cartesian",Eq.builtInTheme={markPoint:Cq};class Bq extends wq{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=IK(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:le({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}])]}}}Bq.type=r.polarMarkPoint,Bq.coordinateType="polar",Bq.builtInTheme={polarMarkPoint:Cq};class Pq extends wq{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}])]}}}Pq.type=r.geoMarkPoint,Pq.coordinateType="geo",Pq.builtInTheme={geoMarkPoint:Cq};const Lq="inBrush",Rq="outOfBrush";class Oq extends Oz{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=t.LayoutZIndex.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return HD(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const e=this._transformBrushedMarkAttr(this._spec.inBrush),i=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((s=>{s.getActiveMarks().forEach((n=>{n&&(s.setMarkStyle(n,Object.assign({},e),Lq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Rq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(p(this._spec.brushLinkSeriesId)||p(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(Y(this._spec.brushLinkSeriesId),Y(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){p(this._spec.axisId)?Y(this._spec.axisId).forEach((t=>{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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new ML(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:HO(null===(s=this._spec)||void 0===s?void 0:s.style)},r),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));a.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(a),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(yL.brushActive,(s=>{this._initMarkBrushState(i,Rq),this._emitEvent(t.ChartEvent.brushActive,e)})),a.addEventListener(yL.drawStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.moveStart,(i=>{this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e)})),a.addEventListener(yL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e)})),a.addEventListener(yL.brushClear,(s=>{this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)})),a.addEventListener(yL.drawEnd,(s=>{var n;this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e)}})),a.addEventListener(yL.moveEnd,(i=>{this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e)}))}_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]}}_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({},HO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e){var i;this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord},vchart:null===(i=this._option)||void 0===i?void 0:i.globalInstance})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Lq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Lq),i.addState(Rq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Lq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Lq),i.addState(Rq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Ee(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Lq),s.removeState(Rq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,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,startValue:i.statePointToData(h),endValue:i.statePointToData(c)})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}Oq.type=r.brush,Oq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Oq.specKey="brush";class Iq extends Oz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${QR}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,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),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=fF({},mF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(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 U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Iq.type=r.customMark,Iq.specKey="customMark";class Dq{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||(k(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._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&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=>Fq(t))),a=n.filter((t=>!Fq(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>Fq(t))),h=o.filter((t=>!Fq(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);k(h.width)||(h.width=l.width),k(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function Fq(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}Dq.type="grid";const zq="vchart-tooltip",jq=`${zq}-container`,Hq=`${zq}-title`,Vq=`${zq}-content-box`,Nq={offsetX:10,offsetY:10},Uq="99999999999999";function Wq(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const Gq=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,Yq=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?Wq(t):"",$q=(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},Xq={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},Kq=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=Xq[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class qq extends lz{constructor(){super(...arguments),this._visible=!0,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const 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 f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=WD(null==T?void 0:T.position,b,e),C=null!==(r=WD(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:tO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:eO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Vy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=Gq(e,F),V=Gq(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({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?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(Kq(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=$q(t,_),W.top=$q(i,_),W.right=$q(e,_),W.bottom=$q(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=$q(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=Kq(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",Jq=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=Zq(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=Zq(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},Qq=(t={})=>{const{lineHeight:e}=t;return t.fontSize?pR(e,t.fontSize):0},tZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),r&&(o=ni(r),a.padding=Zq(o)),{panelStyle:a,panelPadding:o}};function eZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const iZ=t=>{BR.registerComponentPlugin(t.type,t)};class sZ extends qq{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(sZ.type),this.type=nH.dom,this._tooltipContainer=null==Hy?void 0:Hy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Hy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=tZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:Zq(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=Jq(h),x=Jq(d),S=Jq(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=Zq(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=Zq(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=Zq(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(Qq(p),Qq(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(Hq))),l=a.find((t=>t.className.includes(Vq)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(Hq),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(eZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${zq}-column`),e.classList.add(`${zq}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(Vq),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];eZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));eZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${zq}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=Yq(e.key),e.keyStyle&&Jq(e.keyStyle,l)):"value"===i?(o.innerHTML=Yq(e.value),e.valueStyle&&Jq(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?Wq(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?Wq(c):m,y=p,b=t=>new Ag({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=uh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?Wq(u):"currentColor",`\n \n \n \n `;const w=T?uh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),eZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(Vq))),h=[...o.children].find((t=>t.className.includes(Hq)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(Hq)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=pR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,eZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},cf||(cf=lf.CreateGraphic("richtext",{})),cf.setAttributes(a),cf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function aZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:nZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const oZ=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 lZ extends qq{constructor(){super(lZ.type),this.type=nH.canvas,this._attributes=null}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new BL({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=mR(d.padding),x=aZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=aZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=aZ(m,i),k={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},M={panel:oZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:k,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=ER({},S,aZ(b,void 0,{})),{width:s,height:n,text:r}=rZ(h,i);T.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(m)){const t=ER({},A,aZ(x,void 0,{})),{width:e,height:s,text:n}=rZ(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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=ER({},x,aZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=rZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&M.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=C-b.left-b.right-I-L-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=E,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?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()}}lZ.type=nH.canvas;const hZ=()=>{iZ(lZ)},cZ=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const f={modelInfo:[]};if("chart"===t)f.isChart=!0,f.modelInfo.push({spec:e,type:"chart"});else if("region"===t)f.modelType="region",f.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(YL).includes(t))f.modelType="series",f.specKey="series",f.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&f.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=BR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,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?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=BR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.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];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},dZ=(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=cZ(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):MR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=ER({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:ER(f,m),hasChanged:!0};const i=ER({},t,m);TR(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(f[c])?f[c].push(t):u(f[c])?f[c]="component"===h?t:[t]:f[c]=[f[c],t]}return{chartSpec:f,hasChanged:!0}},uZ=t=>{BR.registerChartPlugin(t.type,t)};class pZ extends lz{constructor(){super(pZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[pZ.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[pZ.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=CR(this._option.globalInstance.getSpec(),["data",pZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=CR(this._baseChartSpec,["data",pZ.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=dZ(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=CR(i,["data",pZ.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()}}pZ.pluginType="chart",pZ.specKey="media",pZ.type="MediaQueryPlugin";const gZ=/\{([^}]+)\}/,fZ=/\{([^}]+)\}/g,mZ=/:/;class vZ extends lz{constructor(){super(vZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[vZ.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)),BR.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=gZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(fZ,((t,i)=>{if(!mZ.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(yi.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}vZ.pluginType="chart",vZ.specKey="formatter",vZ.type="formatterPlugin";OD.useRegisters([()=>{hH(),dH(),pH(),Hj(),jj(),kj(),fj(),ZF(),QF(),AD(),bD(),lj(),nj(),BR.registerSeries(Mj.type,Mj),BR.registerChart(gH.type,gH)},()=>{hH(),dH(),pH(),jj(),kj(),fj(),ZF(),vH(),QF(),bH(),lj(),nj(),BR.registerSeries(SH.type,SH),Hj(),BR.registerChart(kH.type,kH)},()=>{hH(),dH(),pH(),jj(),zH(),Hj(),BR.registerChart(HH.type,HH)},()=>{hH(),dH(),Hj(),jj(),qH(),BR.registerChart(JH.type,JH)},()=>{dH(),XN(),BR.registerChart(N$.type,N$)},()=>{hH(),dH(),Hj(),jj(),pU(),BR.registerChart(G$.type,G$)},()=>{hH(),dH(),pH(),Hj(),jj(),SU(),BR.registerChart($$.type,$$)},()=>{hH(),dH(),pH(),Hj(),jj(),zH(),BR.registerChart(Q$.type,Q$)},()=>{dH(),gV(),nV(),BR.registerSeries(mV.type,mV),BR.registerImplement("registerMap",rI),BR.registerImplement("unregisterMap",aI),xD(),BR.registerChart(D$.type,D$)},()=>{dH(),t$(),BR.registerSeries(i$.type,i$),NN(),FU(),hU(),HU(),BR.registerChart(sX.type,sX)},()=>{dH(),wG(),BR.registerChart(aX.type,aX)},()=>{dH(),$G(),BR.registerChart(lX.type,lX)},()=>{hH(),dH(),pH(),Hj(),jj(),GV(),BR.registerChart(bX.type,bX)},()=>{hH(),dH(),Hj(),jj(),uN(),BR.registerChart(SX.type,SX)},()=>{hH(),dH(),Hj(),jj(),HU(),BR.registerChart(eX.type,eX)},()=>{hH(),dH(),Hj(),jj(),XU(),BR.registerChart(cX.type,cX)},()=>{hH(),dH(),Hj(),jj(),AN(),BR.registerChart(uX.type,uX)},()=>{hH(),dH(),pH(),Hj(),jj(),vH(),lj(),nj(),BR.registerSeries(CN.type,CN),BR.registerChart(TX.type,TX)},()=>{dH(),dY(),BR.registerChart(gX.type,gX)},()=>{dH(),vY(),BR.registerChart(mX.type,mX)},()=>{dH(),WY(),BR.registerChart(_X.type,_X)},()=>{dH(),mo.load(pM),DY(),BR.registerChart(kX.type,kX)},()=>{dH(),h$(),BR.registerChart(CX.type,CX)},()=>{dH(),S$(),BR.registerChart(BX.type,BX)},()=>{hH(),dH(),pH(),Hj(),BR.registerChart(K$.type,K$),jj()},nj,lj,()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),Vz(),BR.registerComponent(hj.type,hj)},()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),Vz(),BR.registerComponent(cj.type,cj)},()=>{BR.registerGraphicComponent(Iz.lineAxis,((t,e)=>new AC(t,e))),BR.registerGraphicComponent(Dz.lineAxisGrid,((t,e)=>new RB(t,e))),Vz(),BR.registerComponent(dj.type,dj)},dU,hU,()=>{BR.registerComponent(IX.type,IX)},()=>{BR.registerComponent(YX.type,YX)},()=>{BR.registerComponent(iK.type,iK)},()=>{BR.registerComponent(lK.type,lK)},()=>{BR.registerComponent(hK.type,hK)},()=>{BR.registerComponent(vK.type,vK)},()=>{BR.registerComponent(yK.type,yK)},()=>{BR.registerComponent(AK.type,AK)},gV,()=>{BR.registerComponent(aq.type,aq),TP()},()=>{BR.registerComponent(dq.type,dq),CP()},()=>{BR.registerComponent(Eq.type,Eq),LP()},()=>{BR.registerComponent(oq.type,oq),BP._animate=oP,TP()},()=>{BR.registerComponent(uq.type,uq),PP._animate=hP,CP()},()=>{BR.registerComponent(Bq.type,Bq),LP()},()=>{BR.registerComponent(Pq.type,Pq),LP()},()=>{BR.registerComponent(lq.type,lq)},()=>{BR.registerComponent(yq.type,yq)},()=>{BR.registerGraphicComponent(kq.type,(t=>new EB(t))),Sq(),zz(),BR.registerComponent(kq.type,kq,!0,1/0)},()=>{BR.registerGraphicComponent(Mq.type,(t=>new EB(t))),Sq(),zz(),BR.registerComponent(Mq.type,Mq,!0)},()=>{BR.registerComponent(Oq.type,Oq)},()=>{BR.registerComponent(Iq.type,Iq)},()=>{mo.load(iT)},()=>{BR.registerLayout(Dq.type,Dq)},hZ,ED,LD]),OD.useRegisters([()=>{sA(mo)}]),t.AxisSyncPlugin=hz,t.CanvasTooltipHandler=lZ,t.DEFAULT_CHART_HEIGHT=eO,t.DEFAULT_CHART_WIDTH=tO,t.DEFAULT_CLOSE_STROKE_JOIN=FD,t.DEFAULT_DATA_INDEX=sO,t.DEFAULT_DATA_KEY=nO,t.DEFAULT_DATA_SERIES_FIELD=rO,t.DEFAULT_KEY=kO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=DD,t.DEFAULT_MEASURE_CANVAS_ID=iO,t.DEFAULT_SERIES_STYLE_NAME=aO,t.DEFAULT_SMOOTH_INTERPOLATE=ID,t.DomTooltipHandler=sZ,t.Factory=BR,t.FormatterPlugin=vZ,t.MOSAIC_CAT_END_PERCENT=xO,t.MOSAIC_CAT_START_PERCENT=bO,t.MOSAIC_VALUE_END_PERCENT=yO,t.MOSAIC_VALUE_START_PERCENT=_O,t.ManualTicker=class extends rw{constructor(t){super(t),this.lastFrameTime=0,this.status=Co.RUNNING}setupTickHandler(){const t=new aw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Co.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Co.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Co.RUNNING,!0}},t.MediaQuery=pZ,t.PREFIX=QR,t.SEGMENT_FIELD_END=AO,t.SEGMENT_FIELD_START=SO,t.STACK_FIELD_END=hO,t.STACK_FIELD_END_OffsetSilhouette=pO,t.STACK_FIELD_END_PERCENT=dO,t.STACK_FIELD_KEY=oO,t.STACK_FIELD_START=lO,t.STACK_FIELD_START_OffsetSilhouette=uO,t.STACK_FIELD_START_PERCENT=cO,t.STACK_FIELD_TOTAL=gO,t.STACK_FIELD_TOTAL_BOTTOM=vO,t.STACK_FIELD_TOTAL_PERCENT=fO,t.STACK_FIELD_TOTAL_TOP=mO,t.StreamLight=class extends yw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=_o.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new jl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=_o.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Go.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Go.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=rl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=rl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{iZ(sZ)},t.registerFormatPlugin=()=>{uZ(vZ)},t.registerMediaQuery=()=>{uZ(pZ)},t.registerTheme=HR,t.removeTheme=NR,t.themeExist=UR,t.themes=FR,t.token=SR,t.transformColorSchemeToStandardStruct=sR,t.transformToGraphic=HO,t.version="2.0.6",t.vglobal=y_,t.warn=Dy,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index c8379e4a93..583aa4d9ad 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "2.0.5", + "version": "2.0.6", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json index afea2767d2..155f5626ab 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:2.0.5", - "@visactor/vchart-extension": "workspace:2.0.5" + "@visactor/vchart": "workspace:2.0.6", + "@visactor/vchart-extension": "workspace:2.0.6" }, "devDependencies": { "@rushstack/eslint-patch": "~1.1.4", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index a50764feff..7a58dfdfaf 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -56,10 +56,10 @@ "vite": "3.2.6" }, "dependencies": { - "@visactor/vrender-core": "1.0.13", - "@visactor/vrender-kits": "1.0.13", - "@visactor/vchart": "workspace:2.0.5", - "@visactor/vrender": "1.0.13", + "@visactor/vrender-core": "~1.0.18", + "@visactor/vrender-kits": "~1.0.18", + "@visactor/vchart": "workspace:2.0.6", + "@visactor/vrender": "~1.0.18", "@visactor/vutils": "~1.0.6" } -} \ No newline at end of file +}